Charter party
This commit is contained in:
@@ -90,10 +90,14 @@ def register():
|
||||
ctrm_reporting.CTRMCashFlowContext,
|
||||
ctrm_reporting.CTRMGLReconciliation,
|
||||
ctrm_reporting.CTRMGLReconciliationContext,
|
||||
stock.CharterRateType,
|
||||
stock.CharterConditionRate,
|
||||
stock.CharterCondition,
|
||||
stock.CharterParty,
|
||||
configuration.Configuration,
|
||||
pricing.ImportPricesStart,
|
||||
pricing.ImportPricesResult,
|
||||
module='purchase_trade', type_='model')
|
||||
pricing.ImportPricesStart,
|
||||
pricing.ImportPricesResult,
|
||||
module='purchase_trade', type_='model')
|
||||
Pool.register(
|
||||
incoming.ImportSwift,
|
||||
incoming.PrepareDocuments,
|
||||
|
||||
@@ -256,13 +256,15 @@ class PurchaseCrop(ModelSQL,ModelView):
|
||||
__name__ = 'purchase.crop'
|
||||
name = fields.Char("Name")
|
||||
|
||||
class Purchase(metaclass=PoolMeta):
|
||||
__name__ = 'purchase.purchase'
|
||||
|
||||
btb = fields.Many2One('back.to.back',"Back to back")
|
||||
bank_accounts = fields.Function(
|
||||
fields.Many2Many('bank.account', None, None, "Bank Accounts"),
|
||||
'on_change_with_bank_accounts')
|
||||
class Purchase(metaclass=PoolMeta):
|
||||
__name__ = 'purchase.purchase'
|
||||
|
||||
btb = fields.Many2One('back.to.back',"Back to back")
|
||||
charter_conditions = fields.One2Many(
|
||||
'charter.condition', 'purchase', "Charter Conditions")
|
||||
bank_accounts = fields.Function(
|
||||
fields.Many2Many('bank.account', None, None, "Bank Accounts"),
|
||||
'on_change_with_bank_accounts')
|
||||
bank_account = fields.Many2One(
|
||||
'bank.account', "Bank Account",
|
||||
domain=[('id', 'in', Eval('bank_accounts', []))],
|
||||
@@ -1409,7 +1411,9 @@ class Line(metaclass=PoolMeta):
|
||||
price_summary = fields.One2Many('purchase.pricing.summary','line',"Summary")
|
||||
premium_decomposition = fields.One2Many(
|
||||
'premium.composition', 'line', "Premium decomposition")
|
||||
estimated_date = fields.One2Many('pricing.estimated','line',"Estimated date")
|
||||
charter_conditions = fields.One2Many(
|
||||
'charter.condition', 'purchase_line', "Charter Conditions")
|
||||
estimated_date = fields.One2Many('pricing.estimated','line',"Estimated date")
|
||||
optional = fields.One2Many('optional.scenario','line',"Optionals Scenarios")
|
||||
lots = fields.One2Many('lot.lot','line',"Lots",readonly=True)
|
||||
purchase_line = fields.Many2One('purchase.line',"Lines")
|
||||
@@ -1459,7 +1463,7 @@ class Line(metaclass=PoolMeta):
|
||||
'required': Eval('enable_linked_currency'),
|
||||
}, depends=['enable_linked_currency'])
|
||||
premium = fields.Function(
|
||||
fields.Numeric("Premium/Discount",digits='unit'),
|
||||
fields.Numeric("Premium/Discount", digits='unit', readonly=True),
|
||||
'get_premium', setter='set_premium')
|
||||
fee_ = fields.Many2One('fee.fee',"Fee")
|
||||
pricing_rule = fields.Text("Pricing description")
|
||||
@@ -1726,6 +1730,12 @@ class Line(metaclass=PoolMeta):
|
||||
else premium.get_base_amount('base_amount') or 0))
|
||||
for premium in (self.premium_decomposition or [])), 4)
|
||||
|
||||
def get_effective_charter_conditions(self):
|
||||
if self.charter_conditions:
|
||||
return list(self.charter_conditions)
|
||||
purchase = getattr(self, 'purchase', None)
|
||||
return list(getattr(purchase, 'charter_conditions', None) or [])
|
||||
|
||||
@classmethod
|
||||
def set_premium(cls, lines, name, value):
|
||||
Premium = Pool().get('premium.composition')
|
||||
|
||||
@@ -225,6 +225,8 @@ class Sale(metaclass=PoolMeta):
|
||||
__name__ = 'sale.sale'
|
||||
|
||||
btb = fields.Many2One('back.to.back',"Back to back")
|
||||
charter_conditions = fields.One2Many(
|
||||
'charter.condition', 'sale', "Charter Conditions")
|
||||
bank_accounts = fields.Function(
|
||||
fields.Many2Many('bank.account', None, None, "Bank Accounts"),
|
||||
'on_change_with_bank_accounts')
|
||||
@@ -1455,6 +1457,8 @@ class SaleLine(metaclass=PoolMeta):
|
||||
price_summary = fields.One2Many('sale.pricing.summary','sale_line',"Summary")
|
||||
premium_decomposition = fields.One2Many(
|
||||
'premium.composition', 'sale_line', "Premium decomposition")
|
||||
charter_conditions = fields.One2Many(
|
||||
'charter.condition', 'sale_line', "Charter Conditions")
|
||||
estimated_date = fields.One2Many('pricing.estimated','sale_line',"Estimated date")
|
||||
tol_min = fields.Numeric("Tol - in %",states={
|
||||
'readonly': (Eval('inherit_tol')),
|
||||
@@ -1499,7 +1503,7 @@ class SaleLine(metaclass=PoolMeta):
|
||||
'required': Eval('enable_linked_currency'),
|
||||
}, depends=['enable_linked_currency'])
|
||||
premium = fields.Function(
|
||||
fields.Numeric("Premium/Discount",digits='unit'),
|
||||
fields.Numeric("Premium/Discount", digits='unit', readonly=True),
|
||||
'get_premium', setter='set_premium')
|
||||
fee_ = fields.Many2One('fee.fee',"Fee")
|
||||
|
||||
@@ -1775,6 +1779,12 @@ class SaleLine(metaclass=PoolMeta):
|
||||
else premium.get_base_amount('base_amount') or 0))
|
||||
for premium in (self.premium_decomposition or [])), 4)
|
||||
|
||||
def get_effective_charter_conditions(self):
|
||||
if self.charter_conditions:
|
||||
return list(self.charter_conditions)
|
||||
sale = getattr(self, 'sale', None)
|
||||
return list(getattr(sale, 'charter_conditions', None) or [])
|
||||
|
||||
@classmethod
|
||||
def set_premium(cls, lines, name, value):
|
||||
Premium = Pool().get('premium.composition')
|
||||
|
||||
@@ -394,12 +394,203 @@ class ShipmentContainer(ModelSQL, ModelView):
|
||||
seal_no = fields.Char('Seal Number')
|
||||
is_reefer = fields.Boolean('Reefer')
|
||||
|
||||
class ShipmentWR(ModelSQL,ModelView):
|
||||
"Shipment WR"
|
||||
__name__ = "shipment.wr"
|
||||
shipment_in = fields.Many2One('stock.shipment.in',"Shipment In")
|
||||
wr = fields.Many2One('weight.report',"WR")
|
||||
|
||||
class ShipmentWR(ModelSQL,ModelView):
|
||||
"Shipment WR"
|
||||
__name__ = "shipment.wr"
|
||||
shipment_in = fields.Many2One('stock.shipment.in',"Shipment In")
|
||||
wr = fields.Many2One('weight.report',"WR")
|
||||
|
||||
|
||||
RATE_BASIS = [
|
||||
(None, ''),
|
||||
('per_day', 'Per Day'),
|
||||
('per_hour', 'Per Hour'),
|
||||
('per_mt', 'Per MT'),
|
||||
('per_wmt', 'Per WMT'),
|
||||
('per_dmt', 'Per DMT'),
|
||||
('per_cbm', 'Per CBM'),
|
||||
('per_lot', 'Per Lot'),
|
||||
('lumpsum', 'Lumpsum'),
|
||||
('percent', 'Percent'),
|
||||
('other', 'Other'),
|
||||
]
|
||||
|
||||
|
||||
class CharterRateType(ModelSQL, ModelView):
|
||||
"Charter Rate Type"
|
||||
__name__ = 'charter.rate.type'
|
||||
|
||||
name = fields.Char("Name", required=True)
|
||||
code = fields.Char("Code")
|
||||
category = fields.Selection([
|
||||
(None, ''),
|
||||
('demurrage', 'Demurrage'),
|
||||
('despatch', 'Despatch'),
|
||||
('pumping', 'Pumping'),
|
||||
('freight', 'Freight'),
|
||||
('detention', 'Detention'),
|
||||
('waiting', 'Waiting'),
|
||||
('shifting', 'Shifting'),
|
||||
('heating', 'Heating'),
|
||||
('cleaning', 'Cleaning'),
|
||||
('bunker', 'Bunker'),
|
||||
('port_cost', 'Port Cost'),
|
||||
('other', 'Other'),
|
||||
], "Category")
|
||||
default_basis = fields.Selection(RATE_BASIS, "Default Basis")
|
||||
active = fields.Boolean("Active")
|
||||
|
||||
@staticmethod
|
||||
def default_active():
|
||||
return True
|
||||
|
||||
|
||||
class CharterConditionRate(ModelSQL, ModelView):
|
||||
"Charter Condition Rate"
|
||||
__name__ = 'charter.condition.rate'
|
||||
|
||||
condition = fields.Many2One(
|
||||
'charter.condition', "Condition", required=True, ondelete='CASCADE')
|
||||
rate_type = fields.Many2One('charter.rate.type', "Type")
|
||||
description = fields.Char("Description")
|
||||
rate = fields.Numeric("Rate", digits=(16, 6))
|
||||
currency = fields.Many2One('currency.currency', "Curr.")
|
||||
basis = fields.Selection(RATE_BASIS, "Basis")
|
||||
applies_to = fields.Selection([
|
||||
(None, ''),
|
||||
('load', 'Load'),
|
||||
('discharge', 'Discharge'),
|
||||
('both', 'Both'),
|
||||
('waiting', 'Waiting'),
|
||||
('pumping', 'Pumping'),
|
||||
('shifting', 'Shifting'),
|
||||
('voyage', 'Voyage'),
|
||||
('other', 'Other'),
|
||||
], "Applies To")
|
||||
minimum = fields.Numeric("Min", digits=(16, 6))
|
||||
maximum = fields.Numeric("Max", digits=(16, 6))
|
||||
reference = fields.Text("Reference")
|
||||
|
||||
@fields.depends('rate_type')
|
||||
def on_change_rate_type(self):
|
||||
if self.rate_type and self.rate_type.default_basis:
|
||||
self.basis = self.rate_type.default_basis
|
||||
|
||||
|
||||
class CharterCondition(ModelSQL, ModelView):
|
||||
"Charter Condition"
|
||||
__name__ = 'charter.condition'
|
||||
|
||||
name = fields.Char("Name")
|
||||
charter_party = fields.Many2One(
|
||||
'stock.charter.party', "Charter Party", ondelete='CASCADE')
|
||||
purchase = fields.Many2One(
|
||||
'purchase.purchase', "Purchase", ondelete='CASCADE')
|
||||
purchase_line = fields.Many2One(
|
||||
'purchase.line', "Purchase Line", ondelete='CASCADE')
|
||||
sale = fields.Many2One(
|
||||
'sale.sale', "Sale", ondelete='CASCADE')
|
||||
sale_line = fields.Many2One(
|
||||
'sale.line', "Sale Line", ondelete='CASCADE')
|
||||
party = fields.Many2One('party.party', "Party")
|
||||
party_role = fields.Selection([
|
||||
(None, ''),
|
||||
('owner', 'Owner'),
|
||||
('charterer', 'Charterer'),
|
||||
('supplier', 'Supplier'),
|
||||
('customer', 'Customer'),
|
||||
('broker', 'Broker'),
|
||||
('agent', 'Agent'),
|
||||
('terminal', 'Terminal'),
|
||||
('other', 'Other'),
|
||||
], "Party Role")
|
||||
responsibility = fields.Selection([
|
||||
(None, ''),
|
||||
('ours', 'Ours'),
|
||||
('counterparty', 'Counterparty'),
|
||||
('shared', 'Shared'),
|
||||
('pass_through', 'Pass-through'),
|
||||
('owner', 'Owner'),
|
||||
('charterer', 'Charterer'),
|
||||
], "Responsibility")
|
||||
laytime_clause = fields.Text("Laytime Clause")
|
||||
laytime_allowed = fields.Numeric("Laytime Allowed", digits=(16, 4))
|
||||
laytime_unit = fields.Selection([
|
||||
(None, ''),
|
||||
('hours', 'Hours'),
|
||||
('days', 'Days'),
|
||||
('wwd', 'Weather Working Days'),
|
||||
('wwd_shex', 'WWD SHEX'),
|
||||
('wwd_shinc', 'WWD SHINC'),
|
||||
('running_hours', 'Running Hours'),
|
||||
], "Laytime Unit")
|
||||
laytime_start = fields.Text("Laytime Start")
|
||||
laytime_end = fields.Text("Laytime End")
|
||||
nor_clause = fields.Text("NOR Clause")
|
||||
turn_time = fields.Numeric("Turn Time", digits=(16, 4))
|
||||
turn_time_unit = fields.Selection([
|
||||
(None, ''),
|
||||
('hours', 'Hours'),
|
||||
('days', 'Days'),
|
||||
], "Turn Time Unit")
|
||||
reversible = fields.Boolean("Reversible Laytime")
|
||||
all_time_saved = fields.Boolean("All Time Saved")
|
||||
demurrage_clause = fields.Text("Demurrage Clause")
|
||||
despatch_clause = fields.Text("Despatch Clause")
|
||||
exceptions = fields.Text("Exceptions")
|
||||
remarks = fields.Text("Remarks")
|
||||
rates = fields.One2Many(
|
||||
'charter.condition.rate', 'condition', "Rates")
|
||||
|
||||
@staticmethod
|
||||
def default_reversible():
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
def default_all_time_saved():
|
||||
return False
|
||||
|
||||
|
||||
class CharterParty(ModelSQL, ModelView):
|
||||
"Charter Party"
|
||||
__name__ = 'stock.charter.party'
|
||||
|
||||
name = fields.Char("Name", required=True)
|
||||
reference = fields.Char("Reference")
|
||||
active = fields.Boolean("Active")
|
||||
company = fields.Many2One('company.company', "Company")
|
||||
charter_type = fields.Selection([
|
||||
(None, ''),
|
||||
('voyage', 'Voyage Charter'),
|
||||
('time', 'Time Charter'),
|
||||
('coa', 'Contract of Affreightment'),
|
||||
('bareboat', 'Bareboat Charter'),
|
||||
], "Charter Type", required=True)
|
||||
owner = fields.Many2One('party.party', "Owner")
|
||||
charterer = fields.Many2One('party.party', "Charterer")
|
||||
broker = fields.Many2One('party.party', "Broker")
|
||||
vessel = fields.Many2One('trade.vessel', "Vessel")
|
||||
product = fields.Many2One('product.product', "Product")
|
||||
load_port = fields.Many2One('stock.location', "Load Port")
|
||||
discharge_port = fields.Many2One('stock.location', "Discharge Port")
|
||||
from_location = fields.Many2One('stock.location', "From Location")
|
||||
to_location = fields.Many2One('stock.location', "To Location")
|
||||
laycan_from = fields.Date("Laycan From")
|
||||
laycan_to = fields.Date("Laycan To")
|
||||
contract_date = fields.Date("Contract Date")
|
||||
currency = fields.Many2One('currency.currency', "Currency")
|
||||
governing_law = fields.Char("Governing Law")
|
||||
jurisdiction = fields.Char("Jurisdiction")
|
||||
document = fields.Many2One('document.incoming', "Document")
|
||||
notes = fields.Text("Notes")
|
||||
conditions = fields.One2Many(
|
||||
'charter.condition', 'charter_party', "Conditions")
|
||||
|
||||
@staticmethod
|
||||
def default_active():
|
||||
return True
|
||||
|
||||
|
||||
class ShipmentIn(metaclass=PoolMeta):
|
||||
__name__ = 'stock.shipment.in'
|
||||
|
||||
@@ -436,8 +627,9 @@ class ShipmentIn(metaclass=PoolMeta):
|
||||
ref = fields.Char("Our reference")
|
||||
note = fields.Text("Notes")
|
||||
dashboard = fields.Many2One('purchase.dashboard',"Dashboard")
|
||||
himself = fields.Function(fields.Many2One('stock.shipment.in',"Shipment"),'get_sh')
|
||||
sof = fields.One2Many('sof.statement', 'shipment',"Demurrage calculations")
|
||||
himself = fields.Function(fields.Many2One('stock.shipment.in',"Shipment"),'get_sh')
|
||||
charter_party = fields.Many2One('stock.charter.party', "Charter Party")
|
||||
sof = fields.One2Many('sof.statement', 'shipment',"Demurrage calculations")
|
||||
del_from = fields.Date("Delivery period from")
|
||||
del_to = fields.Date("to")
|
||||
estimated_date = fields.One2Many('pricing.estimated','shipment_in',"Estimated date")
|
||||
|
||||
@@ -51,7 +51,148 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name">shipment_wr_tree</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.action.wizard" id="act_vf">
|
||||
<record model="ir.ui.view" id="charter_rate_type_view_tree">
|
||||
<field name="model">charter.rate.type</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="name">charter_rate_type_tree</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="charter_rate_type_view_form">
|
||||
<field name="model">charter.rate.type</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">charter_rate_type_form</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="charter_condition_rate_view_tree">
|
||||
<field name="model">charter.condition.rate</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="name">charter_condition_rate_tree</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="charter_condition_rate_view_form">
|
||||
<field name="model">charter.condition.rate</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">charter_condition_rate_form</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="charter_condition_view_tree">
|
||||
<field name="model">charter.condition</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="name">charter_condition_tree</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="charter_condition_view_form">
|
||||
<field name="model">charter.condition</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">charter_condition_form</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="charter_party_view_tree">
|
||||
<field name="model">stock.charter.party</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="name">charter_party_tree</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="charter_party_view_form">
|
||||
<field name="model">stock.charter.party</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">charter_party_form</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.action.act_window" id="act_charter_party_form">
|
||||
<field name="name">Charter Party</field>
|
||||
<field name="res_model">stock.charter.party</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view" id="act_charter_party_form_view1">
|
||||
<field name="sequence" eval="10"/>
|
||||
<field name="view" ref="charter_party_view_tree"/>
|
||||
<field name="act_window" ref="act_charter_party_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view" id="act_charter_party_form_view2">
|
||||
<field name="sequence" eval="20"/>
|
||||
<field name="view" ref="charter_party_view_form"/>
|
||||
<field name="act_window" ref="act_charter_party_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window" id="act_charter_rate_type_form">
|
||||
<field name="name">Charter Rate Types</field>
|
||||
<field name="res_model">charter.rate.type</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view" id="act_charter_rate_type_form_view1">
|
||||
<field name="sequence" eval="10"/>
|
||||
<field name="view" ref="charter_rate_type_view_tree"/>
|
||||
<field name="act_window" ref="act_charter_rate_type_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view" id="act_charter_rate_type_form_view2">
|
||||
<field name="sequence" eval="20"/>
|
||||
<field name="view" ref="charter_rate_type_view_form"/>
|
||||
<field name="act_window" ref="act_charter_rate_type_form"/>
|
||||
</record>
|
||||
<menuitem
|
||||
parent="stock.menu_shipment"
|
||||
action="act_charter_party_form"
|
||||
sequence="70"
|
||||
id="menu_charter_party"/>
|
||||
<menuitem
|
||||
parent="menu_charter_party"
|
||||
action="act_charter_rate_type_form"
|
||||
sequence="10"
|
||||
id="menu_charter_rate_type"/>
|
||||
|
||||
<record model="ir.model.access" id="access_charter_party">
|
||||
<field name="model">stock.charter.party</field>
|
||||
<field name="perm_read" eval="True"/>
|
||||
<field name="perm_write" eval="True"/>
|
||||
<field name="perm_create" eval="True"/>
|
||||
<field name="perm_delete" eval="True"/>
|
||||
</record>
|
||||
<record model="ir.model.access" id="access_charter_rate_type">
|
||||
<field name="model">charter.rate.type</field>
|
||||
<field name="perm_read" eval="True"/>
|
||||
<field name="perm_write" eval="True"/>
|
||||
<field name="perm_create" eval="True"/>
|
||||
<field name="perm_delete" eval="True"/>
|
||||
</record>
|
||||
<record model="ir.model.access" id="access_charter_condition">
|
||||
<field name="model">charter.condition</field>
|
||||
<field name="perm_read" eval="True"/>
|
||||
<field name="perm_write" eval="True"/>
|
||||
<field name="perm_create" eval="True"/>
|
||||
<field name="perm_delete" eval="True"/>
|
||||
</record>
|
||||
<record model="ir.model.access" id="access_charter_condition_rate">
|
||||
<field name="model">charter.condition.rate</field>
|
||||
<field name="perm_read" eval="True"/>
|
||||
<field name="perm_write" eval="True"/>
|
||||
<field name="perm_create" eval="True"/>
|
||||
<field name="perm_delete" eval="True"/>
|
||||
</record>
|
||||
<record model="ir.model.access" id="access_charter_party_group">
|
||||
<field name="model">stock.charter.party</field>
|
||||
<field name="group" ref="purchase.group_purchase"/>
|
||||
<field name="perm_read" eval="True"/>
|
||||
<field name="perm_write" eval="True"/>
|
||||
<field name="perm_create" eval="True"/>
|
||||
<field name="perm_delete" eval="True"/>
|
||||
</record>
|
||||
<record model="ir.model.access" id="access_charter_rate_type_group">
|
||||
<field name="model">charter.rate.type</field>
|
||||
<field name="group" ref="purchase.group_purchase"/>
|
||||
<field name="perm_read" eval="True"/>
|
||||
<field name="perm_write" eval="True"/>
|
||||
<field name="perm_create" eval="True"/>
|
||||
<field name="perm_delete" eval="True"/>
|
||||
</record>
|
||||
<record model="ir.model.access" id="access_charter_condition_group">
|
||||
<field name="model">charter.condition</field>
|
||||
<field name="group" ref="purchase.group_purchase"/>
|
||||
<field name="perm_read" eval="True"/>
|
||||
<field name="perm_write" eval="True"/>
|
||||
<field name="perm_create" eval="True"/>
|
||||
<field name="perm_delete" eval="True"/>
|
||||
</record>
|
||||
<record model="ir.model.access" id="access_charter_condition_rate_group">
|
||||
<field name="model">charter.condition.rate</field>
|
||||
<field name="group" ref="purchase.group_purchase"/>
|
||||
<field name="perm_read" eval="True"/>
|
||||
<field name="perm_write" eval="True"/>
|
||||
<field name="perm_create" eval="True"/>
|
||||
<field name="perm_delete" eval="True"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.action.wizard" id="act_vf">
|
||||
<field name="name">🚢 Find vessel</field>
|
||||
<field name="wiz_name">stock.shipment.in.vf</field>
|
||||
<field name="model">stock.shipment.in</field>
|
||||
|
||||
@@ -103,6 +103,53 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
strategy.get_mtm(line, Decimal('3')),
|
||||
Decimal('225.00'))
|
||||
|
||||
@with_transaction()
|
||||
def test_purchase_line_charter_conditions_inherit_header_when_empty(self):
|
||||
'purchase line uses header charter conditions when it has no line terms'
|
||||
Line = Pool().get('purchase.line')
|
||||
line_condition = Mock(id=2)
|
||||
header_condition = Mock(id=1)
|
||||
line = Line()
|
||||
line.charter_conditions = []
|
||||
line.purchase = Mock(charter_conditions=[header_condition])
|
||||
|
||||
self.assertEqual(
|
||||
line.get_effective_charter_conditions(), [header_condition])
|
||||
|
||||
line.charter_conditions = [line_condition]
|
||||
|
||||
self.assertEqual(
|
||||
line.get_effective_charter_conditions(), [line_condition])
|
||||
|
||||
@with_transaction()
|
||||
def test_sale_line_charter_conditions_inherit_header_when_empty(self):
|
||||
'sale line uses header charter conditions when it has no line terms'
|
||||
Line = Pool().get('sale.line')
|
||||
line_condition = Mock(id=2)
|
||||
header_condition = Mock(id=1)
|
||||
line = Line()
|
||||
line.charter_conditions = []
|
||||
line.sale = Mock(charter_conditions=[header_condition])
|
||||
|
||||
self.assertEqual(
|
||||
line.get_effective_charter_conditions(), [header_condition])
|
||||
|
||||
line.charter_conditions = [line_condition]
|
||||
|
||||
self.assertEqual(
|
||||
line.get_effective_charter_conditions(), [line_condition])
|
||||
|
||||
@with_transaction()
|
||||
def test_charter_condition_rate_type_sets_default_basis(self):
|
||||
'charter condition rate copies the dynamic type default basis'
|
||||
Rate = Pool().get('charter.condition.rate')
|
||||
rate = Rate()
|
||||
rate.rate_type = Mock(default_basis='per_day')
|
||||
|
||||
rate.on_change_rate_type()
|
||||
|
||||
self.assertEqual(rate.basis, 'per_day')
|
||||
|
||||
@with_transaction()
|
||||
def test_add_physical_lot_defaults_hidden_premium_and_chunk_key(self):
|
||||
'add physical lot works when hidden tree fields are not loaded'
|
||||
@@ -2059,6 +2106,14 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
|
||||
self.assertEqual(line.get_premium('premium'), Decimal('10.2500'))
|
||||
|
||||
def test_purchase_and_sale_line_premium_fields_are_readonly_totals(self):
|
||||
'line premium fields are readonly totals from premium decomposition'
|
||||
PurchaseLine = Pool().get('purchase.line')
|
||||
SaleLine = Pool().get('sale.line')
|
||||
|
||||
self.assertTrue(PurchaseLine.premium.readonly)
|
||||
self.assertTrue(SaleLine.premium.readonly)
|
||||
|
||||
def test_premium_composition_base_amount_converts_on_contract_date(self):
|
||||
'premium composition base amount converts to contract currency at spot date'
|
||||
Premium = Pool().get('premium.composition')
|
||||
|
||||
50
modules/purchase_trade/view/charter_condition_form.xml
Normal file
50
modules/purchase_trade/view/charter_condition_form.xml
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0"?>
|
||||
<form>
|
||||
<notebook>
|
||||
<page string="General" col="4" id="general">
|
||||
<label name="name"/>
|
||||
<field name="name"/>
|
||||
<label name="party"/>
|
||||
<field name="party"/>
|
||||
<label name="party_role"/>
|
||||
<field name="party_role"/>
|
||||
<label name="responsibility"/>
|
||||
<field name="responsibility"/>
|
||||
<label name="laytime_allowed"/>
|
||||
<field name="laytime_allowed"/>
|
||||
<label name="laytime_unit"/>
|
||||
<field name="laytime_unit"/>
|
||||
<label name="turn_time"/>
|
||||
<field name="turn_time"/>
|
||||
<label name="turn_time_unit"/>
|
||||
<field name="turn_time_unit"/>
|
||||
<label name="reversible"/>
|
||||
<field name="reversible"/>
|
||||
<label name="all_time_saved"/>
|
||||
<field name="all_time_saved"/>
|
||||
</page>
|
||||
<page string="Laytime" col="4" id="laytime">
|
||||
<label name="laytime_clause"/>
|
||||
<field name="laytime_clause" colspan="3"/>
|
||||
<label name="laytime_start"/>
|
||||
<field name="laytime_start" colspan="3"/>
|
||||
<label name="laytime_end"/>
|
||||
<field name="laytime_end" colspan="3"/>
|
||||
<label name="nor_clause"/>
|
||||
<field name="nor_clause" colspan="3"/>
|
||||
</page>
|
||||
<page string="Clauses" col="4" id="clauses">
|
||||
<label name="demurrage_clause"/>
|
||||
<field name="demurrage_clause" colspan="3"/>
|
||||
<label name="despatch_clause"/>
|
||||
<field name="despatch_clause" colspan="3"/>
|
||||
<label name="exceptions"/>
|
||||
<field name="exceptions" colspan="3"/>
|
||||
<label name="remarks"/>
|
||||
<field name="remarks" colspan="3"/>
|
||||
</page>
|
||||
<page string="Rates" id="rates">
|
||||
<field name="rates" colspan="4" mode="tree,form" view_ids="purchase_trade.charter_condition_rate_view_tree,purchase_trade.charter_condition_rate_view_form"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
21
modules/purchase_trade/view/charter_condition_rate_form.xml
Normal file
21
modules/purchase_trade/view/charter_condition_rate_form.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0"?>
|
||||
<form>
|
||||
<label name="rate_type"/>
|
||||
<field name="rate_type"/>
|
||||
<label name="description"/>
|
||||
<field name="description"/>
|
||||
<label name="rate"/>
|
||||
<field name="rate"/>
|
||||
<label name="currency"/>
|
||||
<field name="currency"/>
|
||||
<label name="basis"/>
|
||||
<field name="basis"/>
|
||||
<label name="applies_to"/>
|
||||
<field name="applies_to"/>
|
||||
<label name="minimum"/>
|
||||
<field name="minimum"/>
|
||||
<label name="maximum"/>
|
||||
<field name="maximum"/>
|
||||
<label name="reference"/>
|
||||
<field name="reference" colspan="3"/>
|
||||
</form>
|
||||
11
modules/purchase_trade/view/charter_condition_rate_tree.xml
Normal file
11
modules/purchase_trade/view/charter_condition_rate_tree.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0"?>
|
||||
<tree editable="bottom">
|
||||
<field name="rate_type"/>
|
||||
<field name="description"/>
|
||||
<field name="rate"/>
|
||||
<field name="currency"/>
|
||||
<field name="basis"/>
|
||||
<field name="applies_to"/>
|
||||
<field name="minimum"/>
|
||||
<field name="maximum"/>
|
||||
</tree>
|
||||
9
modules/purchase_trade/view/charter_condition_tree.xml
Normal file
9
modules/purchase_trade/view/charter_condition_tree.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0"?>
|
||||
<tree>
|
||||
<field name="name"/>
|
||||
<field name="party"/>
|
||||
<field name="party_role"/>
|
||||
<field name="responsibility"/>
|
||||
<field name="laytime_allowed"/>
|
||||
<field name="laytime_unit"/>
|
||||
</tree>
|
||||
58
modules/purchase_trade/view/charter_party_form.xml
Normal file
58
modules/purchase_trade/view/charter_party_form.xml
Normal file
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0"?>
|
||||
<form>
|
||||
<label name="name"/>
|
||||
<field name="name"/>
|
||||
<label name="reference"/>
|
||||
<field name="reference"/>
|
||||
<label name="charter_type"/>
|
||||
<field name="charter_type"/>
|
||||
<label name="active"/>
|
||||
<field name="active"/>
|
||||
<notebook colspan="4">
|
||||
<page string="General" col="4" id="general">
|
||||
<label name="company"/>
|
||||
<field name="company"/>
|
||||
<label name="contract_date"/>
|
||||
<field name="contract_date"/>
|
||||
<label name="owner"/>
|
||||
<field name="owner"/>
|
||||
<label name="charterer"/>
|
||||
<field name="charterer"/>
|
||||
<label name="broker"/>
|
||||
<field name="broker"/>
|
||||
<label name="vessel"/>
|
||||
<field name="vessel"/>
|
||||
<label name="product"/>
|
||||
<field name="product"/>
|
||||
<label name="currency"/>
|
||||
<field name="currency"/>
|
||||
<label name="document"/>
|
||||
<field name="document"/>
|
||||
</page>
|
||||
<page string="Voyage" col="4" id="voyage">
|
||||
<label name="load_port"/>
|
||||
<field name="load_port"/>
|
||||
<label name="discharge_port"/>
|
||||
<field name="discharge_port"/>
|
||||
<label name="from_location"/>
|
||||
<field name="from_location"/>
|
||||
<label name="to_location"/>
|
||||
<field name="to_location"/>
|
||||
<label name="laycan_from"/>
|
||||
<field name="laycan_from"/>
|
||||
<label name="laycan_to"/>
|
||||
<field name="laycan_to"/>
|
||||
</page>
|
||||
<page string="Conditions" id="conditions">
|
||||
<field name="conditions" colspan="4" mode="tree,form" view_ids="purchase_trade.charter_condition_view_tree,purchase_trade.charter_condition_view_form"/>
|
||||
</page>
|
||||
<page string="Legal" col="4" id="legal">
|
||||
<label name="governing_law"/>
|
||||
<field name="governing_law"/>
|
||||
<label name="jurisdiction"/>
|
||||
<field name="jurisdiction"/>
|
||||
<label name="notes"/>
|
||||
<field name="notes" colspan="3"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
12
modules/purchase_trade/view/charter_party_tree.xml
Normal file
12
modules/purchase_trade/view/charter_party_tree.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0"?>
|
||||
<tree>
|
||||
<field name="name"/>
|
||||
<field name="reference"/>
|
||||
<field name="charter_type"/>
|
||||
<field name="owner"/>
|
||||
<field name="charterer"/>
|
||||
<field name="vessel"/>
|
||||
<field name="laycan_from"/>
|
||||
<field name="laycan_to"/>
|
||||
<field name="active"/>
|
||||
</tree>
|
||||
13
modules/purchase_trade/view/charter_rate_type_form.xml
Normal file
13
modules/purchase_trade/view/charter_rate_type_form.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0"?>
|
||||
<form>
|
||||
<label name="name"/>
|
||||
<field name="name"/>
|
||||
<label name="code"/>
|
||||
<field name="code"/>
|
||||
<label name="category"/>
|
||||
<field name="category"/>
|
||||
<label name="default_basis"/>
|
||||
<field name="default_basis"/>
|
||||
<label name="active"/>
|
||||
<field name="active"/>
|
||||
</form>
|
||||
8
modules/purchase_trade/view/charter_rate_type_tree.xml
Normal file
8
modules/purchase_trade/view/charter_rate_type_tree.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0"?>
|
||||
<tree>
|
||||
<field name="name"/>
|
||||
<field name="code"/>
|
||||
<field name="category"/>
|
||||
<field name="default_basis"/>
|
||||
<field name="active"/>
|
||||
</tree>
|
||||
@@ -55,6 +55,9 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="product_origin"/>
|
||||
</xpath>
|
||||
<xpath expr="/form/notebook/page[@id='purchase']" position="after">
|
||||
<page string="Charter Conditions" id="charter_conditions">
|
||||
<field name="charter_conditions" colspan="4" mode="tree,form" view_ids="purchase_trade.charter_condition_view_tree,purchase_trade.charter_condition_view_form"/>
|
||||
</page>
|
||||
<page string="Derivative" col="4" id="der">
|
||||
<field name="derivatives" mode="tree" view_ids="purchase_trade.derivative_view_tree_sequence" height="450"/>
|
||||
</page>
|
||||
|
||||
@@ -64,7 +64,15 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="tolerance_min" invisible="1" colspan="4"/>
|
||||
<field name="tolerance_max" invisible="1" colspan="4"/>
|
||||
</xpath>
|
||||
<xpath expr="/form/notebook/page[@id='taxes']" position="before">
|
||||
<xpath expr="/form/notebook/page[@id='general']" position="after">
|
||||
<page string="Premium composition" col="4" id="premium_composition">
|
||||
<field name="premium_decomposition" colspan="4" mode="tree,form" view_ids="purchase_trade.premium_composition_view_tree,purchase_trade.premium_composition_view_form"/>
|
||||
</page>
|
||||
<page string="Charter Conditions" id="charter_conditions">
|
||||
<field name="charter_conditions" colspan="4" mode="tree,form" view_ids="purchase_trade.charter_condition_view_tree,purchase_trade.charter_condition_view_form"/>
|
||||
</page>
|
||||
</xpath>
|
||||
<xpath expr="/form/notebook/page[@id='taxes']" position="before">
|
||||
<page string="Concentrate" col="4" id="co">
|
||||
<notebook colspan="4">
|
||||
<page string="Assays" col="4" id="as">
|
||||
@@ -90,9 +98,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<button name="apply_default_fees" icon="tryton-launch"/>
|
||||
<field name="fees" colspan="4" mode="tree,mode" view_ids="purchase_trade.fee_view_tree_sequence,purchase_trade.fee_view_form"/>
|
||||
</page>
|
||||
<page string="Premium composition" col="4" id="premium_composition">
|
||||
<field name="premium_decomposition" colspan="4" mode="tree,form" view_ids="purchase_trade.premium_composition_view_tree,purchase_trade.premium_composition_view_form"/>
|
||||
</page>
|
||||
<page string="Mtm" col="4" id="mtm">
|
||||
<field name="mtm" colspan="4"/>
|
||||
</page>
|
||||
|
||||
@@ -55,6 +55,9 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="product_origin"/>
|
||||
</xpath>
|
||||
<xpath expr="/form/notebook/page[@id='sale']" position="after">
|
||||
<page string="Charter Conditions" id="charter_conditions">
|
||||
<field name="charter_conditions" colspan="4" mode="tree,form" view_ids="purchase_trade.charter_condition_view_tree,purchase_trade.charter_condition_view_form"/>
|
||||
</page>
|
||||
<page string="Derivative" col="4" id="der">
|
||||
<field name="derivatives" mode="tree" view_ids="purchase_trade.derivative_view_tree_sequence" height="450"/>
|
||||
</page>
|
||||
|
||||
@@ -64,7 +64,15 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="tolerance_min" invisible="1" colspan="4"/>
|
||||
<field name="tolerance_max" invisible="1" colspan="4"/>
|
||||
</xpath>
|
||||
<xpath expr="/form/notebook/page[@id='taxes']" position="before">
|
||||
<xpath expr="/form/notebook/page[@id='general']" position="after">
|
||||
<page string="Premium composition" col="4" id="premium_composition">
|
||||
<field name="premium_decomposition" colspan="4" mode="tree,form" view_ids="purchase_trade.premium_composition_view_tree,purchase_trade.premium_composition_view_form"/>
|
||||
</page>
|
||||
<page string="Charter Conditions" id="charter_conditions">
|
||||
<field name="charter_conditions" colspan="4" mode="tree,form" view_ids="purchase_trade.charter_condition_view_tree,purchase_trade.charter_condition_view_form"/>
|
||||
</page>
|
||||
</xpath>
|
||||
<xpath expr="/form/notebook/page[@id='taxes']" position="before">
|
||||
<page string="Price composition" col="4" id="pc">
|
||||
<field name="price_composition" view_ids="purchase_trade.price_composition_view_tree"/>
|
||||
</page>
|
||||
@@ -75,9 +83,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<button name="apply_default_fees" icon="tryton-launch"/>
|
||||
<field name="fees" colspan="4" view_ids="purchase_trade.fee_view_tree_sequence"/>
|
||||
</page>
|
||||
<page string="Premium composition" col="4" id="premium_composition">
|
||||
<field name="premium_decomposition" colspan="4" mode="tree,form" view_ids="purchase_trade.premium_composition_view_tree,purchase_trade.premium_composition_view_form"/>
|
||||
</page>
|
||||
<page string="Mtm" col="4" id="mtm">
|
||||
<field name="mtm" colspan="4"/>
|
||||
</page>
|
||||
|
||||
@@ -108,6 +108,9 @@ this repository contains the full copyright notices and license terms. -->
|
||||
</xpath>
|
||||
<xpath expr="//page[@id='other']" position="before">
|
||||
<page string="Demurrage" col="4" id="sof">
|
||||
<label name="charter_party"/>
|
||||
<field name="charter_party"/>
|
||||
<newline/>
|
||||
<field name="sof" colspan="4" mode="form,tree" view_ids="purchase_trade.view_form_sof,purchase_trade.view_list_sof"/>
|
||||
<newline/>
|
||||
<button name="compute" string="compute"/>
|
||||
|
||||
Reference in New Issue
Block a user