Compare commits
2 Commits
ac6cc708ba
...
42770e9503
Author | SHA1 | Date |
---|---|---|
Raimon Esteve | 42770e9503 | |
Raimon Esteve | 329f225650 |
13
sale.py
13
sale.py
|
@ -109,11 +109,20 @@ class SaleLine(metaclass=PoolMeta):
|
|||
def default_cost_price():
|
||||
return _ZERO
|
||||
|
||||
@fields.depends('product')
|
||||
@fields.depends('product', 'currency')
|
||||
def on_change_product(self):
|
||||
Currency = Pool().get('currency.currency')
|
||||
|
||||
super(SaleLine, self).on_change_product()
|
||||
|
||||
if self.product:
|
||||
self.cost_price = self.product.cost_price
|
||||
if self.currency:
|
||||
cost_price = Currency.compute(
|
||||
self.currency, self.product.cost_price,
|
||||
self.sale.currency, round=False)
|
||||
else:
|
||||
cost_price = self.product.cost_price
|
||||
self.cost_price = cost_price
|
||||
|
||||
@fields.depends('type', 'quantity', 'cost_price', '_parent_sale.currency',
|
||||
'_parent_sale.lines', methods=['on_change_with_amount'])
|
||||
|
|
Loading…
Reference in New Issue