04.01.26
This commit is contained in:
@@ -34,10 +34,7 @@ VALTYPE = [
|
||||
('derivative', 'Derivative'),
|
||||
]
|
||||
|
||||
class Valuation(ModelSQL,ModelView):
|
||||
"Valuation"
|
||||
__name__ = 'valuation.valuation'
|
||||
|
||||
class ValuationBase(ModelSQL):
|
||||
purchase = fields.Many2One('purchase.purchase',"Purchase")
|
||||
line = fields.Many2One('purchase.line',"Purch. Line")
|
||||
date = fields.Date("Date")
|
||||
@@ -299,11 +296,24 @@ class Valuation(ModelSQL,ModelView):
|
||||
pnl = Pnl.search([('line','=',line.id),('date','=',Date.today())])
|
||||
if pnl:
|
||||
Pnl.delete(pnl)
|
||||
PnlLine = Pool().get('valuation.valuation.line')
|
||||
pnlline = PnlLine.search(['line','=',line.id])
|
||||
if pnlline:
|
||||
PnlLine.delete(pnlline)
|
||||
pnl_lines = []
|
||||
pnl_lines.extend(cls.create_pnl_fee_from_line(line))
|
||||
pnl_lines.extend(cls.create_pnl_price_from_line(line))
|
||||
pnl_lines.extend(cls.create_pnl_der_from_line(line))
|
||||
Pnl.save(pnl_lines)
|
||||
PnlLine.save(pnl_lines)
|
||||
|
||||
class Valuation(ValuationBase, ModelView):
|
||||
"Valuation"
|
||||
__name__ = 'valuation.valuation'
|
||||
|
||||
class ValuationLine(ValuationBase, ModelView):
|
||||
"Last Valuation"
|
||||
__name__ = 'valuation.valuation.line'
|
||||
|
||||
class ValuationDyn(ModelSQL,ModelView):
|
||||
"Valuation"
|
||||
@@ -327,35 +337,12 @@ class ValuationDyn(ModelSQL,ModelView):
|
||||
|
||||
@classmethod
|
||||
def table_query(cls):
|
||||
Valuation = Pool().get('valuation.valuation')
|
||||
Valuation = Pool().get('valuation.valuation.line')
|
||||
val = Valuation.__table__()
|
||||
context = Transaction().context
|
||||
group_pnl = context.get('group_pnl')
|
||||
wh = (val.id > 0)
|
||||
# query = val.select(
|
||||
# Literal(0).as_('create_uid'),
|
||||
# CurrentTimestamp().as_('create_date'),
|
||||
# Literal(None).as_('write_uid'),
|
||||
# Literal(None).as_('write_date'),
|
||||
# val.id.as_('id'),
|
||||
# val.purchase.as_('r_purchase'),
|
||||
# val.line.as_('r_line'),
|
||||
# val.date.as_('r_date'),
|
||||
# val.type.as_('r_type'),
|
||||
# val.reference.as_('r_reference'),
|
||||
# val.counterparty.as_('r_counterparty'),
|
||||
# val.product.as_('r_product'),
|
||||
# val.state.as_('r_state'),
|
||||
# val.price.as_('r_price'),
|
||||
# val.currency.as_('r_currency'),
|
||||
# val.quantity.as_('r_quantity'),
|
||||
# val.unit.as_('r_unit'),
|
||||
# val.amount.as_('r_amount'),
|
||||
# val.mtm.as_('r_mtm'),
|
||||
# val.lot.as_('r_lot'),
|
||||
# where=wh)
|
||||
|
||||
#if group_pnl==True:
|
||||
|
||||
query = val.select(
|
||||
Literal(0).as_('create_uid'),
|
||||
CurrentTimestamp().as_('create_date'),
|
||||
|
||||
Reference in New Issue
Block a user