[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.
This commit is contained in:
Chinmayi Vyas 2018-02-01 11:33:02 +05:30
parent 5dc9d9a6d6
commit 310e414497
4 changed files with 44 additions and 59 deletions

View File

@ -458,6 +458,10 @@
</templates> </templates>
</kanban> </kanban>
</field> </field>
<group>
<group name="left_panel">
</group>
<group class="oe_subtotal_footer oe_right"> <group class="oe_subtotal_footer oe_right">
<field name="amount_untaxed"/> <field name="amount_untaxed"/>
<field name="amount_tax"/> <field name="amount_tax"/>
@ -467,6 +471,7 @@
<field name="reconciled" invisible="1"/> <field name="reconciled" invisible="1"/>
<field name="outstanding_credits_debits_widget" colspan="2" nolabel="1" widget="payment" attrs="{'invisible': [('state', 'not in', 'open')]}"/> <field name="outstanding_credits_debits_widget" colspan="2" nolabel="1" widget="payment" attrs="{'invisible': [('state', 'not in', 'open')]}"/>
</group> </group>
</group>
<field name="comment" placeholder="Terms and conditions..."/> <field name="comment" placeholder="Terms and conditions..."/>
</page> </page>
<page string="Other Info" name="other_info"> <page string="Other Info" name="other_info">

View File

@ -7,31 +7,17 @@
<field name="inherit_id" ref="account.invoice_form"/> <field name="inherit_id" ref="account.invoice_form"/>
<field name="priority" eval="20"/> <field name="priority" eval="20"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="/form/sheet/notebook/page/group" position="replace"> <xpath expr="//group[@name='left_panel']" position="inside">
</xpath> <separator string="Discount"/>
<field name='comment' position="before">
<div>
<group>
<group class="pull-left">
<field name="discount_method" attrs="{'readonly': ['|', ('origin', '!=', False), ('state', '!=', 'draft')]}"/> <field name="discount_method" attrs="{'readonly': ['|', ('origin', '!=', False), ('state', '!=', 'draft')]}"/>
<field name="discount_amount" attrs="{'readonly': ['|', '|', ('origin', '!=', False), ('state', '!=', 'draft'), ('discount_method', '=', False)], 'invisible': [('discount_method', '=', 'per')]}"/> <field name="discount_amount" attrs="{'readonly': ['|', '|', ('origin', '!=', False), ('state', '!=', 'draft'), ('discount_method', '=', False)], 'invisible': [('discount_method', '=', 'per')]}"/>
<field name="discount_per" attrs="{'invisible': ['|', ('discount_method', '=', 'fixed'), ('discount_method', '=', False)], 'readonly': ['|', ('origin', '!=', False), ('state', '!=', 'draft')]}"/> <field name="discount_per" attrs="{'invisible': ['|', ('discount_method', '=', 'fixed'), ('discount_method', '=', False)], 'readonly': ['|', ('origin', '!=', False), ('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."/> <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."/>
</group> </xpath>
<group class="oe_subtotal_footer oe_right"> <xpath expr="//field[@name='amount_untaxed']" position="before">
<field name="gross_amount" widget="monetary" options="{'currency_field': 'currency_id'}"/> <field name="gross_amount" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="discount" string="Discount"/> <field name="discount" string="Discount"/>
<field name="amount_untaxed" string="Subtotal"/> </xpath>
<field name="amount_tax"/>
<field name="amount_total" class="oe_subtotal_footer_separator"/>
<field name="payments_widget" colspan="2" nolabel="1" widget="payment"/>
<field name="residual" class="oe_subtotal_footer_separator" attrs="{'invisible': [('state', '=', 'draft')]}"/>
<field name="reconciled" invisible="1"/>
<field name="outstanding_credits_debits_widget" colspan="2" nolabel="1" widget="payment" attrs="{'invisible': [('state', 'not in', 'open')]}"/>
</group>
</group>
</div>
</field>
</field> </field>
</record> </record>
</flectra> </flectra>

View File

@ -363,6 +363,10 @@
</templates> </templates>
</kanban> </kanban>
</field> </field>
<group>
<group name="left_panel">
</group>
<group class="oe_subtotal_footer oe_right" colspan="2" name="sale_total"> <group class="oe_subtotal_footer oe_right" colspan="2" name="sale_total">
<field name="amount_untaxed" widget='monetary' options="{'currency_field': 'currency_id'}"/> <field name="amount_untaxed" widget='monetary' options="{'currency_field': 'currency_id'}"/>
<field name="amount_tax" widget='monetary' options="{'currency_field': 'currency_id'}"/> <field name="amount_tax" widget='monetary' options="{'currency_field': 'currency_id'}"/>
@ -371,6 +375,7 @@
</div> </div>
<field name="amount_total" nolabel="1" class="oe_subtotal_footer_separator" widget='monetary' options="{'currency_field': 'currency_id'}"/> <field name="amount_total" nolabel="1" class="oe_subtotal_footer_separator" widget='monetary' options="{'currency_field': 'currency_id'}"/>
</group> </group>
</group>
<field name="note" class="oe_inline" placeholder="Setup default terms and conditions in your sales settings ..."/> <field name="note" class="oe_inline" placeholder="Setup default terms and conditions in your sales settings ..."/>
<div class="oe_clear"/> <div class="oe_clear"/>
</page> </page>

View File

@ -17,27 +17,16 @@
<field name="invoice_count" widget="statinfo" string="Invoices"/> <field name="invoice_count" widget="statinfo" string="Invoices"/>
</button> </button>
</xpath> </xpath>
<xpath expr="//group[@name='sale_total']" position="replace"> <xpath expr="//group[@name='left_panel']" position="inside">
<div> <separator string="Discount"/>
<group>
<group class="pull-left">
<field name="discount_method" attrs="{'readonly': [('state', '!=', 'draft')]}"/> <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_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')]}"/> <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."/> <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."/>
</group> </xpath>
<group class="oe_subtotal_footer oe_right" colspan="2" name="sale_total"> <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="gross_amount" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="discount" string="Discount" widget="monetary" options="{'currency_field': 'currency_id'}"/> <field name="discount" string="Discount" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="amount_untaxed" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="amount_tax" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<div class="oe_subtotal_footer_separator oe_inline o_td_label">
<label for="amount_total"/>
</div>
<field name="amount_total" nolabel="1" class="oe_subtotal_footer_separator" widget="monetary" options="{'currency_field': 'currency_id'}"/>
</group>
</group>
</div>
</xpath> </xpath>
</field> </field>
</record> </record>