changeset f2e72b8ca92a in modules/stock:5.6
details: https://hg.tryton.org/modules/stock?cmd=changeset;node=f2e72b8ca92a
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
(grafted from 86cac34d108496d4321ddedf6bf620f6e5670ef8)
diffstat:
product.py | 2 +-
tests/scenario_stock_average_cost_price.rst | 11 +++++++++++
2 files changed, 12 insertions(+), 1 deletions(-)
diffs (33 lines):
diff -r fdc3dc8e5462 -r f2e72b8ca92a product.py
--- a/product.py Wed Jun 03 22:16:11 2020 +0200
+++ b/product.py Mon Oct 19 00:17:20 2020 +0200
@@ -740,7 +740,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 fdc3dc8e5462 -r f2e72b8ca92a tests/scenario_stock_average_cost_price.rst
--- a/tests/scenario_stock_average_cost_price.rst Wed Jun 03 22:16:11
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()