changeset 7a5d40ebd258 in modules/production:default details: https://hg.tryton.org/modules/production?cmd=changeset&node=7a5d40ebd258 description: Set currency as company currency when setting unit price of output
issue11753 review435871021 diffstat: production.py | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diffs (51 lines): diff -r 24b2dca7b398 -r 7a5d40ebd258 production.py --- a/production.py Fri Sep 30 22:41:34 2022 +0200 +++ b/production.py Sun Oct 09 13:18:14 2022 +0200 @@ -395,6 +395,7 @@ quantity) if move: move.unit_price = Decimal(0) + move.currency = self.company.currency outputs.append(move) self.outputs = outputs @@ -483,6 +484,7 @@ if move: move.production_output = production move.unit_price = Decimal(0) + move.currency = production.company.currency to_save.append(move) continue @@ -506,6 +508,7 @@ if move: move.production_output = production move.unit_price = Decimal(0) + move.currency = production.company.currency to_save.append(move) Move.save(to_save) cls._set_move_planned_date(productions) @@ -560,8 +563,10 @@ input_costs[product] / input_quantities[product]) unit_price = round_price(Uom.compute_price( product.default_uom, cost_price, output.uom)) - if output.unit_price != unit_price: + if (output.unit_price != unit_price + or output.currency != production.company.currency): output.unit_price = unit_price + output.currency = production.company.currency moves.append(output) cost -= min( unit_price * Decimal(str(output.quantity)), cost) @@ -608,8 +613,10 @@ else: quantity = Decimal(str(output.quantity)) unit_price = round_price(cost * ratio / quantity) - if output.unit_price != unit_price: + if (output.unit_price != unit_price + or output.currency != production.company.currency): output.unit_price = unit_price + output.currency = production.company.currency moves.append(output) Move.save(moves)