Merge lp:~camptocamp/openobject-addons/7.0-fix-1190259 into lp:openobject-addons/7.0

Proposed by Yannick Vaucher @ Camptocamp
Status: Needs review
Proposed branch: lp:~camptocamp/openobject-addons/7.0-fix-1190259
Merge into: lp:openobject-addons/7.0
Diff against target: 91 lines (+12/-12)
3 files modified
analytic_user_function/analytic_user_function_view.xml (+8/-8)
hr_timesheet/hr_timesheet_view.xml (+2/-2)
hr_timesheet_sheet/hr_timesheet_sheet_view.xml (+2/-2)
To merge this branch: bzr merge lp:~camptocamp/openobject-addons/7.0-fix-1190259
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+169136@code.launchpad.net

This proposal supersedes a proposal from 2013-06-12.

Description of the change

[FIX] analytic_user_function - wrong override of domain for account_id in timesheet lines

To post a comment you must log in.
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote : Posted in a previous version of this proposal

An other option would be to use the boolean field 'use_timehseets'

There is a bigger cleaning to do about it in hr_timesheet and hr_timesheet_sheet modules

Complete domain might be
[('type','in',['normal', 'contract']), ('state', '<>', 'close'),('use_timesheets','=',1)]

gtAnd complete context should be:
context="{'default_use_timesheets': 1, 'default_type': 'contract'}"

Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

I corrected it by using position="attributes" instead of position="replace" this should solve most of the issues still some changes needs to be in hr_timesheet/hr_timesheet_view.xml and in hr_timesheet_sheet/hr_timesheet_sheet_view.xml

9230. By Yannick Vaucher @ Camptocamp on 2013-06-13

[IMP] hr_timesheet_sheet - domain and context of account_id in hr_timesheet_sheet view

9231. By Yannick Vaucher @ Camptocamp on 2013-06-13

[IMP] hr_timesheet - domain and context of account_id in hr_timesheet_line view, also removed checked on parent_id != False as this seems too restricitve and filtering on type should be enough

9232. By Yannick Vaucher @ Camptocamp on 2013-08-30

[FIX] hr_timesheet - operator in domain

Unmerged revisions

9232. By Yannick Vaucher @ Camptocamp on 2013-08-30

[FIX] hr_timesheet - operator in domain

9231. By Yannick Vaucher @ Camptocamp on 2013-06-13

[IMP] hr_timesheet - domain and context of account_id in hr_timesheet_line view, also removed checked on parent_id != False as this seems too restricitve and filtering on type should be enough

9230. By Yannick Vaucher @ Camptocamp on 2013-06-13

[IMP] hr_timesheet_sheet - domain and context of account_id in hr_timesheet_sheet view

9229. By Yannick Vaucher @ Camptocamp on 2013-06-13

[IMP] analytic_user_function - use attributes instead of replace in view inheritance in order to keep domain and context

9228. By Yannick Vaucher @ Camptocamp on 2013-06-13

[FIX] analytic_user_function - also add contract in domain for hr_timesheet_line view inherits

9227. By Yannick Vaucher @ Camptocamp on 2013-06-12

[FIX] analytic_user_function - wrong override of domain for account_id in timesheet lines

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'analytic_user_function/analytic_user_function_view.xml'
2--- analytic_user_function/analytic_user_function_view.xml 2013-03-12 12:33:21 +0000
3+++ analytic_user_function/analytic_user_function_view.xml 2013-08-30 12:45:36 +0000
4@@ -65,8 +65,8 @@
5 <field name="priority" eval="18"/>
6 <field name="inherit_id" ref="hr_timesheet_sheet.hr_timesheet_sheet_form"/>
7 <field name="arch" type="xml">
8- <xpath expr="//field[@name='timesheet_ids']/tree/field[@name='account_id']" position="replace">
9- <field name="account_id" domain="[('type','=','normal'),('state', '&lt;&gt;', 'close')]" on_change="on_change_account_id(account_id, user_id, unit_amount)"/>
10+ <xpath expr="//field[@name='timesheet_ids']/tree/field[@name='account_id']" position="attributes">
11+ <attribute name="on_change">on_change_account_id(account_id, user_id, unit_amount)</attribute>
12 </xpath>
13 </field>
14 </record>
15@@ -78,8 +78,8 @@
16 <field name="priority" eval="19"/>
17 <field name="inherit_id" ref="hr_timesheet_sheet.hr_timesheet_sheet_form"/>
18 <field name="arch" type="xml">
19- <xpath expr="//field[@name='timesheet_ids']/form/field[@name='account_id']" position="replace">
20- <field name="account_id" domain="[('type','=','normal'),('state', '&lt;&gt;', 'close')]" on_change="on_change_account_id(account_id, user_id, unit_amount)"/>
21+ <xpath expr="//field[@name='timesheet_ids']/form/field[@name='account_id']" position="attributes">
22+ <attribute name="on_change">on_change_account_id(account_id, user_id, unit_amount)</attribute>
23 </xpath>
24 </field>
25 </record>
26@@ -90,8 +90,8 @@
27 <field name="model">hr.analytic.timesheet</field>
28 <field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_form"/>
29 <field name="arch" type="xml">
30- <xpath expr="//field[@name='account_id']" position="replace">
31- <field name="account_id" domain="[('type','=','normal'),('state', '&lt;&gt;', 'close')]" on_change="on_change_account_id(account_id, user_id, unit_amount)" />
32+ <xpath expr="//field[@name='account_id']" position="attributes">
33+ <attribute name="on_change">on_change_account_id(account_id, user_id, unit_amount)</attribute>
34 </xpath>
35 </field>
36 </record>
37@@ -112,8 +112,8 @@
38 <field name="model">hr.analytic.timesheet</field>
39 <field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_tree"/>
40 <field name="arch" type="xml">
41- <xpath expr="/tree/field[@name='account_id']" position="replace">
42- <field name="account_id" domain="[('type','=','normal'),('state', '&lt;&gt;', 'close')]" on_change="on_change_account_id(account_id, user_id, unit_amount)" />
43+ <xpath expr="/tree/field[@name='account_id']" position="attributes">
44+ <attribute name="on_change">on_change_account_id(account_id, user_id, unit_amount)</attribute>
45 </xpath>
46 </field>
47 </record>
48
49=== modified file 'hr_timesheet/hr_timesheet_view.xml'
50--- hr_timesheet/hr_timesheet_view.xml 2012-12-14 11:14:32 +0000
51+++ hr_timesheet/hr_timesheet_view.xml 2013-08-30 12:45:36 +0000
52@@ -10,7 +10,7 @@
53 <field name="date" on_change="on_change_date(date)"/>
54 <field name="user_id" on_change="on_change_user_id(user_id)" required="1" options='{"no_open": True}'/>
55 <field name="name"/>
56- <field domain="[('type','=','normal'),('use_timesheets','=',1)]" name="account_id" context="{'default_use_timesheets': 1, 'default_type': 'contract'}"/>
57+ <field domain="[('type','in',['normal','contract']),('state', '&lt;&gt;', 'close'),('use_timesheets','=',1)]" name="account_id" context="{'default_use_timesheets': 1, 'default_type': 'contract'}"/>
58 <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"/>
59 <field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" invisible="1"/>
60 <field name="journal_id" invisible="1"/>
61@@ -47,7 +47,7 @@
62 </div>
63 </group>
64 <group string="Accounting">
65- <field domain="[('type','=','normal'),('state', '&lt;&gt;', 'close'),('parent_id','!=',False)]" name="account_id" select="1"/>
66+ <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'}"/>
67 <field name="amount"/>
68 <field name="general_account_id"/>
69 <field name="journal_id"/>
70
71=== modified file 'hr_timesheet_sheet/hr_timesheet_sheet_view.xml'
72--- hr_timesheet_sheet/hr_timesheet_sheet_view.xml 2012-12-17 11:14:02 +0000
73+++ hr_timesheet_sheet/hr_timesheet_sheet_view.xml 2013-08-30 12:45:36 +0000
74@@ -106,7 +106,7 @@
75 <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">
76 <tree editable="top" string="Timesheet Activities">
77 <field name="date"/>
78- <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}"/>
79+ <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'}"/>
80 <field name="name"/>
81 <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"/>
82 <field name="to_invoice" widget="selection"/>
83@@ -119,7 +119,7 @@
84 </tree>
85 <form string="Timesheet Activities" version="7.0">
86 <field name="date"/>
87- <field domain="[('type','=','normal'), ('state', '&lt;&gt;', 'close')]" name="account_id" on_change="on_change_account_id(account_id, user_id)"/>
88+ <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'}"/>
89 <field name="name"/>
90 <field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" widget="float_time"/>
91 <field name="to_invoice"/>