23.03.26
This commit is contained in:
@@ -1402,9 +1402,7 @@ class Line(metaclass=PoolMeta):
|
||||
apDate = []
|
||||
apPrice = []
|
||||
for t in pc.triggers:
|
||||
logger.info("CHECK_PRICING:%s",t)
|
||||
prD, prP = t.getPricingListDates(pc.calendar)
|
||||
logger.info("CHECK_PRICING2:%s",prP)
|
||||
apD, apP = t.getApplicationListDates(pc.calendar)
|
||||
prDate.extend(prD)
|
||||
prPrice.extend(prP)
|
||||
@@ -1461,39 +1459,31 @@ class Line(metaclass=PoolMeta):
|
||||
break
|
||||
p = Pricing()
|
||||
p.line = self.id
|
||||
logger.info("GENEDATE:%s",d)
|
||||
logger.info("TYPEDATE:%s",type(d))
|
||||
p.pricing_date = d.date()
|
||||
p.price_component = pc.id
|
||||
p.quantity = round(Decimal(pc.quota),5)
|
||||
price = round(Decimal(self.getnearprice(pl,d,'price')),4)
|
||||
logger.info("PRICE:%s",price)
|
||||
p.settl_price = price
|
||||
if price > 0:
|
||||
cumul_qt += pc.quota
|
||||
p.fixed_qt = round(Decimal(cumul_qt),5)
|
||||
p.fixed_qt_price = round(Decimal(self.getnearprice(pl,d,'avg')),4)
|
||||
logger.info("PRICE_AVG:%s",p.fixed_qt_price)
|
||||
#p.fixed_qt_price = p.get_fixed_price()
|
||||
if p.fixed_qt_price == 0:
|
||||
p.fixed_qt_price = round(Decimal(self.getnearprice(pl,d,'avg_minus_1')),4)
|
||||
logger.info("PRICE_AVG_MIN:%s",p.fixed_qt_price)
|
||||
p.unfixed_qt = round(Decimal(self.quantity_theorical) - Decimal(cumul_qt),5)
|
||||
if p.unfixed_qt < 0.001:
|
||||
p.unfixed_qt = Decimal(0)
|
||||
p.fixed_qt = Decimal(self.quantity_theorical)
|
||||
if price > 0:
|
||||
logger.info("GENERATE_1:%s",price)
|
||||
p.unfixed_qt_price = price
|
||||
else:
|
||||
pr = Decimal(pc.price_index.get_price(p.pricing_date,self.unit,self.purchase.currency,True))
|
||||
pr = round(pr,4)
|
||||
logger.info("GENERATE_2:%s",pr)
|
||||
p.unfixed_qt_price = pr
|
||||
p.eod_price = p.get_eod_price_purchase()
|
||||
if (index == len(dl)-1) or (pc.pricing_date and (index < len(dl)-1 and dl_sorted[index+1].date() > pc.pricing_date)):
|
||||
p.last = True
|
||||
logger.info("GENERATE_3:%s",p.unfixed_qt_price)
|
||||
Pricing.save([p])
|
||||
index += 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user