Get currency from line to calculate cost_price
Allow compability to sale_line_standalone
This commit is contained in:
parent
329f225650
commit
42770e9503
11
sale.py
11
sale.py
|
@ -109,16 +109,19 @@ class SaleLine(metaclass=PoolMeta):
|
||||||
def default_cost_price():
|
def default_cost_price():
|
||||||
return _ZERO
|
return _ZERO
|
||||||
|
|
||||||
@fields.depends('product')
|
@fields.depends('product', 'currency')
|
||||||
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:
|
||||||
cost_price = Currency.compute(
|
if self.currency:
|
||||||
self.sale.company.currency, self.product.cost_price,
|
cost_price = Currency.compute(
|
||||||
self.sale.currency, round=False)
|
self.currency, self.product.cost_price,
|
||||||
|
self.sale.currency, round=False)
|
||||||
|
else:
|
||||||
|
cost_price = self.product.cost_price
|
||||||
self.cost_price = cost_price
|
self.cost_price = cost_price
|
||||||
|
|
||||||
@fields.depends('type', 'quantity', 'cost_price', '_parent_sale.currency',
|
@fields.depends('type', 'quantity', 'cost_price', '_parent_sale.currency',
|
||||||
|
|
Loading…
Reference in New Issue