This commit is contained in:
2026-03-23 09:10:55 +01:00
parent c655eb4170
commit 36b94b98af

View File

@@ -1147,11 +1147,15 @@ class Line(metaclass=PoolMeta):
def get_basis_price(self):
price = Decimal(0)
for pc in self.price_components:
PP = Pool().get('purchase.pricing.summary')
pp = PP.search([('price_component','=',pc.id),('line','=',self.id)])
if pp:
price += pp[0].price * (pc.ratio / 100)
if self.terms:
for t in self.terms:
price += t.manual_price
else:
for pc in self.price_components:
PP = Pool().get('purchase.pricing.summary')
pp = PP.search([('price_component','=',pc.id),('line','=',self.id)])
if pp:
price += pp[0].price * (pc.ratio / 100)
return round(price,4)
def get_price(self,lot_premium=0):
@@ -1170,8 +1174,9 @@ class Line(metaclass=PoolMeta):
Date = Pool().get('ir.date')
logger.info("ONCHANGEUNITPRICE:%s",self.unit_price)
if self.price_type == 'basis' and self.lots: #self.price_pricing and self.price_components and
logger.info("ONCHANGEUNITPRICE_IN:%s",self.get_basis_price())
return self.get_basis_price()
price = self.get_basis_price()
logger.info("ONCHANGEUNITPRICE_IN:%s",price)
return price
if self.enable_linked_currency and self.linked_price and self.linked_currency and self.price_type == 'priced':
return self.get_price_linked_currency()
if self.price_type == 'efp':
@@ -1345,6 +1350,8 @@ class Line(metaclass=PoolMeta):
price = Decimal(cp.get_last_price())
logger.info("PRICE:%s",price)
t.manual_price = round(t.payable_rule.compute_payable_quantity(grade) * price / Decimal(100) - t.penalty_rules.compute_penalty(grade),2)
t.currency = t.component.currency
t.unit = self.unit
Concentrate.save([t])
if self.price_components: