nfu/sale_order_batch/views/sale_order_views.xml

54 lines
2.7 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_order_form" model="ir.ui.view">
<field name="name">sale.order.form.inherit.batch</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//button[@name='action_draft']" position="after">
<field name="batch_id" invisible="True"/>
<button
name="action_add_to_batch"
type="object"
string="Add to Batch"
data-hotkey="b"
attrs="{'invisible': ['|',('batch_id', '!=', False),('state','not in',['draft', 'sent'])]}"
/>
</xpath>
<xpath expr="//div[@name='button_box']" position="inside">
<button
class="oe_stat_button"
name="action_view_sale_order_batch"
type="object"
icon="fa-tasks"
attrs="{'invisible': [('batch_id', '=', False)]}"
>
<field name="batch_id" attrs="{'readonly': True}"/>
</button>
</xpath>
<xpath expr="//button[@name='action_confirm']" position="attributes">
<attribute
name="attrs"
>{'invisible': ['|',('batch_id','!=',False),('state', 'not in', ['sent'])]}</attribute>
</xpath>
<xpath expr="//button[@name='action_confirm'][2]" position="attributes">
<attribute
name="attrs"
>{'invisible': ['|',('batch_id','!=',False),('state', 'not in', ['draft'])]}</attribute>
</xpath>
</field>
</record>
<record id="view_order_list_inherit_batch" model="ir.ui.view">
<field name="name">sale.order.list.view.inherited</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_quotation_tree"/>
<field name="arch" type="xml">
<xpath expr="//tree" position="inside">
<header>
<button type="object" name="action_add_to_batch" string="Add to Batch"/>
</header>
</xpath>
</field>
</record>
</odoo>