changeset 86cac34d1084 in modules/stock:default
details: https://hg.tryton.org/modules/stock?cmd=changeset;node=86cac34d1084
description:
        Test template type in Modify Cost Price wizard

        When the model is product.template, it is the template type
        that must be tested.

        issue9639
        review292321002
diffstat:

 product.py                                  |   2 +-
 tests/scenario_stock_average_cost_price.rst |  11 +++++++++++
 2 files changed, 12 insertions(+), 1 deletions(-)

diffs (33 lines):

diff -r ac1a73b31c6d -r 86cac34d1084 product.py
--- a/product.py        Fri Oct 16 19:19:58 2020 +0200
+++ b/product.py        Mon Oct 19 00:17:20 2020 +0200
@@ -869,7 +869,7 @@
                 if ((
                             template.cost_price_method == 'fixed'
                             and revision.date == today)
-                        or product.type == 'service'):
+                        or template.type == 'service'):
                     for product in template.products:
                         cost = revision.get_cost_price(product.cost_price)
                         costs[cost].append(product)
diff -r ac1a73b31c6d -r 86cac34d1084 tests/scenario_stock_average_cost_price.rst
--- a/tests/scenario_stock_average_cost_price.rst       Fri Oct 16 19:19:58 
2020 +0200
+++ b/tests/scenario_stock_average_cost_price.rst       Mon Oct 19 00:17:20 
2020 +0200
@@ -152,6 +152,17 @@
     >>> product.cost_price
     Decimal('140.0000')
 
+Increase Cost Price by 10% using Template wizard::
+
+    >>> modify_cost_price = Wizard(
+    ...     'product.modify_cost_price', [product.template])
+    >>> modify_cost_price.form.cost_price = 'cost_price * 1.1'
+    >>> modify_cost_price.form.date = today + datetime.timedelta(days=1)
+    >>> modify_cost_price.execute('modify')
+    >>> product.reload()
+    >>> product.cost_price
+    Decimal('154.0000')
+
 Send one product we don't have in stock::
 
     >>> outgoing_move = StockMove()

Reply via email to