issue10957 review367831002 (grafted from 9b7cb0a11dab87559d69a7d0482a0313901b4b98) --HG-- branch : 6.0
28 lines
1.0 KiB
Python
28 lines
1.0 KiB
Python
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
|
# this repository contains the full copyright notices and license terms.
|
|
from trytond.pool import PoolMeta
|
|
from trytond.model import fields
|
|
from trytond.modules.product import price_digits
|
|
|
|
|
|
class Move(metaclass=PoolMeta):
|
|
__name__ = 'stock.move'
|
|
unit_landed_cost = fields.Numeric('Unit Landed Cost',
|
|
digits=price_digits, readonly=True)
|
|
|
|
def _compute_unit_price(self, unit_price):
|
|
if self.unit_landed_cost:
|
|
unit_price -= self.unit_landed_cost
|
|
unit_price = super()._compute_unit_price(unit_price)
|
|
if self.unit_landed_cost:
|
|
unit_price += self.unit_landed_cost
|
|
return unit_price
|
|
|
|
def _compute_component_unit_price(self, unit_price):
|
|
if self.unit_landed_cost:
|
|
unit_price -= self.unit_landed_cost
|
|
unit_price = super()._compute_component_unit_price(unit_price)
|
|
if self.unit_landed_cost:
|
|
unit_price += self.unit_landed_cost
|
|
return unit_price
|