14.02.26
This commit is contained in:
@@ -2014,7 +2014,7 @@ class LotShipping(Wizard):
|
||||
if r.r_lot_shipment_in:
|
||||
raise UserError("Please unlink before linking to a new shipment !")
|
||||
else:
|
||||
shipped_quantity = Decimal(r.r_lot_quantity)
|
||||
shipped_quantity = Decimal(str(r.r_lot_quantity)).quantize(Decimal("0.00001"))
|
||||
shipment_origin = None
|
||||
if self.ship.quantity:
|
||||
shipped_quantity = self.ship.quantity
|
||||
|
||||
@@ -331,6 +331,11 @@ class Sale(metaclass=PoolMeta):
|
||||
if self.lines.lots:
|
||||
return [l for l in self.lines.lots]
|
||||
|
||||
def get_matched_lines(self):
|
||||
if self.lots:
|
||||
LotQt = Pool().get('lot.qt')
|
||||
return LotQt.search([('lot_s','=',self.lots[0].id),('lot_p','>',0)])
|
||||
|
||||
@classmethod
|
||||
def validate(cls, sales):
|
||||
super(Sale, cls).validate(sales)
|
||||
@@ -343,11 +348,12 @@ class Sale(metaclass=PoolMeta):
|
||||
Line.save([line])
|
||||
|
||||
if line.lots:
|
||||
line_p = line.lots[0].line
|
||||
line_p = line.get_matched_lines()#line.lots[0].line
|
||||
if line_p:
|
||||
#compute pnl
|
||||
Pnl = Pool().get('valuation.valuation')
|
||||
Pnl.generate(line_p)
|
||||
for l in line_p:
|
||||
#compute pnl
|
||||
Pnl = Pool().get('valuation.valuation')
|
||||
Pnl.generate(l)
|
||||
|
||||
# if line.quantity_theorical:
|
||||
# OpenPosition = Pool().get('open.position')
|
||||
|
||||
@@ -537,8 +537,9 @@ class ValuationReport(ValuationBase, ModelView):
|
||||
context = Transaction().context
|
||||
valuation_date = context.get('valuation_date')
|
||||
strategy = context.get('strategy')
|
||||
wh = True
|
||||
if val.date:
|
||||
wh = (val.date == valuation_date)
|
||||
wh &= (val.date == valuation_date)
|
||||
if strategy:
|
||||
wh &= (val.strategy == strategy)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user