flectra/addons/sales_discount/views/sale_view.xml
Chinmayi Vyas 310e414497 [ADD]empty group on customer invoice and sale order's form view to set left side block beside subtotal group
previously, difficult to set any fields to the left side of subtotal group in inherited views,
now use <xpath expr="//group[@name='left_panel']" position="inside"> to add fields.
2018-02-01 13:08:10 +05:30

34 lines
2.3 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<flectra>
<!-- Sale -->
<record model="ir.ui.view" id="inherit_view_order_form">
<field name="name">sale.order.inherit.form</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="priority" eval="20"/>
<field name="arch" type="xml">
<xpath expr="//button[@name='action_view_invoice']" position="replace">
<button name="action_view_invoice"
type="object"
class="oe_stat_button"
icon="fa-pencil-square-o"
context="{'default_discount_method': discount_method, 'default_discount_amount': discount_amount, 'default_discount': discount,'default_discount_per': discount_per, 'var_for_default_get': True}"
attrs="{'invisible': [('invoice_count', '=', 0)]}">
<field name="invoice_count" widget="statinfo" string="Invoices"/>
</button>
</xpath>
<xpath expr="//group[@name='left_panel']" position="inside">
<separator string="Discount"/>
<field name="discount_method" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
<field name="discount_amount" attrs="{'invisible': [('discount_method', '=', 'per')], 'readonly': ['|', ('state', '!=', 'draft'), ('discount_method', '=', False)]}"/>
<field name="discount_per" attrs="{'invisible': ['|', ('discount_method', '=', 'fixed'), ('discount_method', '=', False)], 'readonly': [('state', '!=', 'draft')]}"/>
<button name="calculate_discount" type="object" class="oe_edit_only oe_link" string="(Update Discount)" attrs="{'invisible': [('discount_method', '=', False)]}" confirm="If you want to apply global discount other discount methods will be reset."/>
</xpath>
<xpath expr="//group[@name='sale_total']/field[@name='amount_untaxed']" position="before">
<field name="gross_amount" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="discount" string="Discount" widget="monetary" options="{'currency_field': 'currency_id'}"/>
</xpath>
</field>
</record>
</flectra>