changeset 519852d18b81 in modules/product_kit:default
details:
https://hg.tryton.org/modules/product_kit?cmd=changeset&node=519852d18b81
description:
Add back the shipment cost when recompute move unit price
When the unit price of a move is updated, the shipment cost that was
added must
be added back.
issue10196
review348201004
diffstat:
stock.py | 18 ++++++++----------
1 files changed, 8 insertions(+), 10 deletions(-)
diffs (53 lines):
diff -r 64f771e3f4c0 -r 519852d18b81 stock.py
--- a/stock.py Sun Apr 25 17:52:36 2021 +0200
+++ b/stock.py Wed Apr 28 00:35:04 2021 +0200
@@ -12,7 +12,7 @@
class Move(metaclass=PoolMeta):
__name__ = 'stock.move'
- def _compute_component_unit_price(self):
+ def _compute_component_unit_price(self, unit_price):
pool = Pool()
Currency = pool.get('currency.currency')
UoM = pool.get('product.uom')
@@ -25,9 +25,7 @@
quantity = UoM.compute_qty(
line.unit, line.quantity, self.uom)
amount *= self.origin.price_ratio
- if not quantity:
- unit_price = self.unit_price
- else:
+ if quantity:
unit_price = round_price(amount / Decimal(str(quantity)))
return unit_price
@@ -103,12 +101,12 @@
name = self.origin.line.sale.rec_name
return name
- def _compute_unit_price(self):
+ def _compute_unit_price(self, unit_price):
pool = Pool()
SaleLineComponent = pool.get('sale.line.component')
- unit_price = super()._compute_unit_price()
+ unit_price = super()._compute_unit_price(unit_price)
if isinstance(self.origin, SaleLineComponent):
- unit_price = self._compute_component_unit_price()
+ unit_price = self._compute_component_unit_price(unit_price)
return unit_price
@@ -156,10 +154,10 @@
name = self.origin.line.sale.rec_name
return name
- def _compute_unit_price(self):
+ def _compute_unit_price(self, unit_price):
pool = Pool()
PurchaseLineComponent = pool.get('purchase.line.component')
- unit_price = super()._compute_unit_price()
+ unit_price = super()._compute_unit_price(unit_price)
if isinstance(self.origin, PurchaseLineComponent):
- unit_price = self._compute_component_unit_price()
+ unit_price = self._compute_component_unit_price(unit_price)
return unit_price