[IMP] sale: set IDs on elements for easier xpaths

Before this commit there were two buttons on this wizard with the same name 'create_invoices' that do different things. One creates the invoice and the other one creates and opens the invoices. By setting an unique ID on both buttons we can do a clean and easy xpath. Something like button[@id='create_invoice_open'] instead of having to use indexes or dangerous behaviours

closes odoo/odoo#44072

Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
This commit is contained in:
Yenthe666
2020-01-28 10:46:54 +00:00
parent 65fd8e4602
commit e93eaa8efa
@@ -15,7 +15,8 @@
attrs="{'invisible': [('count','&gt;',1)]}"/>
<field name="has_down_payments" invisible="1" />
<label for="deduct_down_payments" string="" attrs="{'invisible': ['|', ('has_down_payments', '=', False), ('advance_payment_method', '!=', 'delivered')]}"/>
<div attrs="{'invisible': ['|', ('has_down_payments', '=', False), ('advance_payment_method', '!=', 'delivered')]}">
<div attrs="{'invisible': ['|', ('has_down_payments', '=', False), ('advance_payment_method', '!=', 'delivered')]}"
id="down_payment_details">
<field name="deduct_down_payments" nolabel="1"/>
<label for="deduct_down_payments"/>
</div>
@@ -23,7 +24,8 @@
context="{'default_invoice_policy': 'order'}" class="oe_inline"
invisible="1"/>
<label for="amount" attrs="{'invisible': [('advance_payment_method', 'not in', ('fixed','percentage'))]}"/>
<div attrs="{'invisible': [('advance_payment_method', 'not in', ('fixed','percentage'))]}">
<div attrs="{'invisible': [('advance_payment_method', 'not in', ('fixed','percentage'))]}"
id="payment_method_details">
<field name="currency_id" invisible="1"/>
<field name="fixed_amount"
attrs="{'required': [('advance_payment_method', '=', 'fixed')], 'invisible': [('advance_payment_method', '!=','fixed')]}" class="oe_inline"/>
@@ -39,9 +41,9 @@
attrs="{'invisible': ['|', ('advance_payment_method', 'not in', ('fixed', 'percentage')), ('product_id', '!=', False)]}"/>
</group>
<footer>
<button name="create_invoices" string="Create and View Invoice" type="object"
<button name="create_invoices" id="create_invoice_open" string="Create and View Invoice" type="object"
context="{'open_invoices': True}" class="btn-primary"/>
<button name="create_invoices" string="Create Invoice" type="object"/>
<button name="create_invoices" id="create_invoice" string="Create Invoice" type="object"/>
<button string="Cancel" class="btn-secondary" special="cancel"/>
</footer>
</form>