[tryton-debian-vcs] tryton-modules-account-stock-anglo-saxon branch debian updated. debian/3.2.0-1-5-g4621330

Mathias Behrle tryton-debian-vcs at alioth.debian.org
Thu Oct 23 12:14:18 UTC 2014


The following commit has been merged in the debian branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/tryton-modules-account-stock-anglo-saxon.git;a=commitdiff;h=debian/3.2.0-1-5-g4621330

commit 46213301d8a233e8b63aeafe66ed20d40f808ca4
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Thu Oct 23 13:31:58 2014 +0200

    Releasing debian version 3.4.0-1.
    
    Signed-off-by: Mathias Behrle <mathiasb at m9s.biz>

diff --git a/debian/changelog b/debian/changelog
index 9f34ccf..b7fd19a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+tryton-modules-account-stock-anglo-saxon (3.4.0-1) unstable; urgency=medium
+
+  * Updating signing key while using now plain .asc files instead of .pgp
+    binaries.
+  * Adding actual upstream signing key.
+  * Updating to Standards-Version: 3.9.6, no changes needed.
+  * Merging upstream version 3.4.0.
+
+ -- Mathias Behrle <mathiasb at m9s.biz>  Tue, 21 Oct 2014 20:23:51 +0200
+
 tryton-modules-account-stock-anglo-saxon (3.2.0-1) unstable; urgency=medium
 
   * Merging upstream version 3.2.0.
commit 497a0cdf8a102c9990d997a90e8010ec28f063a8
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Tue Oct 21 11:29:07 2014 +0200

    Merging upstream version 3.4.0.

diff --git a/CHANGELOG b/CHANGELOG
index c021b04..f372948 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,7 @@
+Version 3.4.0 - 2014-10-20
+* Bug fixes (see mercurial logs for details)
+* Add account stock method on fiscal year
+
 Version 3.2.0 - 2014-04-21
 * Bug fixes (see mercurial logs for details)
 
diff --git a/PKG-INFO b/PKG-INFO
index 5c35715..ad66f50 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: trytond_account_stock_anglo_saxon
-Version: 3.2.0
+Version: 3.4.0
 Summary: Tryton module for anglo-saxon real-time stock valuation
 Home-page: http://www.tryton.org/
 Author: Tryton
 Author-email: issue_tracker at tryton.org
 License: GPL-3
-Download-URL: http://downloads.tryton.org/3.2/
+Download-URL: http://downloads.tryton.org/3.4/
 Description: trytond_account_stock_anglo_saxon
         =================================
         
diff --git a/__init__.py b/__init__.py
index 85b9b73..78065e2 100644
--- a/__init__.py
+++ b/__init__.py
@@ -5,6 +5,7 @@ from trytond.pool import Pool
 from .product import *
 from .stock import *
 from .invoice import *
+from .account import *
 
 
 def register():
@@ -13,4 +14,5 @@ def register():
         Template,
         Move,
         InvoiceLine,
+        FiscalYear,
         module='account_stock_anglo_saxon', type_='model')
diff --git a/account.py b/account.py
new file mode 100644
index 0000000..40f31f3
--- /dev/null
+++ b/account.py
@@ -0,0 +1,16 @@
+#This file is part of Tryton.  The COPYRIGHT file at the top level of
+#this repository contains the full copyright notices and license terms.
+from trytond.pool import PoolMeta
+
+__all__ = ['FiscalYear']
+__metaclass__ = PoolMeta
+
+
+class FiscalYear:
+    __name__ = 'account.fiscalyear'
+
+    @classmethod
+    def __setup__(cls):
+        super(FiscalYear, cls).__setup__()
+        cls.account_stock_method.selection.append(
+            ('anglo_saxon', 'Anglo-Saxon'))
diff --git a/doc/index.rst b/doc/index.rst
index 0423deb..1a5bac3 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -12,7 +12,8 @@ A new field is added to Product and Category:
 As usual, if the account is not defined on Product, it is the category one that
 is used.
 
-The Account Moves of Invoices are modified.
+The Account Moves of Invoices are modified for fiscal year with the account
+stock method set.
 
 On Supplier Invoice, the cost of the Product at reception is debited on the
 Account Stock Supplier and only the difference is debited to the Account
diff --git a/invoice.py b/invoice.py
index 3ffb054..d352dd9 100644
--- a/invoice.py
+++ b/invoice.py
@@ -51,6 +51,7 @@ class InvoiceLine:
         Move = pool.get('stock.move')
         PurchaseLine = pool.get('purchase.line')
         SaleLine = pool.get('sale.line')
+        Period = pool.get('account.period')
 
         result = super(InvoiceLine, self).get_move_line()
 
@@ -61,6 +62,13 @@ class InvoiceLine:
         if self.product.type != 'goods':
             return result
 
+        accounting_date = (self.invoice.accounting_date
+            or self.invoice.invoice_date)
+        period_id = Period.find(self.invoice.company.id, date=accounting_date)
+        period = Period(period_id)
+        if period.fiscalyear.account_stock_method != 'anglo_saxon':
+            return result
+
         moves = []
         # other types will get current cost price
         if isinstance(self.origin, (PurchaseLine, SaleLine)):
diff --git a/locale/bg_BG.po b/locale/bg_BG.po
index 0382f38..c1f64c1 100644
--- a/locale/bg_BG.po
+++ b/locale/bg_BG.po
@@ -38,3 +38,7 @@ msgstr "Ще се използва тази сметка вместо тази 
 msgctxt "model:account.account.template,name:account_template_cogs"
 msgid "COGS"
 msgstr ""
+
+msgctxt "selection:account.fiscalyear,account_stock_method:"
+msgid "Anglo-Saxon"
+msgstr ""
diff --git a/locale/ca_ES.po b/locale/ca_ES.po
index babc13d..815bb76 100644
--- a/locale/ca_ES.po
+++ b/locale/ca_ES.po
@@ -37,3 +37,7 @@ msgstr "Aquest compte s'usarà en lloc del definit a la categoria."
 msgctxt "model:account.account.template,name:account_template_cogs"
 msgid "COGS"
 msgstr "COGS"
+
+msgctxt "selection:account.fiscalyear,account_stock_method:"
+msgid "Anglo-Saxon"
+msgstr ""
diff --git a/locale/cs_CZ.po b/locale/cs_CZ.po
index 8a9e9a7..3ec9dd8 100644
--- a/locale/cs_CZ.po
+++ b/locale/cs_CZ.po
@@ -37,3 +37,7 @@ msgstr ""
 msgctxt "model:account.account.template,name:account_template_cogs"
 msgid "COGS"
 msgstr ""
+
+msgctxt "selection:account.fiscalyear,account_stock_method:"
+msgid "Anglo-Saxon"
+msgstr ""
diff --git a/locale/de_DE.po b/locale/de_DE.po
index eb5530a..394dde8 100644
--- a/locale/de_DE.po
+++ b/locale/de_DE.po
@@ -33,9 +33,13 @@ msgstr "Ausgang (Angelsächsische Bewertung)"
 msgctxt "help:product.template,account_cogs:"
 msgid "This account will be used instead of the one defined on the category."
 msgstr ""
-"Dieses Konto überschreibt das Konto welches in der Kategorie eingestellt "
-"ist."
+"Dieses Konto wird benutzt anstelle des Kontos, welches in der Kategorie "
+"eingestellt ist."
 
 msgctxt "model:account.account.template,name:account_template_cogs"
 msgid "COGS"
 msgstr "Kosten der verkauften Waren (COGS)"
+
+msgctxt "selection:account.fiscalyear,account_stock_method:"
+msgid "Anglo-Saxon"
+msgstr "Angelsächsisch"
diff --git a/locale/es_AR.po b/locale/es_AR.po
index 005a4e6..173f801 100644
--- a/locale/es_AR.po
+++ b/locale/es_AR.po
@@ -37,3 +37,7 @@ msgstr "Se usará esta cuenta en lugar de la definida en la categoría."
 msgctxt "model:account.account.template,name:account_template_cogs"
 msgid "COGS"
 msgstr "CMV"
+
+msgctxt "selection:account.fiscalyear,account_stock_method:"
+msgid "Anglo-Saxon"
+msgstr "Anglo-sajón"
diff --git a/locale/es_CO.po b/locale/es_CO.po
index cd2439d..cf02ecf 100644
--- a/locale/es_CO.po
+++ b/locale/es_CO.po
@@ -38,3 +38,7 @@ msgstr "Esta cuenta se usará en lugar de la definida en la categoría."
 msgctxt "model:account.account.template,name:account_template_cogs"
 msgid "COGS"
 msgstr "Costos de Ventas"
+
+msgctxt "selection:account.fiscalyear,account_stock_method:"
+msgid "Anglo-Saxon"
+msgstr "Anglosajon"
diff --git a/locale/es_AR.po b/locale/es_EC.po
similarity index 68%
copy from locale/es_AR.po
copy to locale/es_EC.po
index 005a4e6..39070d9 100644
--- a/locale/es_AR.po
+++ b/locale/es_EC.po
@@ -4,7 +4,7 @@ msgstr "Content-Type: text/plain; charset=utf-8\n"
 
 msgctxt "error:stock.move:"
 msgid "Anglo-Saxon quantity can not be greater than quantity."
-msgstr "La cantidad anglo-sajona no puede ser mayor que la cantidad."
+msgstr "La cantidad anglosajona no puede ser mayor que la cantidad."
 
 msgctxt "field:product.category,account_cogs:"
 msgid "Account Cost of Goods Sold"
@@ -12,7 +12,7 @@ msgstr "Cuenta de Costo de Mercaderías Vendidas"
 
 msgctxt "field:product.category,account_cogs_used:"
 msgid "Account Cost of Goods Sold Used"
-msgstr "Cuenta de Costo de Mercaderías Vendidas utilizada"
+msgstr "Cuenta de Costo de Mercaderías Vendidas Utilizada"
 
 msgctxt "field:product.template,account_cogs:"
 msgid "Account Cost of Goods Sold"
@@ -20,20 +20,24 @@ msgstr "Cuenta de Costo de Mercaderías Vendidas"
 
 msgctxt "field:product.template,account_cogs_used:"
 msgid "Account Cost of Goods Sold Used"
-msgstr "Cuenta de Costo de Mercaderías Vendidas utilizada"
+msgstr "Cuenta de Costo de Mercaderías Vendidas Utilizada"
 
 msgctxt "field:stock.move,in_anglo_saxon_quantity:"
 msgid "Input Anglo-Saxon Quantity"
-msgstr "Salida de cantidad anglo-sajona"
+msgstr "Cantidad Anglosajona de Ingreso"
 
 msgctxt "field:stock.move,out_anglo_saxon_quantity:"
 msgid "Output Anglo-Saxon Quantity"
-msgstr "Entrada de cantidad anglo-sajona"
+msgstr "Cantidad Anglosajona de Salida"
 
 msgctxt "help:product.template,account_cogs:"
 msgid "This account will be used instead of the one defined on the category."
-msgstr "Se usará esta cuenta en lugar de la definida en la categoría."
+msgstr "Esta cuenta se utilizará en lugar de la definida en la categoría."
 
 msgctxt "model:account.account.template,name:account_template_cogs"
 msgid "COGS"
-msgstr "CMV"
+msgstr "CDMV"
+
+msgctxt "selection:account.fiscalyear,account_stock_method:"
+msgid "Anglo-Saxon"
+msgstr "Anglosajón"
diff --git a/locale/es_ES.po b/locale/es_ES.po
index d07987d..545400f 100644
--- a/locale/es_ES.po
+++ b/locale/es_ES.po
@@ -4,31 +4,31 @@ msgstr "Content-Type: text/plain; charset=utf-8\n"
 
 msgctxt "error:stock.move:"
 msgid "Anglo-Saxon quantity can not be greater than quantity."
-msgstr "La cantidad anglo-sajona no puede ser mayor que la cantidad."
+msgstr "La cantidad anglosajona no puede ser mayor que la cantidad."
 
 msgctxt "field:product.category,account_cogs:"
 msgid "Account Cost of Goods Sold"
-msgstr "Cuenta coste bienes vendidos"
+msgstr "Cuenta coste de bienes vendidos"
 
 msgctxt "field:product.category,account_cogs_used:"
 msgid "Account Cost of Goods Sold Used"
-msgstr "Cuenta coste bienes vendidos usada"
+msgstr "Cuenta coste de bienes vendidos usada"
 
 msgctxt "field:product.template,account_cogs:"
 msgid "Account Cost of Goods Sold"
-msgstr "Cuenta coste bienes vendidos"
+msgstr "Cuenta coste de bienes vendidos"
 
 msgctxt "field:product.template,account_cogs_used:"
 msgid "Account Cost of Goods Sold Used"
-msgstr "Cuenta coste bienes vendidos usada"
+msgstr "Cuenta coste de bienes vendidos usada"
 
 msgctxt "field:stock.move,in_anglo_saxon_quantity:"
 msgid "Input Anglo-Saxon Quantity"
-msgstr ""
+msgstr "Cantidad anglosajona de entrada"
 
 msgctxt "field:stock.move,out_anglo_saxon_quantity:"
 msgid "Output Anglo-Saxon Quantity"
-msgstr ""
+msgstr "Cantidad anglosajona de salida"
 
 msgctxt "help:product.template,account_cogs:"
 msgid "This account will be used instead of the one defined on the category."
@@ -36,4 +36,8 @@ msgstr "Se usará esta cuenta en lugar de la definida en la categoría."
 
 msgctxt "model:account.account.template,name:account_template_cogs"
 msgid "COGS"
-msgstr "COGS"
+msgstr "CMV"
+
+msgctxt "selection:account.fiscalyear,account_stock_method:"
+msgid "Anglo-Saxon"
+msgstr "Anglosajón"
diff --git a/locale/fr_FR.po b/locale/fr_FR.po
index b9333bf..5804f59 100644
--- a/locale/fr_FR.po
+++ b/locale/fr_FR.po
@@ -8,19 +8,19 @@ msgstr "La quantité anglo-saxonne ne peut être plus grande que la quantité."
 
 msgctxt "field:product.category,account_cogs:"
 msgid "Account Cost of Goods Sold"
-msgstr "Compte \"coût des marchandises vendues\""
+msgstr "Compte « coût des marchandises vendues »"
 
 msgctxt "field:product.category,account_cogs_used:"
 msgid "Account Cost of Goods Sold Used"
-msgstr "Compte \"coût des marchandises vendues\" utilisé"
+msgstr "Compte « coût des marchandises vendues » utilisé"
 
 msgctxt "field:product.template,account_cogs:"
 msgid "Account Cost of Goods Sold"
-msgstr "Compte \"coût des marchandises vendues\""
+msgstr "Compte « coût des marchandises vendues »"
 
 msgctxt "field:product.template,account_cogs_used:"
 msgid "Account Cost of Goods Sold Used"
-msgstr "Compte \"coût des marchandises vendues\" utilisé"
+msgstr "Compte « coût des marchandises vendues » utilisé"
 
 msgctxt "field:stock.move,in_anglo_saxon_quantity:"
 msgid "Input Anglo-Saxon Quantity"
@@ -37,3 +37,7 @@ msgstr "Ce compte sera utilisé au lieu de celui défini sur la catégorie."
 msgctxt "model:account.account.template,name:account_template_cogs"
 msgid "COGS"
 msgstr "Prix du bien vendu"
+
+msgctxt "selection:account.fiscalyear,account_stock_method:"
+msgid "Anglo-Saxon"
+msgstr "Anglo-Saxonne"
diff --git a/locale/nl_NL.po b/locale/nl_NL.po
index c3f2a22..6bd3e29 100644
--- a/locale/nl_NL.po
+++ b/locale/nl_NL.po
@@ -39,3 +39,7 @@ msgstr ""
 msgctxt "model:account.account.template,name:account_template_cogs"
 msgid "COGS"
 msgstr ""
+
+msgctxt "selection:account.fiscalyear,account_stock_method:"
+msgid "Anglo-Saxon"
+msgstr ""
diff --git a/locale/ru_RU.po b/locale/ru_RU.po
index 0a0a8e2..184d3b1 100644
--- a/locale/ru_RU.po
+++ b/locale/ru_RU.po
@@ -38,3 +38,7 @@ msgstr "Этот счет будет использован вместо ука
 msgctxt "model:account.account.template,name:account_template_cogs"
 msgid "COGS"
 msgstr ""
+
+msgctxt "selection:account.fiscalyear,account_stock_method:"
+msgid "Anglo-Saxon"
+msgstr ""
diff --git a/locale/sl_SI.po b/locale/sl_SI.po
index eccdac4..4863fdb 100644
--- a/locale/sl_SI.po
+++ b/locale/sl_SI.po
@@ -37,3 +37,7 @@ msgstr "Namesto konta v kategoriji se bo uporabil ta konto prihodkov."
 msgctxt "model:account.account.template,name:account_template_cogs"
 msgid "COGS"
 msgstr "COGS"
+
+msgctxt "selection:account.fiscalyear,account_stock_method:"
+msgid "Anglo-Saxon"
+msgstr "Anglosaški"
diff --git a/product.py b/product.py
index 064aa3f..8d5ef30 100644
--- a/product.py
+++ b/product.py
@@ -4,6 +4,8 @@ from trytond.model import fields
 from trytond.pyson import Eval
 from trytond.pool import PoolMeta
 
+from trytond.modules.account_product import MissingFunction
+
 __all__ = ['Category', 'Template']
 __metaclass__ = PoolMeta
 
@@ -20,8 +22,9 @@ class Category:
                     | Eval('account_parent')),
                 },
             depends=['account_parent']))
-    account_cogs_used = fields.Function(fields.Many2One('account.account',
-        'Account Cost of Goods Sold Used'), 'get_account')
+    account_cogs_used = MissingFunction(fields.Many2One('account.account',
+            'Account Cost of Goods Sold Used'), 'missing_account',
+        'get_account')
 
 
 class Template:
@@ -35,12 +38,10 @@ class Template:
                 'invisible': ((~Eval('context', {}).get('company'))
                     | Eval('account_category')
                     | (Eval('type') != 'goods')),
-                'required': ((Eval('type') == 'goods')
-                    & Eval('context', {}).get('company')
-                    & ~Eval('account_category')),
                 },
             help='This account will be used instead of the one defined '
             'on the category.',
             depends=['account_category', 'type']))
-    account_cogs_used = fields.Function(fields.Many2One('account.account',
-        'Account Cost of Goods Sold Used'), 'get_account')
+    account_cogs_used = MissingFunction(fields.Many2One('account.account',
+            'Account Cost of Goods Sold Used'), 'missing_account',
+        'get_account')
diff --git a/setup.py b/setup.py
index 85cbe2d..a787cf9 100644
--- a/setup.py
+++ b/setup.py
@@ -47,7 +47,7 @@ for dep in info.get('depends', []):
         requires.append(get_require_version('trytond_%s' % dep))
 requires.append(get_require_version('trytond'))
 
-tests_require = [get_require_version('proteus')]
+tests_require = [get_require_version('proteus'), 'mock']
 
 setup(name=name,
     version=version,
diff --git a/stock.py b/stock.py
index 1cc988d..f3dcae0 100644
--- a/stock.py
+++ b/stock.py
@@ -131,7 +131,7 @@ class Move:
             if consumed_qty >= quantity:
                 break
 
-            if type_.startswith('in_'):
+            if type_ == 'in_supplier':
                 with Transaction().set_context(date=move.effective_date):
                     unit_price = Currency.compute(move.currency,
                         move.unit_price, move.company.currency, round=False)
@@ -141,6 +141,7 @@ class Move:
                 cost_price = move.cost_price
 
             yield (move, qty, cost_price)
+            consumed_qty += qty
 
     @classmethod
     def update_anglo_saxon_quantity_product_cost(cls, product, moves,
@@ -169,11 +170,10 @@ class Move:
 
             cost += move_cost_price * Decimal(str(move_qty))
 
-            with Transaction().set_user(0, set_context=True):
-                cls.write([move], {
-                        as_qty_field: (
-                            (getattr(move, as_qty_field) or 0.0) + move_qty),
-                        })
+            cls.write([move], {
+                    as_qty_field: (
+                        (getattr(move, as_qty_field) or 0.0) + move_qty),
+                    })
 
         if consumed_qty < total_qty:
             qty = total_qty - consumed_qty
diff --git a/tests/scenario_account_stock_anglo_saxon.rst b/tests/scenario_account_stock_anglo_saxon.rst
index 39da1ee..885c984 100644
--- a/tests/scenario_account_stock_anglo_saxon.rst
+++ b/tests/scenario_account_stock_anglo_saxon.rst
@@ -81,6 +81,7 @@ Create fiscal year::
     >>> fiscalyear.start_date = today + relativedelta(month=1, day=1)
     >>> fiscalyear.end_date = today + relativedelta(month=12, day=31)
     >>> fiscalyear.company = company
+    >>> fiscalyear.account_stock_method = 'anglo_saxon'
     >>> post_move_sequence = Sequence(name='%s' % today.year,
     ...     code='account.move',
     ...     company=company)
@@ -221,11 +222,11 @@ Purchase 12 products::
     >>> purchase_line.product = product_average
     >>> purchase_line.quantity = 7.0
     >>> purchase_line.unit_price = Decimal(6)
-    >>> purchase.save()
-    >>> Purchase.quote([purchase.id], config.context)
-    >>> Purchase.confirm([purchase.id], config.context)
+    >>> purchase.click('quote')
+    >>> purchase.click('confirm')
+    >>> purchase.click('process')
     >>> purchase.state
-    u'confirmed'
+    u'processing'
 
 Receive 9 products::
 
@@ -379,11 +380,11 @@ Now create a supplier invoice with an accountant::
     >>> purchase_line.product = product
     >>> purchase_line.quantity = 5.0
     >>> purchase_line.unit_price = Decimal(4)
-    >>> purchase.save()
-    >>> Purchase.quote([purchase.id], config.context)
-    >>> Purchase.confirm([purchase.id], config.context)
+    >>> purchase.click('quote')
+    >>> purchase.click('confirm')
+    >>> purchase.click('process')
     >>> purchase.state
-    u'confirmed'
+    u'processing'
 
     >>> invoice_ids = [i.id for i in purchase.invoices]
     >>> config.user = accountant.id
diff --git a/tests/scenario_account_stock_anglo_saxon_with_drop_shipment.rst b/tests/scenario_account_stock_anglo_saxon_with_drop_shipment.rst
index 85e037d..88f2f51 100644
--- a/tests/scenario_account_stock_anglo_saxon_with_drop_shipment.rst
+++ b/tests/scenario_account_stock_anglo_saxon_with_drop_shipment.rst
@@ -17,6 +17,7 @@ Imports::
 Create database::
 
     >>> config = config.set_trytond()
+    >>> config.pool.test = True
 
 Install sale_supply, sale, purchase::
 
@@ -112,6 +113,7 @@ Create fiscal year::
     >>> fiscalyear.start_date = today + relativedelta(month=1, day=1)
     >>> fiscalyear.end_date = today + relativedelta(month=12, day=31)
     >>> fiscalyear.company = company
+    >>> fiscalyear.account_stock_method = 'anglo_saxon'
     >>> post_move_sequence = Sequence(name='%s' % today.year,
     ...     code='account.move',
     ...     company=company)
@@ -255,17 +257,15 @@ Create Purchase from Request::
     >>> purchase_request, = PurchaseRequest.find()
     >>> create_purchase = Wizard('purchase.request.create_purchase',
     ...     [purchase_request])
-    >>> create_purchase.form.payment_term = payment_term
-    >>> create_purchase.execute('start')
     >>> purchase, = Purchase.find()
+    >>> purchase.payment_term = payment_term
     >>> purchase_line, = purchase.lines
     >>> purchase_line.unit_price = Decimal('3')
-    >>> purchase.save()
-    >>> Purchase.quote([purchase.id], config.context)
-    >>> Purchase.confirm([purchase.id], config.context)
-    >>> purchase.reload()
+    >>> purchase.click('quote')
+    >>> purchase.click('confirm')
+    >>> purchase.click('process')
     >>> purchase.state
-    u'confirmed'
+    u'processing'
     >>> config.user = sale_user.id
     >>> sale.reload()
     >>> sale.shipments
diff --git a/tests/test_account_stock_anglo_saxon.py b/tests/test_account_stock_anglo_saxon.py
index e0b5b9f..d60af29 100644
--- a/tests/test_account_stock_anglo_saxon.py
+++ b/tests/test_account_stock_anglo_saxon.py
@@ -2,8 +2,15 @@
 #this repository contains the full copyright notices and license terms.
 import unittest
 import doctest
+
+from mock import Mock, patch
+
 import trytond.tests.test_tryton
-from trytond.tests.test_tryton import test_view, test_depends, doctest_dropdb
+from trytond.tests.test_tryton import test_view, test_depends
+from trytond.tests.test_tryton import DB_NAME, USER, CONTEXT
+from trytond.tests.test_tryton import doctest_setup, doctest_teardown
+from trytond.pool import Pool
+from trytond.transaction import Transaction
 
 
 class AccountStockAngloSaxonTestCase(unittest.TestCase):
@@ -20,6 +27,39 @@ class AccountStockAngloSaxonTestCase(unittest.TestCase):
         'Test depends'
         test_depends()
 
+    def test_get_anglo_saxon_move(self):
+        'Test _get_anglo_saxon_move'
+        with Transaction().start(DB_NAME, USER, context=CONTEXT):
+            pool = Pool()
+            Move = pool.get('stock.move')
+            Uom = pool.get('product.uom')
+            Currency = pool.get('currency.currency')
+
+            def move(quantity, price):
+                move = Mock()
+                move.quantity = quantity
+                move.unit_price = price
+                move.cost_price = price
+                move.in_anglo_saxon_quantity = 0
+                move.out_anglo_saxon_quantity = 0
+                return move
+
+            with patch.object(Uom, 'compute_qty') as compute_qty, \
+                    patch.object(Currency, 'compute') as compute:
+                compute_qty.side_effect = lambda *args, **kwargs: args[1]
+                compute.side_effect = lambda *args, **kwargs: args[1]
+
+                moves = [move(1, 3), move(2, 2)]
+                result = list(Move._get_anglo_saxon_move(
+                        moves, 1, 'in_supplier'))
+                self.assertEqual(result, [(moves[0], 1, 3)])
+
+                moves = [move(1, 3), move(2, 2)]
+                result = list(Move._get_anglo_saxon_move(
+                        moves, 2, 'in_supplier'))
+                self.assertEqual(result,
+                    [(moves[0], 1, 3), (moves[1], 1, 2)])
+
 
 def suite():
     suite = trytond.tests.test_tryton.suite()
@@ -27,10 +67,10 @@ def suite():
         AccountStockAngloSaxonTestCase))
     suite.addTests(doctest.DocFileSuite(
             'scenario_account_stock_anglo_saxon.rst',
-            setUp=doctest_dropdb, tearDown=doctest_dropdb, encoding='utf-8',
+            setUp=doctest_setup, tearDown=doctest_teardown, encoding='utf-8',
             optionflags=doctest.REPORT_ONLY_FIRST_FAILURE))
     suite.addTests(doctest.DocFileSuite(
             'scenario_account_stock_anglo_saxon_with_drop_shipment.rst',
-            setUp=doctest_dropdb, tearDown=doctest_dropdb, encoding='utf-8',
+            setUp=doctest_setup, tearDown=doctest_teardown, encoding='utf-8',
             optionflags=doctest.REPORT_ONLY_FIRST_FAILURE))
     return suite
diff --git a/tryton.cfg b/tryton.cfg
index cead7ca..51eae90 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
 [tryton]
-version=3.2.0
+version=3.4.0
 depends:
     account
     account_invoice
diff --git a/trytond_account_stock_anglo_saxon.egg-info/PKG-INFO b/trytond_account_stock_anglo_saxon.egg-info/PKG-INFO
index 01d31a6..32ba295 100644
--- a/trytond_account_stock_anglo_saxon.egg-info/PKG-INFO
+++ b/trytond_account_stock_anglo_saxon.egg-info/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: trytond-account-stock-anglo-saxon
-Version: 3.2.0
+Version: 3.4.0
 Summary: Tryton module for anglo-saxon real-time stock valuation
 Home-page: http://www.tryton.org/
 Author: Tryton
 Author-email: issue_tracker at tryton.org
 License: GPL-3
-Download-URL: http://downloads.tryton.org/3.2/
+Download-URL: http://downloads.tryton.org/3.4/
 Description: trytond_account_stock_anglo_saxon
         =================================
         
diff --git a/trytond_account_stock_anglo_saxon.egg-info/SOURCES.txt b/trytond_account_stock_anglo_saxon.egg-info/SOURCES.txt
index f0935a2..a448e81 100644
--- a/trytond_account_stock_anglo_saxon.egg-info/SOURCES.txt
+++ b/trytond_account_stock_anglo_saxon.egg-info/SOURCES.txt
@@ -9,11 +9,31 @@ product.xml
 setup.py
 tryton.cfg
 ./__init__.py
+./account.py
+./account.xml
 ./invoice.py
 ./product.py
+./product.xml
 ./stock.py
+./tryton.cfg
+./locale/bg_BG.po
+./locale/ca_ES.po
+./locale/cs_CZ.po
+./locale/de_DE.po
+./locale/es_AR.po
+./locale/es_CO.po
+./locale/es_EC.po
+./locale/es_ES.po
+./locale/fr_FR.po
+./locale/nl_NL.po
+./locale/ru_RU.po
+./locale/sl_SI.po
 ./tests/__init__.py
+./tests/scenario_account_stock_anglo_saxon.rst
+./tests/scenario_account_stock_anglo_saxon_with_drop_shipment.rst
 ./tests/test_account_stock_anglo_saxon.py
+./view/category_form.xml
+./view/template_form.xml
 doc/index.rst
 locale/bg_BG.po
 locale/ca_ES.po
@@ -21,6 +41,7 @@ locale/cs_CZ.po
 locale/de_DE.po
 locale/es_AR.po
 locale/es_CO.po
+locale/es_EC.po
 locale/es_ES.po
 locale/fr_FR.po
 locale/nl_NL.po
diff --git a/trytond_account_stock_anglo_saxon.egg-info/requires.txt b/trytond_account_stock_anglo_saxon.egg-info/requires.txt
index 746b146..e7cb920 100644
--- a/trytond_account_stock_anglo_saxon.egg-info/requires.txt
+++ b/trytond_account_stock_anglo_saxon.egg-info/requires.txt
@@ -1,7 +1,7 @@
-trytond_account >= 3.2, < 3.3
-trytond_account_invoice >= 3.2, < 3.3
-trytond_account_product >= 3.2, < 3.3
-trytond_account_stock_continental >= 3.2, < 3.3
-trytond_purchase >= 3.2, < 3.3
-trytond_sale >= 3.2, < 3.3
-trytond >= 3.2, < 3.3
\ No newline at end of file
+trytond_account >= 3.4, < 3.5
+trytond_account_invoice >= 3.4, < 3.5
+trytond_account_product >= 3.4, < 3.5
+trytond_account_stock_continental >= 3.4, < 3.5
+trytond_purchase >= 3.4, < 3.5
+trytond_sale >= 3.4, < 3.5
+trytond >= 3.4, < 3.5
\ No newline at end of file
-- 
tryton-modules-account-stock-anglo-saxon



More information about the tryton-debian-vcs mailing list