23.03.26
This commit is contained in:
@@ -1147,11 +1147,15 @@ class Line(metaclass=PoolMeta):
|
|||||||
|
|
||||||
def get_basis_price(self):
|
def get_basis_price(self):
|
||||||
price = Decimal(0)
|
price = Decimal(0)
|
||||||
for pc in self.price_components:
|
if self.terms:
|
||||||
PP = Pool().get('purchase.pricing.summary')
|
for t in self.terms:
|
||||||
pp = PP.search([('price_component','=',pc.id),('line','=',self.id)])
|
price += t.manual_price
|
||||||
if pp:
|
else:
|
||||||
price += pp[0].price * (pc.ratio / 100)
|
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)
|
return round(price,4)
|
||||||
|
|
||||||
def get_price(self,lot_premium=0):
|
def get_price(self,lot_premium=0):
|
||||||
@@ -1170,8 +1174,9 @@ class Line(metaclass=PoolMeta):
|
|||||||
Date = Pool().get('ir.date')
|
Date = Pool().get('ir.date')
|
||||||
logger.info("ONCHANGEUNITPRICE:%s",self.unit_price)
|
logger.info("ONCHANGEUNITPRICE:%s",self.unit_price)
|
||||||
if self.price_type == 'basis' and self.lots: #self.price_pricing and self.price_components and
|
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())
|
price = self.get_basis_price()
|
||||||
return 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':
|
if self.enable_linked_currency and self.linked_price and self.linked_currency and self.price_type == 'priced':
|
||||||
return self.get_price_linked_currency()
|
return self.get_price_linked_currency()
|
||||||
if self.price_type == 'efp':
|
if self.price_type == 'efp':
|
||||||
@@ -1345,6 +1350,8 @@ class Line(metaclass=PoolMeta):
|
|||||||
price = Decimal(cp.get_last_price())
|
price = Decimal(cp.get_last_price())
|
||||||
logger.info("PRICE:%s",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.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])
|
Concentrate.save([t])
|
||||||
|
|
||||||
if self.price_components:
|
if self.price_components:
|
||||||
|
|||||||
Reference in New Issue
Block a user