[FIX] analytic_user_function - wrong override of domain for account_id
authoryvaucher-c2c <no_email@example.org>
Mon, 2 Sep 2013 13:17:21 +0000 (13:17 +0000)
committerStefan Rijnhart <stefan@therp.nl>
Wed, 2 Jul 2014 17:41:01 +0000 (19:41 +0200)
in timesheet lines

https://launchpad.net/bugs/1190259

addons/analytic_user_function/analytic_user_function_view.xml
addons/hr_timesheet/hr_timesheet_view.xml
addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml

index 69e1add..457d30d 100644 (file)
@@ -65,8 +65,8 @@
             <field name="priority" eval="18"/>
             <field name="inherit_id" ref="hr_timesheet_sheet.hr_timesheet_sheet_form"/>
             <field name="arch" type="xml">
-                <xpath expr="//field[@name='timesheet_ids']/tree/field[@name='account_id']" position="replace">
-                    <field name="account_id" domain="[('type','=','normal'),('state', '&lt;&gt;', 'close')]" on_change="on_change_account_id(account_id, user_id, unit_amount)"/>
+                <xpath expr="//field[@name='timesheet_ids']/tree/field[@name='account_id']" position="attributes">
+                    <attribute name="on_change">on_change_account_id(account_id, user_id, unit_amount)</attribute>
                 </xpath>
             </field>
         </record>
@@ -78,8 +78,8 @@
             <field name="priority" eval="19"/>
             <field name="inherit_id" ref="hr_timesheet_sheet.hr_timesheet_sheet_form"/>
             <field name="arch" type="xml">
-                <xpath expr="//field[@name='timesheet_ids']/form/field[@name='account_id']" position="replace">
-                    <field name="account_id" domain="[('type','=','normal'),('state', '&lt;&gt;', 'close')]" on_change="on_change_account_id(account_id, user_id, unit_amount)"/>
+                <xpath expr="//field[@name='timesheet_ids']/form/field[@name='account_id']" position="attributes">
+                    <attribute name="on_change">on_change_account_id(account_id, user_id, unit_amount)</attribute>
                 </xpath>
             </field>
         </record>
@@ -90,8 +90,8 @@
             <field name="model">hr.analytic.timesheet</field>
             <field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_form"/>
             <field name="arch" type="xml">
-                <xpath expr="//field[@name='account_id']" position="replace">
-                    <field name="account_id" domain="[('type','=','normal'),('state', '&lt;&gt;', 'close')]" on_change="on_change_account_id(account_id, user_id, unit_amount)" />
+                <xpath expr="//field[@name='account_id']" position="attributes">
+                    <attribute name="on_change">on_change_account_id(account_id, user_id, unit_amount)</attribute>
                 </xpath>
             </field>
         </record>
             <field name="model">hr.analytic.timesheet</field>
             <field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_tree"/>
             <field name="arch" type="xml">
-                <xpath expr="/tree/field[@name='account_id']" position="replace">
-                    <field name="account_id" domain="[('type','=','normal'),('state', '&lt;&gt;', 'close')]" on_change="on_change_account_id(account_id, user_id, unit_amount)" />
+                <xpath expr="/tree/field[@name='account_id']" position="attributes">
+                    <attribute name="on_change">on_change_account_id(account_id, user_id, unit_amount)</attribute>
                 </xpath>
             </field>
         </record>
index 21da4f2..d26dd8f 100644 (file)
@@ -10,7 +10,7 @@
                     <field name="date" on_change="on_change_date(date)"/>
                     <field name="user_id" on_change="on_change_user_id(user_id)" required="1" options='{"no_open": True}'/>
                     <field name="name"/>
-                    <field domain="[('type','=','normal'),('use_timesheets','=',1)]" name="account_id" context="{'default_use_timesheets': 1, 'default_type': 'contract'}"/>
+                    <field domain="[('type','in',['normal','contract']),('state', '&lt;&gt;', 'close'),('use_timesheets','=',1)]" name="account_id" context="{'default_use_timesheets': 1, 'default_type': 'contract'}"/>
                     <field name="unit_amount" string="Duration" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" sum="Total time" widget="float_time"/>
                     <field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" invisible="1"/>
                     <field name="journal_id" invisible="1"/>
@@ -47,7 +47,7 @@
                                 </div>
                             </group>
                             <group string="Accounting">
-                                <field domain="[('type','=','normal'),('state', '&lt;&gt;', 'close'),('parent_id','!=',False)]" name="account_id" select="1"/>
+                                <field domain="[('type','in',['normal','contract']),('state', '&lt;&gt;', 'close'),('use_timesheets','=',1)]" name="account_id" select="1" context="{'default_use_timesheets': 1, 'default_type': 'contract'}"/>
                                 <field name="amount"/>
                                 <field name="general_account_id"/>
                                 <field name="journal_id"/>
index 1b4f733..67f0b43 100644 (file)
                             <field context="{'employee_id': employee_id, 'user_id':user_id, 'timesheet_date_from': date_from, 'timesheet_date_to': date_to}" name="timesheet_ids" nolabel="1">
                                 <tree editable="top" string="Timesheet Activities">
                                     <field name="date"/>
-                                    <field domain="[('type','in',['normal', 'contract']), ('state', '&lt;&gt;', 'close'),('use_timesheets','=',1)]" name="account_id" on_change="on_change_account_id(account_id, user_id)" context="{'default_use_timesheets': 1}"/>
+                                    <field domain="[('type','in',['normal', 'contract']), ('state', '&lt;&gt;', 'close'), ('use_timesheets','=',1)]" name="account_id" on_change="on_change_account_id(account_id, user_id)" context="{'default_use_timesheets': 1, 'default_type': 'contract'}"/>
                                     <field name="name"/>
                                     <field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" widget="float_time" string="Hours" sum="Hours"/>
                                     <field name="to_invoice" widget="selection"/>
                                 </tree>
                                 <form string="Timesheet Activities" version="7.0">
                                     <field name="date"/>
-                                    <field domain="[('type','=','normal'), ('state', '&lt;&gt;', 'close')]" name="account_id" on_change="on_change_account_id(account_id, user_id)"/>
+                                    <field domain="[('type','in',['normal', 'contract']), ('state', '&lt;&gt;', 'close'), ('use_timesheets','=',1)]" name="account_id" on_change="on_change_account_id(account_id, user_id)" context="{'default_use_timesheets': 1, 'default_type': 'contract'}"/>
                                     <field name="name"/>
                                     <field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" widget="float_time"/>
                                     <field name="to_invoice"/>