[IMP] - Create contract on sale order confirmation

- On Sale Order confirmation, a contract is created for each contract template used on sale order lines
- A not finished contract can be mentioned on sale order line
- A sale order line linked to a contract will update it and don't create a new one if it had the same template
This commit is contained in:
sbejaoui
2018-11-02 14:34:05 +01:00
committed by Rad0van
parent 8b52763d8d
commit dc2b4aed7d
6 changed files with 206 additions and 81 deletions

View File

@@ -12,9 +12,27 @@
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<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"
attrs="{'invisible': [('is_contract', '=', False)]}"
domain="[('partner_id','=',parent.partner_id),('contract_template_id','=',contract_template_id)]"
/>
</xpath>
<xpath expr="//field[@name='order_line']/form//field[@name='tax_id']/parent::group"
position="after">
<separator colspan="4" string="Recurrence Invoicing"