|
|
"""Get the specific price if no auto-price, and the price obtained
from the pricelist otherwise.
"""
for line in self:
if line.automatic_price and line.product_id:
pricelist = (
line.contract_id.pricelist_id
or line.contract_id.partner_id.with_company(
line.contract_id.company_id
).property_product_pricelist
)
product = line.product_id.with_context(
quantity=line.env.context.get(
"contract_line_qty",
line.quantity,
),
pricelist=pricelist.id,
partner=line.contract_id.partner_id.id,
date=line.env.context.get(
"old_date", fields.Date.context_today(line)
),
)
line.price_unit = pricelist._get_product_price(product, quantity=1)
else:
line.price_unit = line.specific_price
|
|