compute currency in case has sale

This commit is contained in:
Raimon Esteve 2022-11-25 16:35:50 +01:00
parent 42770e9503
commit 31e48c0e0e
1 changed files with 2 additions and 2 deletions

View File

@ -109,14 +109,14 @@ class SaleLine(metaclass=PoolMeta):
def default_cost_price(): def default_cost_price():
return _ZERO return _ZERO
@fields.depends('product', 'currency') @fields.depends('product', 'currency', 'sale')
def on_change_product(self): def on_change_product(self):
Currency = Pool().get('currency.currency') Currency = Pool().get('currency.currency')
super(SaleLine, self).on_change_product() super(SaleLine, self).on_change_product()
if self.product: if self.product:
if self.currency: if self.currency and self.sale:
cost_price = Currency.compute( cost_price = Currency.compute(
self.currency, self.product.cost_price, self.currency, self.product.cost_price,
self.sale.currency, round=False) self.sale.currency, round=False)