changeset 2855a64f4e6d in modules/stock:default
details: https://hg.tryton.org/modules/stock?cmd=changeset;node=2855a64f4e6d
description:
        Set a start date when recomputing cost price from revision

        issue8930
diffstat:

 product.py |  5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diffs (22 lines):

diff -r f767e144e583 -r 2855a64f4e6d product.py
--- a/product.py        Sun Jan 26 21:32:38 2020 +0100
+++ b/product.py        Sun Jan 26 21:40:54 2020 +0100
@@ -714,8 +714,6 @@
                     cost = revision.get_cost_price(product.cost_price)
                     costs[cost].append(product)
                     records.remove(product)
-            Revision.save(revisions)
-            Product.recompute_cost_price(products)  # TODO start
         elif context['active_model'] == 'product.template':
             recompute_cost_price = Template.recompute_cost_price
             templates = records = Template.browse(context['active_ids'])
@@ -734,7 +732,8 @@
         if costs:
             Product.update_cost_price(costs)
         if records:
-            recompute_cost_price(records)  # TODO start
+            start = min((r.date for r in revisions), default=None)
+            recompute_cost_price(records, start=start)
         return 'end'
 
     def get_revision(self, Revision):

Reply via email to