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