[FIX] website_sale: fix confirm and mark as paid SO buttons display

Various conditions were incorrectly computed and using states is not
always a good option when having also invisible attribute. Let us use
directly the invisible attribute and override it when necessary and
get rid of the magic of states.
This commit is contained in:
Mehul Patel
2017-07-14 12:28:46 +02:00
committed by Thibault Delavallée
parent 37dbca84e8
commit 0553206f69
2 changed files with 10 additions and 4 deletions
+6 -2
View File
@@ -157,8 +157,12 @@
<button name="action_quotation_send" string="Send by Email" type="object" states="draft" class="btn-primary"/>
<button name="action_quotation_send" type="object" string="Send PRO-FORMA Invoice" groups="sale.group_proforma_sales" class="btn-primary" attrs="{'invisible': ['|', ('state', 'in', ['sent', 'sale']), ('invoice_count','&gt;=',1)]}" context="{'proforma': True}"/>
<button name="print_quotation" string="Print" type="object" states="draft" class="btn-primary o_sale_print"/>
<button name="action_confirm" id="action_confirm" states="sent" string="Confirm Sale" class="btn-primary" type="object" />
<button name="action_confirm" states="draft" string="Confirm Sale" type="object" />
<button name="action_confirm" id="action_confirm"
string="Confirm Sale" class="btn-primary" type="object"
attrs="{'invisible': [('state', 'not in', ['sent'])]}"/>
<button name="action_confirm"
string="Confirm Sale" type="object"
attrs="{'invisible': [('state', 'not in', ['draft'])]}"/>
<button name="action_quotation_send" type="object" string="Send PRO-FORMA Invoice" groups="sale.group_proforma_sales" attrs="{'invisible': ['|', ('state', '=', 'draft'), ('invoice_count','&gt;=',1)]}" context="{'proforma': True}"/>
<button name="print_quotation" string="Print" type="object" states="sent,sale" class="o_sale_print"/>
<button name="action_quotation_send" string="Send by Email" type="object" states="sent,sale"/>
@@ -125,13 +125,15 @@
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//button[@name='action_quotation_send']" position="after">
<button name="action_mark_as_paid" type="object" string="Mark as Paid" states="sent,sale" class="btn-primary" attrs="{'invisible': [('can_directly_mark_as_paid', '=', False)]}"/>
<button name="action_mark_as_paid" type="object"
string="Mark as Paid" class="btn-primary"
attrs="{'invisible': ['|', ('can_directly_mark_as_paid', '=', False), ('state', 'not in', ['sent', 'sale'])]}"/>
</xpath>
<field name="partner_id" position="after">
<field name="can_directly_mark_as_paid" invisible="1"/>
</field>
<xpath expr="//button[@id='action_confirm']" position="attributes">
<attribute name="attrs">{'invisible': [('can_directly_mark_as_paid', '=', True)]}</attribute>
<attribute name="attrs">{'invisible': ['|',('can_directly_mark_as_paid', '=', True), ('state', 'not in', ['sent'])]}</attribute>
</xpath>
</field>
</record>