changeset c80554e87db3 in modules/account_stock_landed_cost_weight:default details: https://hg.tryton.org/modules/account_stock_landed_cost_weight?cmd=changeset&node=c80554e87db3 description: Show cost allocation before and after posting
issue11558 review413301003 diffstat: account.py | 4 ++-- tests/scenario_account_stock_landed_cost_weight.rst | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diffs (39 lines): diff -r 8ccdf96c5e98 -r c80554e87db3 account.py --- a/account.py Mon May 02 17:56:52 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 8ccdf96c5e98 -r c80554e87db3 tests/scenario_account_stock_landed_cost_weight.rst --- a/tests/scenario_account_stock_landed_cost_weight.rst Mon May 02 17:56:52 2022 +0200 +++ b/tests/scenario_account_stock_landed_cost_weight.rst Mon Jul 18 00:16:26 2022 +0200 @@ -167,11 +167,16 @@ >>> landed_cost.save() >>> landed_cost.state 'draft' - >>> landed_cost.click('post') + >>> post_landed_cost = Wizard('account.landed_cost.post', [landed_cost]) + >>> post_landed_cost.form.cost + Decimal('30.0000') + >>> sorted([m.cost for m in post_landed_cost.form.moves]) + [Decimal('1.0000'), Decimal('2.0000')] + >>> post_landed_cost.execute('post') >>> landed_cost.state 'posted' -Check move unit price is 101:: +Check move unit price is 153:: >>> sorted([m.unit_price for m in shipment.incoming_moves]) [Decimal('51.0000'), Decimal('102.0000')]