GR
This commit is contained in:
@@ -62,6 +62,8 @@ def register():
|
||||
ctrm_reporting.CTRMPhysicalPositionContext,
|
||||
ctrm_reporting.CTRMFinancialPosition,
|
||||
ctrm_reporting.CTRMFinancialPositionContext,
|
||||
ctrm_reporting.CTRMNetPosition,
|
||||
ctrm_reporting.CTRMNetPositionContext,
|
||||
configuration.Configuration,
|
||||
pricing.ImportPricesStart,
|
||||
pricing.ImportPricesResult,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from sql import Literal, Null
|
||||
from sql import Literal
|
||||
from sql.aggregate import Max, Min, Sum
|
||||
from sql.conditionals import Case, Coalesce
|
||||
from sql.functions import CurrentTimestamp
|
||||
@@ -8,270 +8,303 @@ from trytond.pool import Pool
|
||||
from trytond.transaction import Transaction
|
||||
|
||||
|
||||
class CTRMPhysicalPositionContext(ModelView):
|
||||
"CTRM Physical Position Context"
|
||||
__name__ = 'ctrm.reporting.position.physical.context'
|
||||
PHYSICAL_VALUATION_TYPES = [
|
||||
'priced',
|
||||
'pur. priced',
|
||||
'pur. efp',
|
||||
'sale priced',
|
||||
'sale efp',
|
||||
'line fee',
|
||||
'pur. fee',
|
||||
'sale fee',
|
||||
'shipment fee',
|
||||
'market',
|
||||
]
|
||||
DERIVATIVE_VALUATION_TYPES = ['derivative']
|
||||
|
||||
as_of = fields.Date("As of")
|
||||
|
||||
class CTRMValuationContextMixin:
|
||||
date = fields.Date("Valuation Date")
|
||||
product = fields.Many2One('product.product', "Product")
|
||||
supplier = fields.Many2One('party.party', "Supplier")
|
||||
client = fields.Many2One('party.party', "Client")
|
||||
counterparty = fields.Many2One('party.party', "Counterparty")
|
||||
currency = fields.Many2One('currency.currency', "Currency")
|
||||
position_type = fields.Selection([
|
||||
(None, ""),
|
||||
('open', 'Open'),
|
||||
('physic', 'Physic'),
|
||||
('shipped', 'Shipped'),
|
||||
], "Position Type")
|
||||
purchase = fields.Many2One('purchase.purchase', "Purchase")
|
||||
sale = fields.Many2One('sale.sale', "Sale")
|
||||
strategy = fields.Many2One('mtm.strategy', "Strategy")
|
||||
state = fields.Char("State")
|
||||
|
||||
@classmethod
|
||||
def default_as_of(cls):
|
||||
def default_date(cls):
|
||||
Date = Pool().get('ir.date')
|
||||
return Date.today()
|
||||
|
||||
|
||||
class CTRMPhysicalPositionContext(
|
||||
CTRMValuationContextMixin, ModelView):
|
||||
"CTRM Physical Position Context"
|
||||
__name__ = 'ctrm.reporting.position.physical.context'
|
||||
|
||||
|
||||
class CTRMPhysicalPosition(ModelSQL, ModelView):
|
||||
"CTRM Physical Position"
|
||||
__name__ = 'ctrm.reporting.position.physical'
|
||||
|
||||
valuation_date = fields.Date("Valuation Date")
|
||||
lot = fields.Many2One('lot.lot', "Lot")
|
||||
purchase = fields.Many2One('purchase.purchase', "Purchase")
|
||||
purchase_line = fields.Many2One('purchase.line', "Purchase Line")
|
||||
sale = fields.Many2One('sale.sale', "Sale")
|
||||
sale_line = fields.Many2One('sale.line', "Sale Line")
|
||||
type = fields.Selection([
|
||||
('priced', 'Price'),
|
||||
('pur. priced', 'Pur. price'),
|
||||
('pur. efp', 'Pur. efp'),
|
||||
('sale priced', 'Sale price'),
|
||||
('sale efp', 'Sale efp'),
|
||||
('line fee', 'Line fee'),
|
||||
('pur. fee', 'Pur. fee'),
|
||||
('sale fee', 'Sale fee'),
|
||||
('shipment fee', 'Shipment fee'),
|
||||
('market', 'Market'),
|
||||
], "Type")
|
||||
reference = fields.Char("Reference")
|
||||
counterparty = fields.Many2One('party.party', "Counterparty")
|
||||
product = fields.Many2One('product.product', "Product")
|
||||
supplier = fields.Many2One('party.party', "Supplier")
|
||||
client = fields.Many2One('party.party', "Client")
|
||||
state = fields.Char("State")
|
||||
price = fields.Numeric("Price", digits=(16, 4))
|
||||
currency = fields.Many2One('currency.currency', "Currency")
|
||||
uom = fields.Many2One('product.uom', "Unit")
|
||||
position_type = fields.Selection([
|
||||
('open', 'Open'),
|
||||
('physic', 'Physic'),
|
||||
('shipped', 'Shipped'),
|
||||
], "Position Type")
|
||||
physical_qty = fields.Numeric("Physical Quantity", digits=(16, 5))
|
||||
hedged_qty = fields.Numeric("Hedged Quantity", digits=(16, 5))
|
||||
net_exposure = fields.Numeric("Net Exposure", digits=(16, 5))
|
||||
quantity = fields.Numeric("Quantity", digits=(16, 5))
|
||||
unit = fields.Many2One('product.uom', "Unit")
|
||||
amount = fields.Numeric("Amount", digits=(16, 2))
|
||||
base_amount = fields.Numeric("Base Amount", digits=(16, 2))
|
||||
mtm_price = fields.Numeric("MTM Price", digits=(16, 4))
|
||||
mtm = fields.Numeric("MTM", digits=(16, 2))
|
||||
pnl = fields.Numeric("P&L", digits=(16, 2))
|
||||
period_start = fields.Date("Period Start")
|
||||
period_end = fields.Date("Period End")
|
||||
strategy = fields.Many2One('mtm.strategy', "Strategy")
|
||||
|
||||
@classmethod
|
||||
def table_query(cls):
|
||||
LotReport = Pool().get('lot.report')
|
||||
PurchaseLine = Pool().get('purchase.line')
|
||||
Purchase = Pool().get('purchase.purchase')
|
||||
SaleLine = Pool().get('sale.line')
|
||||
Sale = Pool().get('sale.sale')
|
||||
ValuationLine = Pool().get('valuation.valuation.line')
|
||||
val = ValuationLine.__table__()
|
||||
|
||||
context = Transaction().context
|
||||
as_of = context.get('as_of')
|
||||
product = context.get('product')
|
||||
supplier = context.get('supplier')
|
||||
client = context.get('client')
|
||||
currency = context.get('currency')
|
||||
position_type = context.get('position_type')
|
||||
where = val.type.in_(PHYSICAL_VALUATION_TYPES)
|
||||
if context.get('date'):
|
||||
where &= val.date == context['date']
|
||||
if context.get('product'):
|
||||
where &= val.product == context['product']
|
||||
if context.get('counterparty'):
|
||||
where &= val.counterparty == context['counterparty']
|
||||
if context.get('currency'):
|
||||
where &= val.currency == context['currency']
|
||||
if context.get('purchase'):
|
||||
where &= val.purchase == context['purchase']
|
||||
if context.get('sale'):
|
||||
where &= val.sale == context['sale']
|
||||
if context.get('strategy'):
|
||||
where &= val.strategy == context['strategy']
|
||||
if context.get('state'):
|
||||
where &= val.state == context['state']
|
||||
|
||||
lot_context = {
|
||||
'purchase': None,
|
||||
'sale': None,
|
||||
'shipment': None,
|
||||
'type': 'all',
|
||||
'state': 'all',
|
||||
'wh': 'all',
|
||||
'group': 'by_physic',
|
||||
'origin': 'all',
|
||||
'ps': 'all',
|
||||
'shipping_status': 'all',
|
||||
}
|
||||
if as_of:
|
||||
lot_context['todate'] = as_of
|
||||
if product:
|
||||
lot_context['product'] = product
|
||||
if supplier:
|
||||
lot_context['supplier'] = supplier
|
||||
if client:
|
||||
lot_context['client'] = client
|
||||
|
||||
lr = LotReport.table_query(lot_context)
|
||||
pl = PurchaseLine.__table__()
|
||||
pu = Purchase.__table__()
|
||||
sl = SaleLine.__table__()
|
||||
sa = Sale.__table__()
|
||||
|
||||
position_type_expr = Case(
|
||||
(lr.r_lot_type == 'virtual', 'open'),
|
||||
(lr.r_shipping_status.in_(['scheduled', 'shipped', 'received']),
|
||||
'shipped'),
|
||||
else_='physic')
|
||||
currency_expr = Coalesce(sa.currency, pu.currency)
|
||||
price_expr = Coalesce(sl.unit_price, pl.unit_price, 0)
|
||||
|
||||
where = Literal(True)
|
||||
if currency:
|
||||
where &= currency_expr == currency
|
||||
if position_type:
|
||||
where &= position_type_expr == position_type
|
||||
|
||||
group_by = [
|
||||
lr.r_lot_product,
|
||||
lr.r_supplier,
|
||||
lr.r_client,
|
||||
currency_expr,
|
||||
lr.r_lot_unit,
|
||||
position_type_expr,
|
||||
]
|
||||
|
||||
return (
|
||||
lr
|
||||
.join(pl, 'LEFT', condition=pl.id == lr.r_line)
|
||||
.join(pu, 'LEFT', condition=pu.id == lr.r_purchase)
|
||||
.join(sl, 'LEFT', condition=sl.id == lr.r_sale_line)
|
||||
.join(sa, 'LEFT', condition=sa.id == lr.r_sale)
|
||||
.select(
|
||||
return val.select(
|
||||
Literal(0).as_('create_uid'),
|
||||
CurrentTimestamp().as_('create_date'),
|
||||
Literal(None).as_('write_uid'),
|
||||
Literal(None).as_('write_date'),
|
||||
Min(lr.id).as_('id'),
|
||||
lr.r_lot_product.as_('product'),
|
||||
lr.r_supplier.as_('supplier'),
|
||||
lr.r_client.as_('client'),
|
||||
currency_expr.as_('currency'),
|
||||
lr.r_lot_unit.as_('uom'),
|
||||
position_type_expr.as_('position_type'),
|
||||
Sum(lr.r_lot_quantity).as_('physical_qty'),
|
||||
Literal(0).as_('hedged_qty'),
|
||||
Sum(lr.r_lot_quantity).as_('net_exposure'),
|
||||
Sum(lr.r_lot_quantity * price_expr).as_('amount'),
|
||||
Literal(None).as_('mtm'),
|
||||
Literal(None).as_('pnl'),
|
||||
Literal(None).as_('period_start'),
|
||||
Literal(None).as_('period_end'),
|
||||
where=where,
|
||||
group_by=group_by))
|
||||
val.id.as_('id'),
|
||||
val.date.as_('valuation_date'),
|
||||
val.lot.as_('lot'),
|
||||
val.purchase.as_('purchase'),
|
||||
val.line.as_('purchase_line'),
|
||||
val.sale.as_('sale'),
|
||||
val.sale_line.as_('sale_line'),
|
||||
val.type.as_('type'),
|
||||
val.reference.as_('reference'),
|
||||
val.counterparty.as_('counterparty'),
|
||||
val.product.as_('product'),
|
||||
val.state.as_('state'),
|
||||
val.price.as_('price'),
|
||||
val.currency.as_('currency'),
|
||||
val.quantity.as_('quantity'),
|
||||
val.unit.as_('unit'),
|
||||
val.amount.as_('amount'),
|
||||
val.base_amount.as_('base_amount'),
|
||||
val.mtm_price.as_('mtm_price'),
|
||||
val.mtm.as_('mtm'),
|
||||
val.strategy.as_('strategy'),
|
||||
where=where)
|
||||
|
||||
|
||||
class CTRMFinancialPositionContext(ModelView):
|
||||
class CTRMFinancialPositionContext(
|
||||
CTRMValuationContextMixin, ModelView):
|
||||
"CTRM Financial Position Context"
|
||||
__name__ = 'ctrm.reporting.position.financial.context'
|
||||
|
||||
trade_from = fields.Date("Trade Date From")
|
||||
trade_to = fields.Date("Trade Date To")
|
||||
maturity_from = fields.Date("Maturity From")
|
||||
maturity_to = fields.Date("Maturity To")
|
||||
product = fields.Many2One('product.product', "Product")
|
||||
party = fields.Many2One('party.party', "Counterparty")
|
||||
purchase = fields.Many2One('purchase.purchase', "Purchase")
|
||||
sale = fields.Many2One('sale.sale', "Sale")
|
||||
direction = fields.Selection([
|
||||
(None, ''),
|
||||
('long', 'Long'),
|
||||
('short', 'Short'),
|
||||
], 'Direction')
|
||||
state = fields.Selection([
|
||||
(None, ''),
|
||||
('open', 'Open'),
|
||||
('closed', 'Closed'),
|
||||
], 'State')
|
||||
open_only = fields.Boolean("Open Positions Only")
|
||||
|
||||
@classmethod
|
||||
def default_trade_to(cls):
|
||||
Date = Pool().get('ir.date')
|
||||
return Date.today()
|
||||
|
||||
@classmethod
|
||||
def default_open_only(cls):
|
||||
return True
|
||||
|
||||
|
||||
class CTRMFinancialPosition(ModelSQL, ModelView):
|
||||
"CTRM Financial Position"
|
||||
__name__ = 'ctrm.reporting.position.financial'
|
||||
|
||||
derivative = fields.Many2One('derivative.derivative', "Derivative")
|
||||
trade_date = fields.Date("Trade Date")
|
||||
maturity_date = fields.Date("Maturity")
|
||||
product = fields.Many2One('product.product', "Product")
|
||||
party = fields.Many2One('party.party', "Counterparty")
|
||||
valuation_date = fields.Date("Valuation Date")
|
||||
purchase = fields.Many2One('purchase.purchase', "Purchase")
|
||||
purchase_line = fields.Many2One('purchase.line', "Purchase Line")
|
||||
sale = fields.Many2One('sale.sale', "Sale")
|
||||
sale_line = fields.Many2One('sale.line', "Sale Line")
|
||||
price_index = fields.Many2One('price.price', "Curve")
|
||||
direction = fields.Selection([
|
||||
('long', 'Long'),
|
||||
('short', 'Short'),
|
||||
], 'Direction')
|
||||
state = fields.Selection([
|
||||
('open', 'Open'),
|
||||
('closed', 'Closed'),
|
||||
], 'State')
|
||||
contract_count = fields.Integer("Nb ct")
|
||||
open_qty = fields.Numeric("Open Quantity", digits='unit')
|
||||
entry_price = fields.Numeric("Entry Price", digits='currency')
|
||||
exit_price = fields.Numeric("Exit Price", digits='currency')
|
||||
reference = fields.Char("Reference")
|
||||
counterparty = fields.Many2One('party.party', "Counterparty")
|
||||
product = fields.Many2One('product.product', "Product")
|
||||
state = fields.Char("State")
|
||||
price = fields.Numeric("Price", digits=(16, 4))
|
||||
currency = fields.Many2One('currency.currency', "Currency")
|
||||
quantity = fields.Numeric("Quantity", digits=(16, 5))
|
||||
unit = fields.Many2One('product.uom', "Unit")
|
||||
amount = fields.Numeric("Amount", digits=(16, 2))
|
||||
base_amount = fields.Numeric("Base Amount", digits=(16, 2))
|
||||
mtm_price = fields.Numeric("MTM Price", digits=(16, 4))
|
||||
mtm = fields.Numeric("MTM", digits=(16, 2))
|
||||
strategy = fields.Many2One('mtm.strategy', "Strategy")
|
||||
|
||||
@classmethod
|
||||
def table_query(cls):
|
||||
Derivative = Pool().get('derivative.derivative')
|
||||
d = Derivative.__table__()
|
||||
ValuationLine = Pool().get('valuation.valuation.line')
|
||||
val = ValuationLine.__table__()
|
||||
|
||||
context = Transaction().context
|
||||
trade_from = context.get('trade_from')
|
||||
trade_to = context.get('trade_to')
|
||||
maturity_from = context.get('maturity_from')
|
||||
maturity_to = context.get('maturity_to')
|
||||
product = context.get('product')
|
||||
party = context.get('party')
|
||||
purchase = context.get('purchase')
|
||||
sale = context.get('sale')
|
||||
direction = context.get('direction')
|
||||
state = context.get('state')
|
||||
open_only = context.get('open_only')
|
||||
where = val.type.in_(DERIVATIVE_VALUATION_TYPES)
|
||||
if context.get('date'):
|
||||
where &= val.date == context['date']
|
||||
if context.get('product'):
|
||||
where &= val.product == context['product']
|
||||
if context.get('counterparty'):
|
||||
where &= val.counterparty == context['counterparty']
|
||||
if context.get('currency'):
|
||||
where &= val.currency == context['currency']
|
||||
if context.get('purchase'):
|
||||
where &= val.purchase == context['purchase']
|
||||
if context.get('sale'):
|
||||
where &= val.sale == context['sale']
|
||||
if context.get('strategy'):
|
||||
where &= val.strategy == context['strategy']
|
||||
if context.get('state'):
|
||||
where &= val.state == context['state']
|
||||
|
||||
where = Literal(True)
|
||||
if trade_from:
|
||||
where &= d.trade_date >= trade_from
|
||||
if trade_to:
|
||||
where &= d.trade_date <= trade_to
|
||||
if maturity_from:
|
||||
where &= d.maturity_date >= maturity_from
|
||||
if maturity_to:
|
||||
where &= d.maturity_date <= maturity_to
|
||||
if product:
|
||||
where &= d.product == product
|
||||
if party:
|
||||
where &= d.party == party
|
||||
if purchase:
|
||||
where &= d.purchase == purchase
|
||||
if sale:
|
||||
where &= d.sale == sale
|
||||
if direction:
|
||||
where &= d.direction == direction
|
||||
if state:
|
||||
where &= d.state == state
|
||||
if open_only:
|
||||
where &= d.open_qty > 0
|
||||
|
||||
return d.select(
|
||||
return val.select(
|
||||
Literal(0).as_('create_uid'),
|
||||
CurrentTimestamp().as_('create_date'),
|
||||
Literal(None).as_('write_uid'),
|
||||
Literal(None).as_('write_date'),
|
||||
d.id.as_('id'),
|
||||
d.id.as_('derivative'),
|
||||
d.trade_date.as_('trade_date'),
|
||||
d.maturity_date.as_('maturity_date'),
|
||||
d.product.as_('product'),
|
||||
d.party.as_('party'),
|
||||
d.purchase.as_('purchase'),
|
||||
d.line.as_('purchase_line'),
|
||||
d.sale.as_('sale'),
|
||||
d.sale_line.as_('sale_line'),
|
||||
d.price_index.as_('price_index'),
|
||||
d.direction.as_('direction'),
|
||||
d.state.as_('state'),
|
||||
d.nb_ct.as_('contract_count'),
|
||||
d.open_qty.as_('open_qty'),
|
||||
d.price.as_('entry_price'),
|
||||
d.exit_price.as_('exit_price'),
|
||||
val.id.as_('id'),
|
||||
val.date.as_('valuation_date'),
|
||||
val.purchase.as_('purchase'),
|
||||
val.line.as_('purchase_line'),
|
||||
val.sale.as_('sale'),
|
||||
val.sale_line.as_('sale_line'),
|
||||
val.reference.as_('reference'),
|
||||
val.counterparty.as_('counterparty'),
|
||||
val.product.as_('product'),
|
||||
val.state.as_('state'),
|
||||
val.price.as_('price'),
|
||||
val.currency.as_('currency'),
|
||||
val.quantity.as_('quantity'),
|
||||
val.unit.as_('unit'),
|
||||
val.amount.as_('amount'),
|
||||
val.base_amount.as_('base_amount'),
|
||||
val.mtm_price.as_('mtm_price'),
|
||||
val.mtm.as_('mtm'),
|
||||
val.strategy.as_('strategy'),
|
||||
where=where)
|
||||
|
||||
|
||||
class CTRMNetPositionContext(
|
||||
CTRMValuationContextMixin, ModelView):
|
||||
"CTRM Net Position Context"
|
||||
__name__ = 'ctrm.reporting.position.net.context'
|
||||
|
||||
|
||||
class CTRMNetPosition(ModelSQL, ModelView):
|
||||
"CTRM Net Position"
|
||||
__name__ = 'ctrm.reporting.position.net'
|
||||
|
||||
valuation_date = fields.Date("Valuation Date")
|
||||
product = fields.Many2One('product.product', "Product")
|
||||
counterparty = fields.Many2One('party.party', "Counterparty")
|
||||
currency = fields.Many2One('currency.currency', "Currency")
|
||||
unit = fields.Many2One('product.uom', "Unit")
|
||||
state = fields.Char("State")
|
||||
strategy = fields.Many2One('mtm.strategy', "Strategy")
|
||||
physical_quantity = fields.Numeric(
|
||||
"Physical Quantity", digits=(16, 5))
|
||||
derivative_quantity = fields.Numeric(
|
||||
"Derivative Quantity", digits=(16, 5))
|
||||
net_quantity = fields.Numeric("Net Quantity", digits=(16, 5))
|
||||
physical_amount = fields.Numeric("Physical Amount", digits=(16, 2))
|
||||
derivative_amount = fields.Numeric("Derivative Amount", digits=(16, 2))
|
||||
net_amount = fields.Numeric("Net Amount", digits=(16, 2))
|
||||
mtm = fields.Numeric("MTM", digits=(16, 2))
|
||||
|
||||
@classmethod
|
||||
def table_query(cls):
|
||||
ValuationLine = Pool().get('valuation.valuation.line')
|
||||
val = ValuationLine.__table__()
|
||||
|
||||
context = Transaction().context
|
||||
where = val.type.in_(
|
||||
PHYSICAL_VALUATION_TYPES + DERIVATIVE_VALUATION_TYPES)
|
||||
if context.get('date'):
|
||||
where &= val.date == context['date']
|
||||
if context.get('product'):
|
||||
where &= val.product == context['product']
|
||||
if context.get('counterparty'):
|
||||
where &= val.counterparty == context['counterparty']
|
||||
if context.get('currency'):
|
||||
where &= val.currency == context['currency']
|
||||
if context.get('purchase'):
|
||||
where &= val.purchase == context['purchase']
|
||||
if context.get('sale'):
|
||||
where &= val.sale == context['sale']
|
||||
if context.get('strategy'):
|
||||
where &= val.strategy == context['strategy']
|
||||
if context.get('state'):
|
||||
where &= val.state == context['state']
|
||||
|
||||
is_derivative = val.type.in_(DERIVATIVE_VALUATION_TYPES)
|
||||
physical_quantity = Case(
|
||||
(is_derivative, 0), else_=Coalesce(val.quantity, 0))
|
||||
derivative_quantity = Case(
|
||||
(is_derivative, Coalesce(val.quantity, 0)), else_=0)
|
||||
physical_amount = Case(
|
||||
(is_derivative, 0), else_=Coalesce(val.amount, 0))
|
||||
derivative_amount = Case(
|
||||
(is_derivative, Coalesce(val.amount, 0)), else_=0)
|
||||
|
||||
group_by = [
|
||||
val.date,
|
||||
val.product,
|
||||
val.counterparty,
|
||||
val.currency,
|
||||
val.unit,
|
||||
val.state,
|
||||
val.strategy,
|
||||
]
|
||||
|
||||
return val.select(
|
||||
Literal(0).as_('create_uid'),
|
||||
CurrentTimestamp().as_('create_date'),
|
||||
Literal(None).as_('write_uid'),
|
||||
Literal(None).as_('write_date'),
|
||||
Min(val.id).as_('id'),
|
||||
val.date.as_('valuation_date'),
|
||||
val.product.as_('product'),
|
||||
val.counterparty.as_('counterparty'),
|
||||
val.currency.as_('currency'),
|
||||
val.unit.as_('unit'),
|
||||
val.state.as_('state'),
|
||||
val.strategy.as_('strategy'),
|
||||
Sum(physical_quantity).as_('physical_quantity'),
|
||||
Sum(derivative_quantity).as_('derivative_quantity'),
|
||||
Sum(Coalesce(val.quantity, 0)).as_('net_quantity'),
|
||||
Sum(physical_amount).as_('physical_amount'),
|
||||
Sum(derivative_amount).as_('derivative_amount'),
|
||||
Sum(Coalesce(val.amount, 0)).as_('net_amount'),
|
||||
Sum(Coalesce(val.mtm, 0)).as_('mtm'),
|
||||
where=where,
|
||||
group_by=group_by)
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<field name="name">ctrm_position_physical_list</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window" id="act_ctrm_position_physical">
|
||||
<field name="name">1.1 Physical Position</field>
|
||||
<field name="name">Physical Position</field>
|
||||
<field name="res_model">ctrm.reporting.position.physical</field>
|
||||
<field name="context_model">ctrm.reporting.position.physical.context</field>
|
||||
</record>
|
||||
@@ -31,7 +31,7 @@
|
||||
<field name="name">ctrm_position_financial_list</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window" id="act_ctrm_position_financial">
|
||||
<field name="name">1.2 Financial Paper Position</field>
|
||||
<field name="name">Financial Position</field>
|
||||
<field name="res_model">ctrm.reporting.position.financial</field>
|
||||
<field name="context_model">ctrm.reporting.position.financial.context</field>
|
||||
</record>
|
||||
@@ -40,145 +40,166 @@
|
||||
<field name="view" ref="ctrm_position_financial_view_list"/>
|
||||
<field name="act_window" ref="act_ctrm_position_financial"/>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="ctrm_position_net_context_view_form">
|
||||
<field name="model">ctrm.reporting.position.net.context</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">ctrm_position_net_context_form</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="ctrm_position_net_view_list">
|
||||
<field name="model">ctrm.reporting.position.net</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="name">ctrm_position_net_list</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window" id="act_ctrm_position_net">
|
||||
<field name="name">Net Consolidated Position</field>
|
||||
<field name="res_model">ctrm.reporting.position.net</field>
|
||||
<field name="context_model">ctrm.reporting.position.net.context</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view" id="act_ctrm_position_net_view">
|
||||
<field name="sequence" eval="10"/>
|
||||
<field name="view" ref="ctrm_position_net_view_list"/>
|
||||
<field name="act_window" ref="act_ctrm_position_net"/>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
name="1. Positions"
|
||||
name="Positions"
|
||||
parent="purchase_trade.menu_global_reporting"
|
||||
sequence="10"
|
||||
id="menu_ctrm_positions"/>
|
||||
<menuitem
|
||||
name="1.1 Physical Position"
|
||||
name="Physical Position"
|
||||
parent="menu_ctrm_positions"
|
||||
sequence="10"
|
||||
action="act_ctrm_position_physical"
|
||||
id="menu_ctrm_position_physical"/>
|
||||
<menuitem
|
||||
name="1.2 Financial Paper Position"
|
||||
name="Financial Position"
|
||||
parent="menu_ctrm_positions"
|
||||
sequence="20"
|
||||
action="act_ctrm_position_financial"
|
||||
id="menu_ctrm_position_financial"/>
|
||||
<menuitem
|
||||
name="1.3 Net Consolidated Position"
|
||||
name="Net Consolidated Position"
|
||||
parent="menu_ctrm_positions"
|
||||
sequence="30"
|
||||
action="act_ctrm_position_net"
|
||||
id="menu_ctrm_position_net"/>
|
||||
<menuitem
|
||||
name="1.4 Hedge Coverage"
|
||||
name="Hedge Coverage"
|
||||
parent="menu_ctrm_positions"
|
||||
sequence="40"
|
||||
id="menu_ctrm_position_hedge"/>
|
||||
|
||||
<menuitem
|
||||
name="2. P&L"
|
||||
name="P&L"
|
||||
parent="purchase_trade.menu_global_reporting"
|
||||
sequence="20"
|
||||
id="menu_ctrm_pnl"/>
|
||||
<menuitem
|
||||
name="2.1 Realized P&L"
|
||||
name="Realized P&L"
|
||||
parent="menu_ctrm_pnl"
|
||||
sequence="10"
|
||||
id="menu_ctrm_pnl_realized"/>
|
||||
<menuitem
|
||||
name="2.2 Mark-to-Market"
|
||||
name="Mark-to-Market"
|
||||
parent="menu_ctrm_pnl"
|
||||
sequence="20"
|
||||
id="menu_ctrm_pnl_mtm"/>
|
||||
<menuitem
|
||||
name="2.3 P&L Explain"
|
||||
name="P&L Explain"
|
||||
parent="menu_ctrm_pnl"
|
||||
sequence="30"
|
||||
id="menu_ctrm_pnl_explain"/>
|
||||
<menuitem
|
||||
name="2.4 P&L by Dimension"
|
||||
name="P&L by Dimension"
|
||||
parent="menu_ctrm_pnl"
|
||||
sequence="40"
|
||||
id="menu_ctrm_pnl_dimension"/>
|
||||
|
||||
<menuitem
|
||||
name="3. Risk"
|
||||
name="Risk"
|
||||
parent="purchase_trade.menu_global_reporting"
|
||||
sequence="30"
|
||||
id="menu_ctrm_risk"/>
|
||||
<menuitem
|
||||
name="3.1 VaR"
|
||||
name="VaR"
|
||||
parent="menu_ctrm_risk"
|
||||
sequence="10"
|
||||
id="menu_ctrm_risk_var"/>
|
||||
<menuitem
|
||||
name="3.2 Stress Tests"
|
||||
name="Stress Tests"
|
||||
parent="menu_ctrm_risk"
|
||||
sequence="20"
|
||||
id="menu_ctrm_risk_stress"/>
|
||||
<menuitem
|
||||
name="3.3 Sensitivities"
|
||||
name="Sensitivities"
|
||||
parent="menu_ctrm_risk"
|
||||
sequence="30"
|
||||
id="menu_ctrm_risk_sensitivities"/>
|
||||
<menuitem
|
||||
name="3.4 Limit Monitoring"
|
||||
name="Limit Monitoring"
|
||||
parent="menu_ctrm_risk"
|
||||
sequence="40"
|
||||
id="menu_ctrm_risk_limits"/>
|
||||
<menuitem
|
||||
name="3.5 Credit Exposure"
|
||||
name="Credit Exposure"
|
||||
parent="menu_ctrm_risk"
|
||||
sequence="50"
|
||||
id="menu_ctrm_risk_credit"/>
|
||||
|
||||
<menuitem
|
||||
name="4. Operations & Logistics"
|
||||
name="Operations & Logistics"
|
||||
parent="purchase_trade.menu_global_reporting"
|
||||
sequence="40"
|
||||
id="menu_ctrm_operations"/>
|
||||
<menuitem
|
||||
name="4.1 Shipping Logistics"
|
||||
name="Shipping Logistics"
|
||||
parent="menu_ctrm_operations"
|
||||
sequence="10"
|
||||
id="menu_ctrm_operations_shipping"/>
|
||||
<menuitem
|
||||
name="4.2 Inventory"
|
||||
name="Inventory"
|
||||
parent="menu_ctrm_operations"
|
||||
sequence="20"
|
||||
id="menu_ctrm_operations_inventory"/>
|
||||
<menuitem
|
||||
name="4.3 Contract Performance"
|
||||
name="Contract Performance"
|
||||
parent="menu_ctrm_operations"
|
||||
sequence="30"
|
||||
id="menu_ctrm_operations_contract"/>
|
||||
<menuitem
|
||||
name="4.4 Scheduling"
|
||||
name="Scheduling"
|
||||
parent="menu_ctrm_operations"
|
||||
sequence="40"
|
||||
id="menu_ctrm_operations_scheduling"/>
|
||||
|
||||
<menuitem
|
||||
name="5. Finance & Accounting"
|
||||
name="Finance & Accounting"
|
||||
parent="purchase_trade.menu_global_reporting"
|
||||
sequence="50"
|
||||
id="menu_ctrm_finance"/>
|
||||
<menuitem
|
||||
name="5.1 Accruals"
|
||||
name="Accruals"
|
||||
parent="menu_ctrm_finance"
|
||||
sequence="10"
|
||||
id="menu_ctrm_finance_accruals"/>
|
||||
<menuitem
|
||||
name="5.2 Hedge Accounting"
|
||||
name="Hedge Accounting"
|
||||
parent="menu_ctrm_finance"
|
||||
sequence="20"
|
||||
id="menu_ctrm_finance_hedge_accounting"/>
|
||||
<menuitem
|
||||
name="5.3 Settlements and Invoicing"
|
||||
name="Settlements and Invoicing"
|
||||
parent="menu_ctrm_finance"
|
||||
sequence="30"
|
||||
id="menu_ctrm_finance_settlements"/>
|
||||
<menuitem
|
||||
name="5.4 Cash Flow Forecast"
|
||||
name="Cash Flow Forecast"
|
||||
parent="menu_ctrm_finance"
|
||||
sequence="40"
|
||||
id="menu_ctrm_finance_cash_flow"/>
|
||||
<menuitem
|
||||
name="5.5 GL Reconciliation"
|
||||
name="GL Reconciliation"
|
||||
parent="menu_ctrm_finance"
|
||||
sequence="50"
|
||||
id="menu_ctrm_finance_gl_reconciliation"/>
|
||||
|
||||
@@ -1,24 +1,18 @@
|
||||
<form>
|
||||
<label name="trade_from"/>
|
||||
<field name="trade_from"/>
|
||||
<label name="trade_to"/>
|
||||
<field name="trade_to"/>
|
||||
<label name="maturity_from"/>
|
||||
<field name="maturity_from"/>
|
||||
<label name="maturity_to"/>
|
||||
<field name="maturity_to"/>
|
||||
<label name="date"/>
|
||||
<field name="date"/>
|
||||
<label name="product"/>
|
||||
<field name="product"/>
|
||||
<label name="party"/>
|
||||
<field name="party"/>
|
||||
<label name="counterparty"/>
|
||||
<field name="counterparty"/>
|
||||
<label name="currency"/>
|
||||
<field name="currency"/>
|
||||
<label name="purchase"/>
|
||||
<field name="purchase"/>
|
||||
<label name="sale"/>
|
||||
<field name="sale"/>
|
||||
<label name="direction"/>
|
||||
<field name="direction"/>
|
||||
<label name="strategy"/>
|
||||
<field name="strategy"/>
|
||||
<label name="state"/>
|
||||
<field name="state"/>
|
||||
<label name="open_only"/>
|
||||
<field name="open_only"/>
|
||||
</form>
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
<tree>
|
||||
<field name="trade_date"/>
|
||||
<field name="maturity_date"/>
|
||||
<field name="product" width="140"/>
|
||||
<field name="party" width="120"/>
|
||||
<field name="valuation_date"/>
|
||||
<field name="purchase" width="100"/>
|
||||
<field name="purchase_line" width="120"/>
|
||||
<field name="sale" width="100"/>
|
||||
<field name="sale_line" width="120"/>
|
||||
<field name="price_index" width="120"/>
|
||||
<field name="direction"/>
|
||||
<field name="reference" width="120"/>
|
||||
<field name="counterparty" width="120"/>
|
||||
<field name="product" width="140"/>
|
||||
<field name="state"/>
|
||||
<field name="contract_count" sum="1"/>
|
||||
<field name="open_qty" sum="1"/>
|
||||
<field name="entry_price"/>
|
||||
<field name="exit_price"/>
|
||||
<field name="quantity" symbol="unit" sum="1"/>
|
||||
<field name="price"/>
|
||||
<field name="currency" width="60"/>
|
||||
<field name="amount" sum="1"/>
|
||||
<field name="base_amount" sum="1"/>
|
||||
<field name="mtm_price"/>
|
||||
<field name="mtm" sum="1"/>
|
||||
<field name="strategy"/>
|
||||
</tree>
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<form>
|
||||
<label name="date"/>
|
||||
<field name="date"/>
|
||||
<label name="product"/>
|
||||
<field name="product"/>
|
||||
<label name="counterparty"/>
|
||||
<field name="counterparty"/>
|
||||
<label name="currency"/>
|
||||
<field name="currency"/>
|
||||
<label name="purchase"/>
|
||||
<field name="purchase"/>
|
||||
<label name="sale"/>
|
||||
<field name="sale"/>
|
||||
<label name="strategy"/>
|
||||
<field name="strategy"/>
|
||||
<label name="state"/>
|
||||
<field name="state"/>
|
||||
</form>
|
||||
15
modules/purchase_trade/view/ctrm_position_net_list.xml
Normal file
15
modules/purchase_trade/view/ctrm_position_net_list.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<tree>
|
||||
<field name="valuation_date"/>
|
||||
<field name="product" width="140"/>
|
||||
<field name="counterparty" width="120"/>
|
||||
<field name="state"/>
|
||||
<field name="strategy"/>
|
||||
<field name="physical_quantity" symbol="unit" sum="1"/>
|
||||
<field name="derivative_quantity" symbol="unit" sum="1"/>
|
||||
<field name="net_quantity" symbol="unit" sum="1"/>
|
||||
<field name="currency" width="60"/>
|
||||
<field name="physical_amount" sum="1"/>
|
||||
<field name="derivative_amount" sum="1"/>
|
||||
<field name="net_amount" sum="1"/>
|
||||
<field name="mtm" sum="1"/>
|
||||
</tree>
|
||||
@@ -1,14 +1,18 @@
|
||||
<form>
|
||||
<label name="as_of"/>
|
||||
<field name="as_of"/>
|
||||
<label name="date"/>
|
||||
<field name="date"/>
|
||||
<label name="product"/>
|
||||
<field name="product"/>
|
||||
<label name="supplier"/>
|
||||
<field name="supplier"/>
|
||||
<label name="client"/>
|
||||
<field name="client"/>
|
||||
<label name="counterparty"/>
|
||||
<field name="counterparty"/>
|
||||
<label name="currency"/>
|
||||
<field name="currency"/>
|
||||
<label name="position_type"/>
|
||||
<field name="position_type"/>
|
||||
<label name="purchase"/>
|
||||
<field name="purchase"/>
|
||||
<label name="sale"/>
|
||||
<field name="sale"/>
|
||||
<label name="strategy"/>
|
||||
<field name="strategy"/>
|
||||
<label name="state"/>
|
||||
<field name="state"/>
|
||||
</form>
|
||||
|
||||
@@ -1,15 +1,21 @@
|
||||
<tree>
|
||||
<field name="valuation_date"/>
|
||||
<field name="lot" width="120"/>
|
||||
<field name="purchase" width="100"/>
|
||||
<field name="purchase_line" width="120"/>
|
||||
<field name="sale" width="100"/>
|
||||
<field name="sale_line" width="120"/>
|
||||
<field name="type"/>
|
||||
<field name="reference" width="120"/>
|
||||
<field name="counterparty" width="120"/>
|
||||
<field name="product" width="140"/>
|
||||
<field name="supplier" width="120"/>
|
||||
<field name="client" width="120"/>
|
||||
<field name="position_type" width="80"/>
|
||||
<field name="physical_qty" symbol="uom" sum="1"/>
|
||||
<field name="hedged_qty" symbol="uom" sum="1"/>
|
||||
<field name="net_exposure" symbol="uom" sum="1"/>
|
||||
<field name="state"/>
|
||||
<field name="quantity" symbol="unit" sum="1"/>
|
||||
<field name="price"/>
|
||||
<field name="currency" width="60"/>
|
||||
<field name="amount" sum="1"/>
|
||||
<field name="base_amount" sum="1"/>
|
||||
<field name="mtm_price"/>
|
||||
<field name="mtm" sum="1"/>
|
||||
<field name="pnl" sum="1"/>
|
||||
<field name="period_start"/>
|
||||
<field name="period_end"/>
|
||||
<field name="strategy"/>
|
||||
</tree>
|
||||
|
||||
24
notes/ctrm_reporting.md
Normal file
24
notes/ctrm_reporting.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# CTRM Reporting Notes
|
||||
|
||||
Date: 2026-05-24
|
||||
|
||||
## Source de reference
|
||||
|
||||
- Les rapports de position CTRM lisent `valuation.valuation.line`.
|
||||
- Cette table conserve la derniere valuation disponible pour les lots
|
||||
physiques, fees, derivatives et autres lignes de position.
|
||||
- Les lignes historiques restent dans `valuation.valuation`.
|
||||
- La valuation tourne toutes les nuits; elle est donc la meilleure source pour
|
||||
les reports de position operationnels.
|
||||
|
||||
## Architecture Global Reporting
|
||||
|
||||
- `Positions`
|
||||
- `Physical Position`
|
||||
- `Financial Position`
|
||||
- `Net Consolidated Position`
|
||||
- `Hedge Coverage`
|
||||
- `P&L`
|
||||
- `Risk`
|
||||
- `Operations & Logistics`
|
||||
- `Finance & Accounting`
|
||||
Reference in New Issue
Block a user