|
|
for line in self:
# check if there is already invoiced amount. if so, the price shouldn't change as it might have been
# manually edited
if (
line.qty_invoiced > 0 or
(line.product_id.expense_policy == 'cost' and line.is_expense) or
line._is_discount_line()
):
continue
if not line.product_uom or not line.product_id:
line.price_unit = 0.0
else:
line = line.with_company(line.company_id)
price = line._get_display_price()
product_taxes = line.product_id.taxes_id._filter_taxes_by_company(line.company_id)
line.price_unit = line.product_id._get_tax_included_unit_price_from_price(
price,
line.currency_id or line.order_id.currency_id,
product_taxes=product_taxes,
fiscal_position=line.order_id.fiscal_position_id,
)
|
|