changeset 14ab99515f10 in modules/account_stock_landed_cost:default
details: 
https://hg.tryton.org/modules/account_stock_landed_cost?cmd=changeset;node=14ab99515f10
description:
        Update unit price of stock moves based on posted invoice lines

        We update the unit price of the stock move when it is done and when a 
linked
        invoice is posted. This allow to keep an accurate cost price 
computation when
        price varies between the order and the invoice.

        issue7280
        review311431002
diffstat:

 stock.py   |  6 ++++++
 tryton.cfg |  2 ++
 2 files changed, 8 insertions(+), 0 deletions(-)

diffs (25 lines):

diff -r 04c559fe3196 -r 14ab99515f10 stock.py
--- a/stock.py  Sat Jun 06 10:30:11 2020 +0100
+++ b/stock.py  Wed Jun 24 23:10:46 2020 +0200
@@ -9,3 +9,9 @@
     __name__ = 'stock.move'
     unit_landed_cost = fields.Numeric('Unit Landed Cost',
         digits=price_digits, readonly=True)
+
+    def _compute_unit_price(self):
+        unit_price = super()._compute_unit_price()
+        if self.unit_landed_cost:
+            unit_price += self.unit_landed_cost
+        return unit_price
diff -r 04c559fe3196 -r 14ab99515f10 tryton.cfg
--- a/tryton.cfg        Sat Jun 06 10:30:11 2020 +0100
+++ b/tryton.cfg        Wed Jun 24 23:10:46 2020 +0200
@@ -7,6 +7,8 @@
     product
     res
     stock
+extra_depends:
+    account_invoice_stock
 xml:
     account.xml
     product.xml

Reply via email to