[tryton-debian-vcs] tryton-modules-account-stock-anglo-saxon branch debian updated. debian/4.4.0-4-5-g360bde1

Mathias Behrle tryton-debian-vcs at alioth.debian.org
Fri Nov 10 12:07:57 UTC 2017


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/4.4.0-4-5-g360bde1

commit 360bde1217f9b5a1f24fdefe423f3d11cf3cd928
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Tue Nov 7 16:24:39 2017 +0100

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

diff --git a/debian/changelog b/debian/changelog
index a842aca..1a1c309 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+tryton-modules-account-stock-anglo-saxon (4.6.0-1) unstable; urgency=medium
+
+  * Bump the Standards-Version to 4.1.0, no changes needed.
+  * Bump the Standards-Version to 4.1.1, no changes needed.
+  * Merging upstream version 4.6.0.
+  * Use https in the watch file.
+
+ -- Mathias Behrle <mathiasb at m9s.biz>  Tue, 07 Nov 2017 10:19:55 +0100
+
 tryton-modules-account-stock-anglo-saxon (4.4.0-4) unstable; urgency=medium
 
   * Switch to Python3.
commit 996d4ec8d8469257dcf5759c60edb238c8cff2d3
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Tue Nov 7 10:16:46 2017 +0100

    Use https in the watch file.

diff --git a/debian/watch b/debian/watch
index 57d634c..88ec952 100644
--- a/debian/watch
+++ b/debian/watch
@@ -1,2 +1,2 @@
 version=3
-opts=pgpsigurlmangle=s/$/.asc/ http://downloads.tryton.org/current/ .*trytond_account_stock_anglo_saxon-(\d.*)\.(?:tgz|tbz2|txz|tar\.(?:gz|bz2|xz))
+opts=pgpsigurlmangle=s/$/.asc/ https://downloads.tryton.org/current/ .*trytond_account_stock_anglo_saxon-(\d.*)\.(?:tgz|tbz2|txz|tar\.(?:gz|bz2|xz))
commit 42c7dbf10497de5d8bb5a31883a56cb288844896
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Mon Nov 6 14:40:32 2017 +0100

    Merging upstream version 4.6.0.

diff --git a/.drone.yml b/.drone.yml
new file mode 100644
index 0000000..e0bc2f7
--- /dev/null
+++ b/.drone.yml
@@ -0,0 +1,51 @@
+clone:
+    hg:
+        image: plugins/hg
+
+pipeline:
+    tox:
+        image: ${IMAGE}
+        environment:
+            - CFLAGS=-O0
+            - DB_CACHE=/cache
+            - TOX_TESTENV_PASSENV=CFLAGS DB_CACHE
+            - POSTGRESQL_URI=postgresql://postgres@postgresql:5432/
+        commands:
+            - pip install tox
+            - tox -e "${TOXENV}-${DATABASE}"
+        volumes:
+            - cache:/root/.cache
+
+services:
+    postgresql:
+        image: postgres
+        when:
+            matrix:
+                DATABASE: postgresql
+
+matrix:
+    include:
+        - IMAGE: python:2.7
+          TOXENV: py27
+          DATABASE: sqlite
+        - IMAGE: python:2.7
+          TOXENV: py27
+          DATABASE: postgresql
+        - IMAGE: python:3.4
+          TOXENV: py34
+          DATABASE: sqlite
+        - IMAGE: python:3.4
+          TOXENV: py34
+          DATABASE: postgresql
+        - IMAGE: python:3.5
+          TOXENV: py35
+          DATABASE: sqlite
+        - IMAGE: python:3.5
+          TOXENV: py35
+          DATABASE: postgresql
+        - IMAGE: python:3.6
+          TOXENV: py36
+          DATABASE: sqlite
+        - IMAGE: python:3.6
+          TOXENV: py36
+          DATABASE: postgresql
diff --git a/CHANGELOG b/CHANGELOG
index b75483f..7d739e8 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,7 @@
+Version 4.6.0 - 2017-10-30
+* Bug fixes (see mercurial logs for details)
+* Add warning about different product between invoice line and stock move
+
 Version 4.4.0 - 2017-05-01
 * Bug fixes (see mercurial logs for details)
 * Use stock_moves from account_invoice_stock
diff --git a/PKG-INFO b/PKG-INFO
index 54d129b..6c724ef 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: trytond_account_stock_anglo_saxon
-Version: 4.4.0
+Version: 4.6.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/4.4/
+Download-URL: http://downloads.tryton.org/4.6/
 Description: trytond_account_stock_anglo_saxon
         =================================
         
@@ -69,9 +69,9 @@ Classifier: Natural Language :: Slovenian
 Classifier: Natural Language :: Spanish
 Classifier: Operating System :: OS Independent
 Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3.3
 Classifier: Programming Language :: Python :: 3.4
 Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Topic :: Office/Business
diff --git a/invoice.py b/invoice.py
index 8ae9e30..696d203 100644
--- a/invoice.py
+++ b/invoice.py
@@ -11,6 +11,16 @@ class InvoiceLine:
     __metaclass__ = PoolMeta
     __name__ = 'account.invoice.line'
 
+    @classmethod
+    def __setup__(cls):
+        super(InvoiceLine, cls).__setup__()
+        cls._error_messages.update({
+                'stock_move_different_product': (
+                    "The invoice line '%(line)s' is linked to stock moves "
+                    "for other products than '%(product)s'.\n"
+                    "This may compute a wrong COGS."),
+                })
+
     def _get_anglo_saxon_move_lines(self, amount, type_):
         '''
         Return account move for anglo-saxon stock accounting
@@ -73,7 +83,21 @@ class InvoiceLine:
             return result
 
         # an empty list means we'll use the current cost price
-        moves = [move for move in self.stock_moves if move.state == 'done']
+        moves = []
+        for move in self.stock_moves:
+            if move.state != 'done':
+                continue
+            # remove move for different product
+            if move.product != self.product:
+                warning_name = '%s.stock.different_product' % self
+                self.raise_user_warning(
+                    warning_name, 'stock_move_different_product', {
+                        'line': self.rec_name,
+                        'product': self.product.rec_name,
+                        })
+            else:
+                moves.append(move)
+
         if self.invoice.type == 'in':
             type_ = 'in_supplier'
         elif self.invoice.type == 'out':
diff --git a/locale/bg.po b/locale/bg.po
index 6f98468..a5b321c 100644
--- a/locale/bg.po
+++ b/locale/bg.po
@@ -1,7 +1,13 @@
-# 
+#
 msgid ""
 msgstr "Content-Type: text/plain; charset=utf-8\n"
 
+msgctxt "error:account.invoice.line:"
+msgid ""
+"The invoice line '%(line)s' is linked to stock moves for other products than '%(product)s'.\n"
+"This may compute a wrong COGS."
+msgstr ""
+
 msgctxt "error:stock.move:"
 msgid "Anglo-Saxon quantity can not be greater than quantity."
 msgstr ""
@@ -10,10 +16,6 @@ msgctxt "field:product.category,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
 
-msgctxt "field:product.category,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr ""
-
 msgctxt "field:product.category.account,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
@@ -22,18 +24,10 @@ msgctxt "field:product.product,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
 
-msgctxt "field:product.product,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr ""
-
 msgctxt "field:product.template,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
 
-msgctxt "field:product.template,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr ""
-
 msgctxt "field:product.template.account,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
diff --git a/locale/ca.po b/locale/ca.po
index cd750a6..9b01207 100644
--- a/locale/ca.po
+++ b/locale/ca.po
@@ -1,7 +1,15 @@
-# 
+#
 msgid ""
 msgstr "Content-Type: text/plain; charset=utf-8\n"
 
+msgctxt "error:account.invoice.line:"
+msgid ""
+"The invoice line '%(line)s' is linked to stock moves for other products than '%(product)s'.\n"
+"This may compute a wrong COGS."
+msgstr ""
+"La línia de factura '%(line)s' està vinculada amb moviments d'existències de productes diferents de '%(product)s'.\n"
+"Això pot comportar un càlcul erroni del COGS."
+
 msgctxt "error:stock.move:"
 msgid "Anglo-Saxon quantity can not be greater than quantity."
 msgstr "La quantitat anglo-saxona no pot ser major que la quantitat."
@@ -10,10 +18,6 @@ msgctxt "field:product.category,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr "Compte cost béns venuts"
 
-msgctxt "field:product.category,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr "Compte cost béns venuts usada"
-
 msgctxt "field:product.category.account,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr "Compte cost béns venuts"
@@ -22,18 +26,10 @@ msgctxt "field:product.product,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr "Compte cost de béns venuts"
 
-msgctxt "field:product.product,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr "Compte cost de béns venuts usada"
-
 msgctxt "field:product.template,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr "Compte cost béns venuts"
 
-msgctxt "field:product.template,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr "Compte cost béns venuts usada"
-
 msgctxt "field:product.template.account,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr "Compte cost béns venuts"
diff --git a/locale/cs.po b/locale/cs.po
index 797d045..98f31c8 100644
--- a/locale/cs.po
+++ b/locale/cs.po
@@ -1,7 +1,13 @@
-# 
+#
 msgid ""
 msgstr "Content-Type: text/plain; charset=utf-8\n"
 
+msgctxt "error:account.invoice.line:"
+msgid ""
+"The invoice line '%(line)s' is linked to stock moves for other products than '%(product)s'.\n"
+"This may compute a wrong COGS."
+msgstr ""
+
 msgctxt "error:stock.move:"
 msgid "Anglo-Saxon quantity can not be greater than quantity."
 msgstr ""
@@ -10,10 +16,6 @@ msgctxt "field:product.category,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
 
-msgctxt "field:product.category,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr ""
-
 msgctxt "field:product.category.account,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
@@ -22,18 +24,10 @@ msgctxt "field:product.product,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
 
-msgctxt "field:product.product,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr ""
-
 msgctxt "field:product.template,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
 
-msgctxt "field:product.template,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr ""
-
 msgctxt "field:product.template.account,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
diff --git a/locale/de.po b/locale/de.po
index db5e519..e4f1abc 100644
--- a/locale/de.po
+++ b/locale/de.po
@@ -1,7 +1,13 @@
-# 
+#
 msgid ""
 msgstr "Content-Type: text/plain; charset=utf-8\n"
 
+msgctxt "error:account.invoice.line:"
+msgid ""
+"The invoice line '%(line)s' is linked to stock moves for other products than '%(product)s'.\n"
+"This may compute a wrong COGS."
+msgstr ""
+
 msgctxt "error:stock.move:"
 msgid "Anglo-Saxon quantity can not be greater than quantity."
 msgstr "Anzahl (Angelsächsische Bewertung) kann nicht größer als Anzahl sein."
@@ -10,10 +16,6 @@ msgctxt "field:product.category,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr "Konto Kosten der verkauften Waren"
 
-msgctxt "field:product.category,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr "Verwendetes Konto Kosten verkaufte Waren"
-
 msgctxt "field:product.category.account,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr "Konto Kosten der verkauften Waren"
@@ -22,18 +24,10 @@ msgctxt "field:product.product,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr "Konto Kosten der verkauften Waren"
 
-msgctxt "field:product.product,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr "Verwendetes Konto Kosten verkaufte Waren"
-
 msgctxt "field:product.template,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr "Konto Kosten der verkauften Waren"
 
-msgctxt "field:product.template,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr "Verwendetes Konto Kosten verkaufte Waren"
-
 msgctxt "field:product.template.account,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr "Konto Kosten der verkauften Waren"
diff --git a/locale/es.po b/locale/es.po
index bc62804..8fbe679 100644
--- a/locale/es.po
+++ b/locale/es.po
@@ -1,7 +1,15 @@
-# 
+#
 msgid ""
 msgstr "Content-Type: text/plain; charset=utf-8\n"
 
+msgctxt "error:account.invoice.line:"
+msgid ""
+"The invoice line '%(line)s' is linked to stock moves for other products than '%(product)s'.\n"
+"This may compute a wrong COGS."
+msgstr ""
+"La linea de factura '%(line)s' esta vinculada con movimientos de existencias de productos diferentes de '%(product)s'. \n"
+"Esto puede probar un cálculo del COGS erróneo."
+
 msgctxt "error:stock.move:"
 msgid "Anglo-Saxon quantity can not be greater than quantity."
 msgstr "La cantidad anglosajona no puede ser mayor que la cantidad."
@@ -10,10 +18,6 @@ msgctxt "field:product.category,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr "Cuenta coste de bienes vendidos"
 
-msgctxt "field:product.category,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr "Cuenta coste de bienes vendidos usada"
-
 msgctxt "field:product.category.account,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr "Cuenta coste de bienes vendidos"
@@ -22,18 +26,10 @@ msgctxt "field:product.product,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr "Cuenta coste de bienes vendidos"
 
-msgctxt "field:product.product,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr "Cuenta coste de bienes vendidos usada"
-
 msgctxt "field:product.template,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr "Cuenta coste de bienes vendidos"
 
-msgctxt "field:product.template,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr "Cuenta coste de bienes vendidos usada"
-
 msgctxt "field:product.template.account,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr "Cuenta coste de bienes vendidos"
diff --git a/locale/es_419.po b/locale/es_419.po
index 6297aad..207c16f 100644
--- a/locale/es_419.po
+++ b/locale/es_419.po
@@ -1,7 +1,13 @@
-# 
+#
 msgid ""
 msgstr "Content-Type: text/plain; charset=utf-8\n"
 
+msgctxt "error:account.invoice.line:"
+msgid ""
+"The invoice line '%(line)s' is linked to stock moves for other products than '%(product)s'.\n"
+"This may compute a wrong COGS."
+msgstr ""
+
 msgctxt "error:stock.move:"
 msgid "Anglo-Saxon quantity can not be greater than quantity."
 msgstr ""
@@ -10,10 +16,6 @@ msgctxt "field:product.category,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr "Cuenta de costo de mercancías vendidas"
 
-msgctxt "field:product.category,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr "Cuenta de costo de mercancías vendidas utilizada"
-
 msgctxt "field:product.category.account,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr "Cuenta de costo de mercancías vendidas"
@@ -22,18 +24,10 @@ msgctxt "field:product.product,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr "Cuenta de costo de mercancías vendidas"
 
-msgctxt "field:product.product,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr "Cuenta de costo de mercancías vendidas utilizada"
-
 msgctxt "field:product.template,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr "Cuenta de costo de mercancías vendidas"
 
-msgctxt "field:product.template,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr "Cuenta de costo de mercancías vendidas utilizada"
-
 msgctxt "field:product.template.account,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr "Cuenta de costo de mercancías vendidas"
diff --git a/locale/fr.po b/locale/fr.po
index 7358767..6319b73 100644
--- a/locale/fr.po
+++ b/locale/fr.po
@@ -1,7 +1,15 @@
-# 
+#
 msgid ""
 msgstr "Content-Type: text/plain; charset=utf-8\n"
 
+msgctxt "error:account.invoice.line:"
+msgid ""
+"The invoice line '%(line)s' is linked to stock moves for other products than '%(product)s'.\n"
+"This may compute a wrong COGS."
+msgstr ""
+"La ligne de facture « %(line)s » est liée à des mouvements de stock pour d'autres produits que « %(product)s ».\n"
+"Ça pourrait calculer un coût des marchandises vendues faux."
+
 msgctxt "error:stock.move:"
 msgid "Anglo-Saxon quantity can not be greater than quantity."
 msgstr "La quantité anglo-saxonne ne peut être plus grande que la quantité."
@@ -10,10 +18,6 @@ msgctxt "field:product.category,account_cogs:"
 msgid "Account Cost of Goods Sold"
 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é"
-
 msgctxt "field:product.category.account,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr "Compte « coût des marchandises vendues »"
@@ -22,18 +26,10 @@ msgctxt "field:product.product,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr "Compte « coût des marchandises vendues »"
 
-msgctxt "field:product.product,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-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 »"
 
-msgctxt "field:product.template,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr "Compte « coût des marchandises vendues » utilisé"
-
 msgctxt "field:product.template.account,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr "Compte « coût des marchandises vendues »"
diff --git a/locale/hu_HU.po b/locale/hu_HU.po
index 797d045..98f31c8 100644
--- a/locale/hu_HU.po
+++ b/locale/hu_HU.po
@@ -1,7 +1,13 @@
-# 
+#
 msgid ""
 msgstr "Content-Type: text/plain; charset=utf-8\n"
 
+msgctxt "error:account.invoice.line:"
+msgid ""
+"The invoice line '%(line)s' is linked to stock moves for other products than '%(product)s'.\n"
+"This may compute a wrong COGS."
+msgstr ""
+
 msgctxt "error:stock.move:"
 msgid "Anglo-Saxon quantity can not be greater than quantity."
 msgstr ""
@@ -10,10 +16,6 @@ msgctxt "field:product.category,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
 
-msgctxt "field:product.category,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr ""
-
 msgctxt "field:product.category.account,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
@@ -22,18 +24,10 @@ msgctxt "field:product.product,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
 
-msgctxt "field:product.product,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr ""
-
 msgctxt "field:product.template,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
 
-msgctxt "field:product.template,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr ""
-
 msgctxt "field:product.template.account,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
diff --git a/locale/it_IT.po b/locale/it_IT.po
index 5028ced..43f91c9 100644
--- a/locale/it_IT.po
+++ b/locale/it_IT.po
@@ -1,7 +1,13 @@
-# 
+#
 msgid ""
 msgstr "Content-Type: text/plain; charset=utf-8\n"
 
+msgctxt "error:account.invoice.line:"
+msgid ""
+"The invoice line '%(line)s' is linked to stock moves for other products than '%(product)s'.\n"
+"This may compute a wrong COGS."
+msgstr ""
+
 msgctxt "error:stock.move:"
 msgid "Anglo-Saxon quantity can not be greater than quantity."
 msgstr "La quantità anglo-sassone non può essere maggiore della quantità."
@@ -10,10 +16,6 @@ msgctxt "field:product.category,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr "Conto costo del venduto"
 
-msgctxt "field:product.category,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr "Conto costo del venduto usato"
-
 #, fuzzy
 msgctxt "field:product.category.account,account_cogs:"
 msgid "Account Cost of Goods Sold"
@@ -23,18 +25,10 @@ msgctxt "field:product.product,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr "Conto costo del venduto"
 
-msgctxt "field:product.product,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr "Conto costo del venduto usato"
-
 msgctxt "field:product.template,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr "Conto costo del venduto"
 
-msgctxt "field:product.template,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr "Conto costo del venduto Usato"
-
 #, fuzzy
 msgctxt "field:product.template.account,account_cogs:"
 msgid "Account Cost of Goods Sold"
diff --git a/locale/ja_JP.po b/locale/ja_JP.po
index 797d045..98f31c8 100644
--- a/locale/ja_JP.po
+++ b/locale/ja_JP.po
@@ -1,7 +1,13 @@
-# 
+#
 msgid ""
 msgstr "Content-Type: text/plain; charset=utf-8\n"
 
+msgctxt "error:account.invoice.line:"
+msgid ""
+"The invoice line '%(line)s' is linked to stock moves for other products than '%(product)s'.\n"
+"This may compute a wrong COGS."
+msgstr ""
+
 msgctxt "error:stock.move:"
 msgid "Anglo-Saxon quantity can not be greater than quantity."
 msgstr ""
@@ -10,10 +16,6 @@ msgctxt "field:product.category,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
 
-msgctxt "field:product.category,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr ""
-
 msgctxt "field:product.category.account,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
@@ -22,18 +24,10 @@ msgctxt "field:product.product,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
 
-msgctxt "field:product.product,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr ""
-
 msgctxt "field:product.template,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
 
-msgctxt "field:product.template,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr ""
-
 msgctxt "field:product.template.account,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
diff --git a/locale/lo.po b/locale/lo.po
index 33ba4f5..f7db53e 100644
--- a/locale/lo.po
+++ b/locale/lo.po
@@ -1,7 +1,13 @@
-# 
+#
 msgid ""
 msgstr "Content-Type: text/plain; charset=utf-8\n"
 
+msgctxt "error:account.invoice.line:"
+msgid ""
+"The invoice line '%(line)s' is linked to stock moves for other products than '%(product)s'.\n"
+"This may compute a wrong COGS."
+msgstr ""
+
 msgctxt "error:stock.move:"
 msgid "Anglo-Saxon quantity can not be greater than quantity."
 msgstr ""
@@ -10,10 +16,6 @@ msgctxt "field:product.category,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
 
-msgctxt "field:product.category,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr ""
-
 msgctxt "field:product.category.account,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
@@ -22,18 +24,10 @@ msgctxt "field:product.product,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
 
-msgctxt "field:product.product,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr ""
-
 msgctxt "field:product.template,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
 
-msgctxt "field:product.template,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr ""
-
 msgctxt "field:product.template.account,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
diff --git a/locale/lt.po b/locale/lt.po
index 797d045..98f31c8 100644
--- a/locale/lt.po
+++ b/locale/lt.po
@@ -1,7 +1,13 @@
-# 
+#
 msgid ""
 msgstr "Content-Type: text/plain; charset=utf-8\n"
 
+msgctxt "error:account.invoice.line:"
+msgid ""
+"The invoice line '%(line)s' is linked to stock moves for other products than '%(product)s'.\n"
+"This may compute a wrong COGS."
+msgstr ""
+
 msgctxt "error:stock.move:"
 msgid "Anglo-Saxon quantity can not be greater than quantity."
 msgstr ""
@@ -10,10 +16,6 @@ msgctxt "field:product.category,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
 
-msgctxt "field:product.category,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr ""
-
 msgctxt "field:product.category.account,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
@@ -22,18 +24,10 @@ msgctxt "field:product.product,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
 
-msgctxt "field:product.product,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr ""
-
 msgctxt "field:product.template,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
 
-msgctxt "field:product.template,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr ""
-
 msgctxt "field:product.template.account,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
diff --git a/locale/nl.po b/locale/nl.po
index 16a4724..2a4428b 100644
--- a/locale/nl.po
+++ b/locale/nl.po
@@ -1,7 +1,13 @@
-# 
+#
 msgid ""
 msgstr "Content-Type: text/plain; charset=utf-8\n"
 
+msgctxt "error:account.invoice.line:"
+msgid ""
+"The invoice line '%(line)s' is linked to stock moves for other products than '%(product)s'.\n"
+"This may compute a wrong COGS."
+msgstr ""
+
 msgctxt "error:stock.move:"
 msgid "Anglo-Saxon quantity can not be greater than quantity."
 msgstr ""
@@ -10,10 +16,6 @@ msgctxt "field:product.category,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
 
-msgctxt "field:product.category,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr ""
-
 msgctxt "field:product.category.account,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
@@ -22,18 +24,10 @@ msgctxt "field:product.product,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
 
-msgctxt "field:product.product,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr ""
-
 msgctxt "field:product.template,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
 
-msgctxt "field:product.template,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr ""
-
 msgctxt "field:product.template.account,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
diff --git a/locale/pl.po b/locale/pl.po
index 797d045..98f31c8 100644
--- a/locale/pl.po
+++ b/locale/pl.po
@@ -1,7 +1,13 @@
-# 
+#
 msgid ""
 msgstr "Content-Type: text/plain; charset=utf-8\n"
 
+msgctxt "error:account.invoice.line:"
+msgid ""
+"The invoice line '%(line)s' is linked to stock moves for other products than '%(product)s'.\n"
+"This may compute a wrong COGS."
+msgstr ""
+
 msgctxt "error:stock.move:"
 msgid "Anglo-Saxon quantity can not be greater than quantity."
 msgstr ""
@@ -10,10 +16,6 @@ msgctxt "field:product.category,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
 
-msgctxt "field:product.category,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr ""
-
 msgctxt "field:product.category.account,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
@@ -22,18 +24,10 @@ msgctxt "field:product.product,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
 
-msgctxt "field:product.product,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr ""
-
 msgctxt "field:product.template,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
 
-msgctxt "field:product.template,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr ""
-
 msgctxt "field:product.template.account,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
diff --git a/locale/pt_BR.po b/locale/pt_BR.po
index f04236c..7834f70 100644
--- a/locale/pt_BR.po
+++ b/locale/pt_BR.po
@@ -1,7 +1,15 @@
-# 
+#
 msgid ""
 msgstr "Content-Type: text/plain; charset=utf-8\n"
 
+msgctxt "error:account.invoice.line:"
+msgid ""
+"The invoice line '%(line)s' is linked to stock moves for other products than '%(product)s'.\n"
+"This may compute a wrong COGS."
+msgstr ""
+"A linha da fatura '%(line)s' está vinculada a movimentações de estoque de outros produtos que não '%(product)s'.\n"
+"Isso pode computar um COGS errado."
+
 msgctxt "error:stock.move:"
 msgid "Anglo-Saxon quantity can not be greater than quantity."
 msgstr "A quantidade anglo-saxã não pode ser maior do que a quantidade."
@@ -10,10 +18,6 @@ msgctxt "field:product.category,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr "Conta de Custo de Mercadorias Vendidas"
 
-msgctxt "field:product.category,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr "Conta de Custo de Mercadorias Vendidas Utilizada"
-
 msgctxt "field:product.category.account,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr "Conta de Custo de Mercadorias Vendidas"
@@ -22,18 +26,10 @@ msgctxt "field:product.product,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr "Conta de Custo de Mercadorias Vendidas"
 
-msgctxt "field:product.product,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr "Conta de Custo de Mercadorias Vendidas Utilizada"
-
 msgctxt "field:product.template,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr "Conta de Custo de Mercadorias Vendidas"
 
-msgctxt "field:product.template,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr "Conta de Custo de Mercadorias Vendidas Utilizada"
-
 msgctxt "field:product.template.account,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr "Conta de Custo de Mercadorias Vendidas"
diff --git a/locale/ru.po b/locale/ru.po
index e617447..51f1a01 100644
--- a/locale/ru.po
+++ b/locale/ru.po
@@ -1,7 +1,13 @@
-# 
+#
 msgid ""
 msgstr "Content-Type: text/plain; charset=utf-8\n"
 
+msgctxt "error:account.invoice.line:"
+msgid ""
+"The invoice line '%(line)s' is linked to stock moves for other products than '%(product)s'.\n"
+"This may compute a wrong COGS."
+msgstr ""
+
 msgctxt "error:stock.move:"
 msgid "Anglo-Saxon quantity can not be greater than quantity."
 msgstr ""
@@ -10,10 +16,6 @@ msgctxt "field:product.category,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
 
-msgctxt "field:product.category,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr ""
-
 msgctxt "field:product.category.account,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
@@ -22,18 +24,10 @@ msgctxt "field:product.product,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
 
-msgctxt "field:product.product,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr ""
-
 msgctxt "field:product.template,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
 
-msgctxt "field:product.template,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr ""
-
 msgctxt "field:product.template.account,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
diff --git a/locale/sl.po b/locale/sl.po
index 2f03b99..800595c 100644
--- a/locale/sl.po
+++ b/locale/sl.po
@@ -1,7 +1,13 @@
-# 
+#
 msgid ""
 msgstr "Content-Type: text/plain; charset=utf-8\n"
 
+msgctxt "error:account.invoice.line:"
+msgid ""
+"The invoice line '%(line)s' is linked to stock moves for other products than '%(product)s'.\n"
+"This may compute a wrong COGS."
+msgstr ""
+
 msgctxt "error:stock.move:"
 msgid "Anglo-Saxon quantity can not be greater than quantity."
 msgstr "Anglosaška količina ne more biti večja od same količine."
@@ -10,10 +16,6 @@ msgctxt "field:product.category,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr "Konto stroškov prodanega blaga"
 
-msgctxt "field:product.category,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr "Uporabljen konto stroškov prodanega blaga"
-
 msgctxt "field:product.category.account,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr "Konto stroškov prodanega blaga"
@@ -22,18 +24,10 @@ msgctxt "field:product.product,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr "Konto stroškov prodanega blaga"
 
-msgctxt "field:product.product,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr "Uporabljen konto stroškov prodanega blaga"
-
 msgctxt "field:product.template,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr "Konto stroškov prodanega blaga"
 
-msgctxt "field:product.template,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr "Uporabljen konto stroškov prodanega blaga"
-
 msgctxt "field:product.template.account,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr "Konto stroškov prodanega blaga"
diff --git a/locale/zh_CN.po b/locale/zh_CN.po
index 797d045..98f31c8 100644
--- a/locale/zh_CN.po
+++ b/locale/zh_CN.po
@@ -1,7 +1,13 @@
-# 
+#
 msgid ""
 msgstr "Content-Type: text/plain; charset=utf-8\n"
 
+msgctxt "error:account.invoice.line:"
+msgid ""
+"The invoice line '%(line)s' is linked to stock moves for other products than '%(product)s'.\n"
+"This may compute a wrong COGS."
+msgstr ""
+
 msgctxt "error:stock.move:"
 msgid "Anglo-Saxon quantity can not be greater than quantity."
 msgstr ""
@@ -10,10 +16,6 @@ msgctxt "field:product.category,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
 
-msgctxt "field:product.category,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr ""
-
 msgctxt "field:product.category.account,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
@@ -22,18 +24,10 @@ msgctxt "field:product.product,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
 
-msgctxt "field:product.product,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr ""
-
 msgctxt "field:product.template,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
 
-msgctxt "field:product.template,account_cogs_used:"
-msgid "Account Cost of Goods Sold Used"
-msgstr ""
-
 msgctxt "field:product.template.account,account_cogs:"
 msgid "Account Cost of Goods Sold"
 msgstr ""
diff --git a/product.py b/product.py
index c47c03d..c597653 100644
--- a/product.py
+++ b/product.py
@@ -5,7 +5,8 @@ from trytond.model import fields
 from trytond.pyson import Eval
 from trytond.pool import PoolMeta, Pool
 
-from trytond.modules.account_product import MissingFunction
+from trytond.modules.account_product.product import (
+    account_used, template_property)
 
 __all__ = ['Category', 'CategoryAccount', 'Template', 'TemplateAccount',
     'Product']
@@ -25,9 +26,6 @@ class Category:
                     | ~Eval('accounting', False)),
                 },
             depends=['account_parent', 'accounting']))
-    account_cogs_used = MissingFunction(fields.Many2One('account.account',
-            'Account Cost of Goods Sold Used'), 'missing_account',
-        'get_account')
 
     @classmethod
     def multivalue_model(cls, field):
@@ -36,6 +34,11 @@ class Category:
             return pool.get('product.category.account')
         return super(Category, cls).multivalue_model(field)
 
+    @property
+    @account_used('account_cogs')
+    def account_cogs_used(self):
+        pass
+
 
 class CategoryAccount:
     __metaclass__ = PoolMeta
@@ -86,9 +89,6 @@ class Template:
             help='This account will be used instead of the one defined '
             'on the category.',
             depends=['account_category', 'type']))
-    account_cogs_used = MissingFunction(fields.Many2One('account.account',
-            'Account Cost of Goods Sold Used'), 'missing_account',
-        'get_account')
 
     @classmethod
     def multivalue_model(cls, field):
@@ -97,6 +97,11 @@ class Template:
             return pool.get('product.template.account')
         return super(Template, cls).multivalue_model(field)
 
+    @property
+    @account_used('account_cogs')
+    def account_cogs_used(self):
+        pass
+
 
 class TemplateAccount:
     __metaclass__ = PoolMeta
@@ -134,7 +139,4 @@ class TemplateAccount:
 class Product:
     __metaclass__ = PoolMeta
     __name__ = 'product.product'
-    # Avoid raise of UserError from MissingFunction
-    account_cogs_used = fields.Function(
-        fields.Many2One('account.account', 'Account Cost of Goods Sold Used'),
-        'get_template')
+    account_cogs_used = template_property('account_cogs_used')
diff --git a/setup.cfg b/setup.cfg
index 861a9f5..8bfd5a1 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,5 +1,4 @@
 [egg_info]
 tag_build = 
 tag_date = 0
-tag_svn_revision = 0
 
diff --git a/setup.py b/setup.py
index bb8e295..d872227 100644
--- a/setup.py
+++ b/setup.py
@@ -105,9 +105,9 @@ setup(name=name,
         'Natural Language :: Spanish',
         'Operating System :: OS Independent',
         'Programming Language :: Python :: 2.7',
-        'Programming Language :: Python :: 3.3',
         'Programming Language :: Python :: 3.4',
         'Programming Language :: Python :: 3.5',
+        'Programming Language :: Python :: 3.6',
         'Programming Language :: Python :: Implementation :: CPython',
         'Programming Language :: Python :: Implementation :: PyPy',
         'Topic :: Office/Business',
diff --git a/stock.py b/stock.py
index 7f883a8..07d6dab 100644
--- a/stock.py
+++ b/stock.py
@@ -152,8 +152,7 @@ class Move:
         pool = Pool()
         Uom = pool.get('product.uom')
 
-        for move in moves:
-            assert move.product == product, 'wrong product'
+        assert all(m.product == product for m in moves), 'wrong product'
         assert type_.startswith('in_') or type_.startswith('out_'), \
             'wrong type'
 
@@ -169,10 +168,15 @@ class Move:
 
             cost += move_cost_price * Decimal(str(move_qty))
 
-            move_qty = Uom.compute_qty(product.default_uom, move_qty, move.uom)
+            move_qty = Uom.compute_qty(
+                product.default_uom, move_qty, move.uom, round=False)
+
+            # Avoid float rounding issue but allow only rounding precision lost
+            new_qty = (getattr(move, as_qty_field) or 0.0) + move_qty
+            assert move.uom.round(new_qty) <= move.quantity
+            new_qty = min(new_qty, move.quantity)
             cls.write([move], {
-                    as_qty_field: (
-                        (getattr(move, as_qty_field) or 0.0) + move_qty),
+                    as_qty_field: new_qty,
                     })
 
         if consumed_qty < total_qty:
diff --git a/tests/scenario_account_stock_anglo_saxon.rst b/tests/scenario_account_stock_anglo_saxon.rst
index 93c22c3..22d1cf7 100644
--- a/tests/scenario_account_stock_anglo_saxon.rst
+++ b/tests/scenario_account_stock_anglo_saxon.rst
@@ -8,7 +8,7 @@ Imports::
     >>> from dateutil.relativedelta import relativedelta
     >>> from decimal import Decimal
     >>> from proteus import Model, Wizard
-    >>> from trytond.tests.tools import activate_modules
+    >>> from trytond.tests.tools import activate_modules, set_user
     >>> from trytond.modules.company.tests.tools import create_company, \
     ...     get_company
     >>> from trytond.modules.account.tests.tools import create_fiscalyear, \
@@ -105,8 +105,6 @@ Create product::
     >>> ProductUom = Model.get('product.uom')
     >>> unit, = ProductUom.find([('name', '=', 'Unit')])
     >>> ProductTemplate = Model.get('product.template')
-    >>> Product = Model.get('product.product')
-    >>> product = Product()
     >>> template = ProductTemplate()
     >>> template.name = 'product'
     >>> template.default_uom = unit
@@ -114,7 +112,6 @@ Create product::
     >>> template.purchasable = True
     >>> template.salable = True
     >>> template.list_price = Decimal('10')
-    >>> template.cost_price = Decimal('5')
     >>> template.cost_price_method = 'fixed'
     >>> template.lead_time = datetime.timedelta(0)
     >>> template.account_expense = expense
@@ -128,15 +125,12 @@ Create product::
     >>> template.account_journal_stock_supplier = stock_journal
     >>> template.account_journal_stock_customer = stock_journal
     >>> template.account_journal_stock_lost_found = stock_journal
+    >>> product, = template.products
+    >>> product.cost_price = Decimal('5')
     >>> template.save()
-    >>> product.template = template
-    >>> product.save()
-    >>> template_average, = ProductTemplate.duplicate([template])
-    >>> template_average.cost_price_method = 'average'
-    >>> template_average.save()
-    >>> product_average, = Product.duplicate([product], {
-    ...         'template': template_average.id,
-    ...         })
+    >>> product, = template.products
+    >>> template_average, = template.duplicate({'cost_price_method': 'average'})
+    >>> product_average, = template_average.products
 
 Create payment term::
 
@@ -316,7 +310,7 @@ Now create a supplier invoice with an accountant::
     >>> purchase.state
     u'processing'
 
-    >>> config.user = accountant.id
+    >>> set_user(accountant)
     >>> for invoice in purchase.invoices:
     ...     invoice.invoice_date = today
     >>> Invoice.save(purchase.invoices)
@@ -344,14 +338,13 @@ Create customer invoice with negative quantity::
 
 Now we will use a product with different unit of measure::
 
-    >>> config.user = product_user.id
+    >>> set_user(product_user)
     >>> UomCategory = Model.get('product.uom.category')
     >>> unit_category, = UomCategory.find([('name', '=', 'Units')])
     >>> unit_5 = ProductUom(name='5', symbol='5', category=unit_category,
     ...    factor=5, digits=0)
     >>> unit_5.save()
 
-    >>> product_by5 = Product()
     >>> template_by5 = ProductTemplate()
     >>> template_by5.name = 'product'
     >>> template_by5.default_uom = unit
@@ -361,7 +354,6 @@ Now we will use a product with different unit of measure::
     >>> template_by5.salable = True
     >>> template_by5.sale_uom = unit_5
     >>> template_by5.list_price = Decimal('10')
-    >>> template_by5.cost_price = Decimal('5')
     >>> template_by5.cost_price_method = 'fixed'
     >>> template_by5.lead_time = datetime.timedelta(0)
     >>> template_by5.account_expense = expense
@@ -375,11 +367,12 @@ Now we will use a product with different unit of measure::
     >>> template_by5.account_journal_stock_supplier = stock_journal
     >>> template_by5.account_journal_stock_customer = stock_journal
     >>> template_by5.account_journal_stock_lost_found = stock_journal
+    >>> product_by5, = template_by5.products
+    >>> product_by5.cost_price = Decimal('5')
     >>> template_by5.save()
-    >>> product_by5.template = template_by5
-    >>> product_by5.save()
+    >>> product_by5, = template_by5.products
 
-    >>> config.user = purchase_user.id
+    >>> set_user(purchase_user)
     >>> purchase = Purchase()
     >>> purchase.party = supplier
     >>> purchase.payment_term = payment_term
@@ -391,7 +384,7 @@ Now we will use a product with different unit of measure::
     >>> purchase.click('confirm')
     >>> purchase.click('process')
 
-    >>> config.user = stock_user.id
+    >>> set_user(stock_user)
     >>> shipment = ShipmentIn(supplier=supplier)
     >>> move = Move(purchase.moves[0].id)
     >>> move.in_anglo_saxon_quantity
@@ -400,7 +393,7 @@ Now we will use a product with different unit of measure::
     >>> shipment.click('receive')
     >>> shipment.click('done')
 
-    >>> config.user = accountant.id
+    >>> set_user(accountant)
     >>> purchase.reload()
     >>> invoice, = purchase.invoices
     >>> invoice.invoice_date = today
@@ -408,7 +401,7 @@ Now we will use a product with different unit of measure::
     >>> invoice.state
     u'posted'
 
-    >>> config.user = stock_user.id
+    >>> set_user(stock_user)
     >>> move = Move(purchase.moves[0].id)
     >>> move.in_anglo_saxon_quantity
     1.0
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 4c3149b..a938540 100644
--- a/tests/scenario_account_stock_anglo_saxon_with_drop_shipment.rst
+++ b/tests/scenario_account_stock_anglo_saxon_with_drop_shipment.rst
@@ -8,7 +8,7 @@ Imports::
     >>> from dateutil.relativedelta import relativedelta
     >>> from decimal import Decimal
     >>> from proteus import Model, Wizard
-    >>> from trytond.tests.tools import activate_modules
+    >>> from trytond.tests.tools import activate_modules, set_user
     >>> from trytond.modules.company.tests.tools import create_company, \
     ...     get_company
     >>> from trytond.modules.account.tests.tools import create_fiscalyear, \
@@ -120,8 +120,6 @@ Create product::
     >>> ProductSupplier = Model.get('purchase.product_supplier')
     >>> unit, = ProductUom.find([('name', '=', 'Unit')])
     >>> ProductTemplate = Model.get('product.template')
-    >>> Product = Model.get('product.product')
-    >>> product = Product()
     >>> template = ProductTemplate()
     >>> template.name = 'product'
     >>> template.default_uom = unit
@@ -129,7 +127,6 @@ Create product::
     >>> template.purchasable = True
     >>> template.salable = True
     >>> template.list_price = Decimal('10')
-    >>> template.cost_price = Decimal('5')
     >>> template.cost_price_method = 'fixed'
     >>> template.lead_time = datetime.timedelta(0)
     >>> template.account_expense = expense
@@ -144,9 +141,10 @@ Create product::
     >>> template.account_journal_stock_customer = stock_journal
     >>> template.account_journal_stock_lost_found = stock_journal
     >>> template.supply_on_sale = True
+    >>> product, = template.products
+    >>> product.cost_price = Decimal('5')
     >>> template.save()
-    >>> product.template = template
-    >>> product.save()
+    >>> product, = template.products
     >>> product_supplier = ProductSupplier()
     >>> product_supplier.product = template
     >>> product_supplier.party = supplier
@@ -161,7 +159,7 @@ Create payment term::
 
 Sale 50 products::
 
-    >>> config.user = sale_user.id
+    >>> set_user(sale_user)
     >>> Sale = Model.get('sale.sale')
     >>> sale = Sale()
     >>> sale.party = customer
@@ -177,7 +175,7 @@ Sale 50 products::
 
 Create Purchase from Request::
 
-    >>> config.user = purchase_user.id
+    >>> set_user(purchase_user)
     >>> Purchase = Model.get('purchase.purchase')
     >>> PurchaseRequest = Model.get('purchase.request')
     >>> purchase_request, = PurchaseRequest.find()
@@ -192,7 +190,7 @@ Create Purchase from Request::
     >>> purchase.click('process')
     >>> purchase.state
     u'processing'
-    >>> config.user = sale_user.id
+    >>> set_user(sale_user)
     >>> sale.reload()
     >>> sale.shipments
     []
@@ -200,7 +198,7 @@ Create Purchase from Request::
 
 Receive 50 products::
 
-    >>> config.user = stock_user.id
+    >>> set_user(stock_user)
     >>> shipment.click('ship')
     >>> shipment.click('done')
     >>> shipment.state
@@ -223,10 +221,10 @@ Receive 50 products::
 
 Open supplier invoice::
 
-    >>> config.user = purchase_user.id
+    >>> set_user(purchase_user)
     >>> purchase.reload()
     >>> invoice, = purchase.invoices
-    >>> config.user = account_user.id
+    >>> set_user(account_user)
     >>> invoice.invoice_date = today
     >>> invoice.click('post')
     >>> invoice.state
@@ -249,10 +247,10 @@ Open supplier invoice::
 
 Open customer invoice::
 
-    >>> config.user = sale_user.id
+    >>> set_user(sale_user)
     >>> sale.reload()
     >>> invoice, = sale.invoices
-    >>> config.user = account_user.id
+    >>> set_user(account_user)
     >>> invoice.click('post')
     >>> invoice.state
     u'posted'
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 0000000..527d859
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,18 @@
+[tox]
+envlist = {py27,py34,py35,py36}-{sqlite,postgresql,mysql},pypy-{sqlite,postgresql}
+
+[testenv]
+commands = {envpython} setup.py test
+deps =
+    {py27,py34,py35,py36}-postgresql: psycopg2 >= 2.5
+    pypy-postgresql: psycopg2cffi >= 2.5
+    mysql: MySQL-python
+    sqlite: sqlitebck
+setenv =
+    sqlite: TRYTOND_DATABASE_URI={env:SQLITE_URI:sqlite://}
+    postgresql: TRYTOND_DATABASE_URI={env:POSTGRESQL_URI:postgresql://}
+    mysql: TRYTOND_DATABASE_URI={env:MYSQL_URI:mysql://}
+    sqlite: DB_NAME={env:SQLITE_NAME::memory:}
+    postgresql: DB_NAME={env:POSTGRESQL_NAME:test}
+    mysql: DB_NAME={env:MYSQL_NAME:test}
+install_command = pip install --pre --find-links https://trydevpi.tryton.org/ {opts} {packages}
diff --git a/tryton.cfg b/tryton.cfg
index 62d56a4..752692e 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
 [tryton]
-version=4.4.0
+version=4.6.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 58bea51..5cb4b64 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: 4.4.0
+Version: 4.6.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/4.4/
+Download-URL: http://downloads.tryton.org/4.6/
 Description: trytond_account_stock_anglo_saxon
         =================================
         
@@ -69,9 +69,9 @@ Classifier: Natural Language :: Slovenian
 Classifier: Natural Language :: Spanish
 Classifier: Operating System :: OS Independent
 Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3.3
 Classifier: Programming Language :: Python :: 3.4
 Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Topic :: Office/Business
diff --git a/trytond_account_stock_anglo_saxon.egg-info/SOURCES.txt b/trytond_account_stock_anglo_saxon.egg-info/SOURCES.txt
index 9d2fe5e..eca6fde 100644
--- a/trytond_account_stock_anglo_saxon.egg-info/SOURCES.txt
+++ b/trytond_account_stock_anglo_saxon.egg-info/SOURCES.txt
@@ -1,9 +1,14 @@
+.drone.yml
+.hgtags
 CHANGELOG
 COPYRIGHT
 INSTALL
 LICENSE
 MANIFEST.in
 README
+__init__.py
+account.py
+invoice.py
 minimal_chart.xml
 minimal_chart_bg.xml
 minimal_chart_ca.xml
@@ -15,8 +20,11 @@ minimal_chart_nl.xml
 minimal_chart_pt.xml
 minimal_chart_ru.xml
 minimal_chart_sl.xml
+product.py
 product.xml
 setup.py
+stock.py
+tox.ini
 tryton.cfg
 ./__init__.py
 ./account.py
@@ -79,8 +87,11 @@ locale/pt_BR.po
 locale/ru.po
 locale/sl.po
 locale/zh_CN.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
+tests/tools.py
 trytond_account_stock_anglo_saxon.egg-info/PKG-INFO
 trytond_account_stock_anglo_saxon.egg-info/SOURCES.txt
 trytond_account_stock_anglo_saxon.egg-info/dependency_links.txt
diff --git a/trytond_account_stock_anglo_saxon.egg-info/requires.txt b/trytond_account_stock_anglo_saxon.egg-info/requires.txt
index 36f9c81..54dbe19 100644
--- a/trytond_account_stock_anglo_saxon.egg-info/requires.txt
+++ b/trytond_account_stock_anglo_saxon.egg-info/requires.txt
@@ -1,6 +1,6 @@
-trytond_account >= 4.4, < 4.5
-trytond_account_invoice >= 4.4, < 4.5
-trytond_account_invoice_stock >= 4.4, < 4.5
-trytond_account_product >= 4.4, < 4.5
-trytond_account_stock_continental >= 4.4, < 4.5
-trytond >= 4.4, < 4.5
+trytond_account >= 4.6, < 4.7
+trytond_account_invoice >= 4.6, < 4.7
+trytond_account_invoice_stock >= 4.6, < 4.7
+trytond_account_product >= 4.6, < 4.7
+trytond_account_stock_continental >= 4.6, < 4.7
+trytond >= 4.6, < 4.7
-- 
tryton-modules-account-stock-anglo-saxon



More information about the tryton-debian-vcs mailing list