Files
contract/product_contract/views/sale_order.xml
Stéphane Bidoul (ACSONE) 557097be2d [IMP] contract: support pre-paid for monthlylastday
monthlylastday is (almost) not a special case anymore \o/.
montlylastday is simply a montly period where the
periods are aligned on month boundaries.
The last bit of special casing is that postpaid generates
invoice the day after the last dasy of the period, except
for monthlylastday where the invoice is generated on the
last day of the period. This last exception will disappear
when we put the offset under user control.

This is a breaking change because the post-paid/pre-paid
mode becomes relevant for monthlylastday invoicing.
The field becomes visible in the UI. Code that generate
monthlylastday contract lines must now correctly set
the pre-paid/post-paid mode too. Some tests have had
to be adapted to reflect that.
2019-12-09 13:17:15 +01:00

86 lines
4.0 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018 ACSONE SA/NV.
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>
<record id="view_order_form" model="ir.ui.view">
<field name="name">sale.order.form (in product_contract)</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//header" position="inside">
<field name="need_contract_creation" invisible="1"/>
<button name="action_create_contract"
string="Create Contracts"
type="object"
class="oe_highlight" attrs="{'invisible': [('need_contract_creation', '=', False)]}"/>
</xpath>
<xpath expr="//div[@name='button_box']" position="inside">
<button name="action_show_contracts"
type="object" icon="fa-book"
class="oe_stat_button"
attrs="{'invisible': ['|', ('is_contract', '!=', True), ('state', 'not in', ['sale', 'done'])]}">
<field string="Contracts"
name="contract_count"
widget="statinfo"/>
</button>
</xpath>
<xpath expr="//field[@name='order_line']" position="before">
<field name="is_contract" invisible="1"/>
</xpath>
<xpath expr="//field[@name='order_line']/form//field[@name='product_id']"
position="after">
<field name="contract_template_id" invisible="1"/>
<field name="contract_id"
options='{"no_create": True}'
attrs="{'invisible': [('is_contract', '=', False)]}"
domain="['|',('contract_template_id','=',contract_template_id),
('contract_template_id','=',False),
('partner_id','=',parent.partner_id),
]"/>
<field name="contract_line_id"
attrs="{'invisible': [('is_contract', '=', False)]}"
domain="[('contract_id','=',contract_id)]"/>
</xpath>
<xpath expr="//field[@name='order_line']/form//field[@name='tax_id']/parent::group"
position="after">
<field name="is_contract" invisible="1"/>
<separator colspan="4" string="Recurrence Invoicing"
attrs="{'invisible': [('is_contract', '=', False)]}"/>
<group attrs="{'invisible': [('is_contract', '=', False)]}">
<field name="recurring_rule_type"/>
</group>
<group attrs="{'invisible': [('is_contract', '=', False)]}">
<field name="recurring_invoicing_type"/>
</group>
<group attrs="{'invisible': [('is_contract', '=', False)]}">
<field name="date_start"
attrs="{'required': [('is_contract', '=', True)]}"/>
</group>
<group attrs="{'invisible': [('is_contract', '=', False)]}">
<field name="date_end" attrs="{'required': [('is_contract', '=', True)]}"/>
</group>
</xpath>
<xpath expr="//field[@name='order_line']/tree//field[@name='price_total']"
position="after">
<field name="date_start"
attrs="{'column_invisible': [('parent.is_contract', '=', False)]}"/>
<field name="date_end"
attrs="{'column_invisible': [('parent.is_contract', '=', False)]}"/>
</xpath>
<xpath expr="//field[@name='order_line']/tree"
position="attributes">
<attribute name="editable"/>
</xpath>
</field>
</record>
</odoo>