[FIX] purchase: avoid workflow trigger infinite loop
[odoo/odoo.git] / addons / account_voucher / voucher_payment_receipt_view.xml
index dea94d5..1169d5e 100644 (file)
@@ -12,7 +12,7 @@
                     <filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
                     <filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
                     <field name="partner_id" string="Customer" filter_domain="[('partner_id','child_of',self)]"/>
-                    <field name="journal_id" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('bank','cash'))]"/>
+                    <field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('bank','cash'))]"/> <!-- Keep widget=selection on this field to pass numeric `self` value, which is not the case for regular m2o widgets! -->
                     <field name="period_id"/>
                     <group expand="0" string="Group By...">
                         <filter string="Customer" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
@@ -35,7 +35,7 @@
                     <filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
                     <filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
                     <field name="partner_id" string="Supplier" filter_domain="[('partner_id','child_of',self)]"/>
-                    <field name="journal_id" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('bank','cash'))]"/>
+                    <field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('bank','cash'))]"/> <!-- Keep widget=selection on this field to pass numeric `self` value, which is not the case for regular m2o widgets! -->
                     <field name="period_id"/>
                     <group expand="0" string="Group By...">
                         <filter string="Supplier" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
                     <group>
                         <group>
                                 <field name="writeoff_amount" widget="monetary" options="{'currency_field': 'currency_id'}"/>
-                                <field name="payment_option" required="1"/>
+                                <field name="payment_option" required="1" attrs="{'invisible':[('writeoff_amount','=',0)]}"/>
                                 <field name="writeoff_acc_id"
-                                        attrs="{'invisible':[('payment_option','!=','with_writeoff')], 'required':[('payment_option','=','with_writeoff')]}"
+                                        attrs="{'invisible':['|', ('payment_option','!=','with_writeoff'), ('writeoff_amount','=',0)], 'required':[('payment_option','=','with_writeoff')]}"
                                         domain="[('type','=','other')]"/>
                                 <field name="comment"
-                                        attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"/>
+                                        attrs="{'invisible':['|', ('payment_option','!=','with_writeoff'), ('writeoff_amount','=',0)]}"/>
                                 <field name="analytic_id"
-                                        groups="analytic.group_analytic_accounting"/>
+                                        groups="analytic.group_analytic_accounting"
+                                        attrs="{'invisible':['|', ('payment_option','!=','with_writeoff'), ('writeoff_amount','=',0)]}"/>
                             </group>
                             <group>
                         </group>
                                 </group>
                                 <group>
                                     <field name="writeoff_amount" widget="monetary" options="{'currency_field': 'currency_id'}"/>
-                                    <field name="payment_option" required="1"/>
+                                    <field name="payment_option" required="1" attrs="{'invisible':[('writeoff_amount','=',0)]}"/>
                                     <field name="writeoff_acc_id"
-                                           attrs="{'invisible':[('payment_option','!=','with_writeoff')], 'required':[('payment_option','=','with_writeoff')]}"
+                                           attrs="{'invisible':['|', ('payment_option','!=','with_writeoff'), ('writeoff_amount','=',0)], 'required':[('payment_option','=','with_writeoff')]}"
                                            domain="[('type','=','other')]"/>
                                     <field name="comment"
-                                           attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"/>
+                                           attrs="{'invisible':['|', ('payment_option','!=','with_writeoff'), ('writeoff_amount','=',0)]}"/>
                                     <field name="analytic_id"
-                                           groups="analytic.group_analytic_accounting"/>
+                                           groups="analytic.group_analytic_accounting"
+                                           attrs="{'invisible':['|', ('payment_option','!=','with_writeoff'), ('writeoff_amount','=',0)]}"/>
                                 </group>
                             </group>
                         </page>