changeset 43a97a30bdf0 in modules/account_stock_shipment_cost_weight:default
details:
https://hg.tryton.org/modules/account_stock_shipment_cost_weight?cmd=changeset&node=43a97a30bdf0
description:
Show cost allocation before and after posting
issue11558
review413301003
diffstat:
account.py | 4 ++--
tests/scenario_account_stock_shipment_cost_weight.rst | 7 ++++++-
2 files changed, 8 insertions(+), 3 deletions(-)
diffs (34 lines):
diff -r 72fb25e40b43 -r 43a97a30bdf0 account.py
--- a/account.py Wed Jun 15 22:05:41 2022 +0200
+++ b/account.py Mon Jul 18 00:16:26 2022 +0200
@@ -14,11 +14,11 @@
cls.allocation_method.selection.append(('weight', "By Weight"))
def allocate_cost_by_weight(self):
- self.factors = self._get_weight_factors()
+ self.factors = self._get_factors('weight')
self._allocate_cost(self.factors)
def unallocate_cost_by_weight(self):
- factors = self.factors or self._get_weight_factors()
+ factors = self.factors or self._get_factors('weight')
self._allocate_cost(factors, sign=-1)
def _get_weight_factors(self):
diff -r 72fb25e40b43 -r 43a97a30bdf0
tests/scenario_account_stock_shipment_cost_weight.rst
--- a/tests/scenario_account_stock_shipment_cost_weight.rst Wed Jun 15
22:05:41 2022 +0200
+++ b/tests/scenario_account_stock_shipment_cost_weight.rst Mon Jul 18
00:16:26 2022 +0200
@@ -149,7 +149,12 @@
>>> shipment_cost.save()
>>> shipment_cost.state
'draft'
- >>> shipment_cost.click('post')
+ >>> post_shipment_cost = Wizard('account.shipment_cost.post',
[shipment_cost])
+ >>> post_shipment_cost.form.cost
+ Decimal('20.0000')
+ >>> sorted([s.cost for s in post_shipment_cost.form.shipments])
+ [Decimal('5.0000'), Decimal('15.0000')]
+ >>> post_shipment_cost.execute('post')
>>> shipment_cost.state
'posted'
>>> bool(shipment_cost.posted_date)