Merge lp:~openerp-dev/openobject-addons/trunk-payroll-rename_salary_head-mtr into lp:~openerp-dev/openobject-addons/trunk-payroll

Proposed by Meera Trambadia (OpenERP)
Status: Superseded
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-payroll-rename_salary_head-mtr
Merge into: lp:~openerp-dev/openobject-addons/trunk-payroll
Diff against target: 276 lines (+46/-46)
4 files modified
hr_payroll/hr_payroll.py (+19/-19)
hr_payroll/hr_payroll_data.xml (+8/-8)
hr_payroll/hr_payroll_view.xml (+18/-18)
hr_payroll/security/ir.model.access.csv (+1/-1)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-payroll-rename_salary_head-mtr
Reviewer Review Type Date Requested Status
qdp (OpenERP) Needs Fixing
Mustufa Rangwala (Open ERP) Approve
Review via email: mp+60498@code.launchpad.net

This proposal has been superseded by a proposal from 2011-05-11.

Description of the change

*renamed salary head into salary category.

To post a comment you must log in.
Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) wrote :

convert categories dictionary to use with browse object directly from python code.

review: Needs Fixing
Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) wrote :

ok we will do above change at the end of the this merge.

Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) :
review: Approve
Revision history for this message
qdp (OpenERP) (qdp) wrote :

i just realized: we should take care to rename it into "salary rule category" instead of "salary category" :-s

sorry for the double-work

review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hr_payroll/hr_payroll.py'
2--- hr_payroll/hr_payroll.py 2011-04-28 13:08:48 +0000
3+++ hr_payroll/hr_payroll.py 2011-05-10 12:04:58 +0000
4@@ -164,17 +164,17 @@
5
6 contrib_register()
7
8-class hr_salary_head(osv.osv):
9+class hr_salary_category(osv.osv):
10 """
11- HR Salary Head
12+ HR Salary Category
13 """
14
15- _name = 'hr.salary.head'
16- _description = 'Salary Head'
17+ _name = 'hr.salary.category'
18+ _description = 'Salary Category'
19 _columns = {
20 'name':fields.char('Name', size=64, required=True, readonly=False),
21 'code':fields.char('Code', size=64, required=True, readonly=False),
22- 'parent_id':fields.many2one('hr.salary.head', 'Parent', help="Linking a salary head to its parent is used only for the reporting purpose."),
23+ 'parent_id':fields.many2one('hr.salary.category', 'Parent', help="Linking a salary category to its parent is used only for the reporting purpose."),
24 'note': fields.text('Description'),
25 'company_id':fields.many2one('res.company', 'Company', required=False),
26 'sequence': fields.integer('Sequence', required=True, help='Display sequence order'),
27@@ -187,7 +187,7 @@
28 'sequence': 5
29 }
30
31-hr_salary_head()
32+hr_salary_category()
33
34 class one2many_mod2(fields.one2many):
35
36@@ -212,11 +212,11 @@
37 _name = 'hr.payslip'
38 _description = 'Pay Slip'
39
40- def _get_lines_salary_head(self, cr, uid, ids, field_names, arg=None, context=None):
41+ def _get_lines_salary_category(self, cr, uid, ids, field_names, arg=None, context=None):
42 result = {}
43 if not ids: return result
44 cr.execute('''SELECT pl.slip_id, pl.id FROM hr_payslip_line AS pl \
45- LEFT JOIN hr_salary_head AS sh on (pl.category_id = sh.id) \
46+ LEFT JOIN hr_salary_category AS sh on (pl.category_id = sh.id) \
47 WHERE pl.slip_id in %s \
48 GROUP BY pl.slip_id, sh.sequence, pl.sequence, pl.id ORDER BY sh.sequence, pl.sequence''',(tuple(ids),))
49 res = cr.fetchall()
50@@ -253,7 +253,7 @@
51 'paid': fields.boolean('Made Payment Order ? ', required=False, readonly=True, states={'draft': [('readonly', False)]}),
52 'note': fields.text('Description'),
53 'contract_id': fields.many2one('hr.contract', 'Contract', required=False, readonly=True, states={'draft': [('readonly', False)]}),
54- 'details_by_salary_head': fields.function(_get_lines_salary_head, method=True, type='one2many', relation='hr.payslip.line', string='Details by Salary Head'),
55+ 'details_by_salary_category': fields.function(_get_lines_salary_category, method=True, type='one2many', relation='hr.payslip.line', string='Details by Salary Head'),
56 'credit_note': fields.boolean('Credit Note', help="Indicates this payslip has a refund of another"),
57 }
58 _defaults = {
59@@ -473,10 +473,10 @@
60 return res
61
62 def get_payslip_lines(self, cr, uid, contract_ids, payslip_id, context):
63- def _sum_salary_head(localdict, head, amount):
64- if head.parent_id:
65- localdict = _sum_salary_head(localdict, head.parent_id, amount)
66- localdict['heads'][head.code] = head.code in localdict['heads'] and localdict['heads'][head.code] + amount or amount
67+ def _sum_salary_category(localdict, category, amount):
68+ if category.parent_id:
69+ localdict = _sum_salary_category(localdict, category.parent_id, amount)
70+ localdict['categories'][category.code] = category.code in localdict['categories'] and localdict['categories'][category.code] + amount or amount
71 return localdict
72
73 #we keep a dict with the result because a value can be overwritten by another rule with the same code
74@@ -487,7 +487,7 @@
75 worked_days = {}
76 for input_line in payslip.input_line_ids:
77 worked_days[input_line.code] = input_line
78- localdict = {'heads': {}, 'payslip': payslip, 'worked_days': worked_days}
79+ localdict = {'categories': {}, 'payslip': payslip, 'worked_days': worked_days}
80 #get the ids of the structures on the contracts and their parent id as well
81 structure_ids = self.pool.get('hr.contract').get_all_structures(cr, uid, contract_ids, context=context)
82 #get the rules of the structure and thier children
83@@ -510,7 +510,7 @@
84 #set/overwrite the amount computed for this rule in the localdict
85 localdict[rule.code] = amount
86 #sum the amount for its salary head
87- localdict = _sum_salary_head(localdict, rule.category_id, amount - previous_amount)
88+ localdict = _sum_salary_category(localdict, rule.category_id, amount - previous_amount)
89 #create/overwrite the rule in the temporary results
90 result_dict[key] = {
91 'salary_rule_id': rule.id,
92@@ -644,7 +644,7 @@
93 'code':fields.char('Code', size=64, required=True),
94 'sequence': fields.integer('Sequence', required=True, help='Use to arrange calculation sequence'),
95 'quantity': fields.char('Quantity', size=256, help="It is used in computation for percentage and fixed amount.For e.g. A rule for Meal Voucher having fixed amount of 1€ per worked day can have its quantity defined in expression like worked_days['WORK100']['number_of_days']."),
96- 'category_id':fields.many2one('hr.salary.head', 'Salary Head', required=True),
97+ 'category_id':fields.many2one('hr.salary.category', 'Category', required=True),
98 'active':fields.boolean('Active', help="If the active field is set to false, it will allow you to hide the salary rule without removing it."),
99 'appears_on_payslip': fields.boolean('Appears on Payslip', help="Used for the display of rule on payslip"),
100 'parent_rule_id':fields.many2one('hr.salary.rule', 'Parent Salary Rule', select=True),
101@@ -684,7 +684,7 @@
102 # employee: hr.employee object
103 # contract: hr.contract object
104 # rules: rules code (previously computed)
105-# heads: dictionary containing the computed heads (sum of amount of all rules belonging to that head). Keys are the head codes.
106+# categories: dictionary containing the computed categories (sum of amount of all rules belonging to that category). Keys are the category codes.
107 # worked_days: dictionary containing the computed worked days. Keys are the worked days codes.
108
109 # Note: returned value have to be set in the variable 'result'
110@@ -698,12 +698,12 @@
111 # employee: hr.employee object
112 # contract: hr.contract object
113 # rules: rules code (previously computed)
114-# heads: dictionary containing the computed heads (sum of amount of all rules belonging to that head). Keys are the head codes.
115+# categories: dictionary containing the computed categories (sum of amount of all rules belonging to that category). Keys are the category codes.
116 # worked_days: dictionary containing the computed worked days. Keys are the worked days codes.
117
118 # Note: returned value have to be set in the variable 'result'
119
120-result = rules['NET'] > heads['NET'] * 0.10''',
121+result = rules['NET'] > categories['NET'] * 0.10''',
122 'condition_range': 'contract.wage',
123 'sequence': 5,
124 'appears_on_payslip': True,
125
126=== modified file 'hr_payroll/hr_payroll_data.xml'
127--- hr_payroll/hr_payroll_data.xml 2011-04-11 15:47:15 +0000
128+++ hr_payroll/hr_payroll_data.xml 2011-05-10 12:04:58 +0000
129@@ -2,32 +2,32 @@
130 <openerp>
131 <data noupdate="1">
132
133- <record id="BASIC" model="hr.salary.head">
134+ <record id="BASIC" model="hr.salary.category">
135 <field name="name">Basic</field>
136 <field name="code">BASIC</field>
137 </record>
138
139- <record id="ALW" model="hr.salary.head">
140+ <record id="ALW" model="hr.salary.category">
141 <field name="name">Allowance</field>
142 <field name="code">ALW</field>
143 </record>
144
145- <record id="DED" model="hr.salary.head">
146+ <record id="DED" model="hr.salary.category">
147 <field name="name">Deduction</field>
148 <field name="code">DED</field>
149 </record>
150
151- <record id="GROSS" model="hr.salary.head">
152+ <record id="GROSS" model="hr.salary.category">
153 <field name="name">Gross</field>
154 <field name="code">GROSS</field>
155 </record>
156
157- <record id="NET" model="hr.salary.head">
158+ <record id="NET" model="hr.salary.category">
159 <field name="name">Net</field>
160 <field name="code">NET</field>
161 </record>
162
163- <record id="COMP" model="hr.salary.head">
164+ <record id="COMP" model="hr.salary.category">
165 <field name="name">Company Contribution</field>
166 <field name="code">COMP</field>
167 </record>
168@@ -177,7 +177,7 @@
169 <field name="category_id" ref="hr_payroll.GROSS"/>
170 <field name="condition_select">none</field>
171 <field name="amount_select">code</field>
172- <field name="amount_python_compute">result = heads['BASIC'] + ('ALW' in heads and heads['ALW'] or 0.0)</field>
173+ <field name="amount_python_compute">result = categories['BASIC'] + ('ALW' in categories and categories['ALW'] or 0.0)</field>
174 </record>
175
176 <record id="hr_rule_net" model="hr.salary.rule">
177@@ -187,7 +187,7 @@
178 <field name="category_id" ref="hr_payroll.NET"/>
179 <field name="condition_select">none</field>
180 <field name="amount_select">code</field>
181- <field name="amount_python_compute">result = heads['BASIC'] + ('ALW' in heads and heads['ALW'] or 0.0) + ('DED' in heads and heads['DED'] or 0.0)</field>
182+ <field name="amount_python_compute">result = categories['BASIC'] + ('ALW' in categories and categories['ALW'] or 0.0) + ('DED' in categories and categories['DED'] or 0.0)</field>
183 </record>
184
185
186
187=== modified file 'hr_payroll/hr_payroll_view.xml'
188--- hr_payroll/hr_payroll_view.xml 2011-05-03 09:12:02 +0000
189+++ hr_payroll/hr_payroll_view.xml 2011-05-10 12:04:58 +0000
190@@ -260,8 +260,8 @@
191 </field>
192 </page>
193 <!-- TODO: put me back -->
194- <page string="Details By Salary Head">
195- <field name="details_by_salary_head" context="{'group_by':'category_id'}" domain="[('appears_on_payslip', '=', True)]" nolabel="1">
196+ <page string="Details By Salary Category">
197+ <field name="details_by_salary_category" context="{'group_by':'category_id'}" domain="[('appears_on_payslip', '=', True)]" nolabel="1">
198 <tree string="Payslip Lines" colors="blue:total == 0">
199 <field name="category_id"/>
200 <field name="name"/>
201@@ -347,9 +347,9 @@
202 <menuitem action="action_view_hr_payslip_form" id="menu_department_tree" parent="menu_hr_root_payroll"/>
203
204 <!-- Payment Heads -->
205- <record id="hr_salary_head_form" model="ir.ui.view">
206- <field name="name">hr.salary.head.form</field>
207- <field name="model">hr.salary.head</field>
208+ <record id="hr_salary_category_form" model="ir.ui.view">
209+ <field name="name">hr.salary.category.form</field>
210+ <field name="model">hr.salary.category</field>
211 <field name="type">form</field>
212 <field name="arch" type="xml">
213 <form string="Salary Heads">
214@@ -365,9 +365,9 @@
215 </field>
216 </record>
217
218- <record id="hr_salary_head_tree" model="ir.ui.view">
219- <field name="name">hr.salary.head.tree</field>
220- <field name="model">hr.salary.head</field>
221+ <record id="hr_salary_category_tree" model="ir.ui.view">
222+ <field name="name">hr.salary.category.tree</field>
223+ <field name="model">hr.salary.category</field>
224 <field name="type">tree</field>
225 <field name="arch" type="xml">
226 <tree string="Salary Heads">
227@@ -379,9 +379,9 @@
228 </field>
229 </record>
230
231- <record id="view_hr_salary_head_filter" model="ir.ui.view">
232- <field name="name">hr.salary.head.select</field>
233- <field name="model">hr.salary.head</field>
234+ <record id="view_hr_salary_category_filter" model="ir.ui.view">
235+ <field name="name">hr.salary.category.select</field>
236+ <field name="model">hr.salary.category</field>
237 <field name="type">search</field>
238 <field name="arch" type="xml">
239 <search string="Salary Heads">
240@@ -391,16 +391,16 @@
241 </field>
242 </record>
243
244- <record id="action_hr_salary_head" model="ir.actions.act_window">
245- <field name="name">Salary Heads</field>
246- <field name="res_model">hr.salary.head</field>
247+ <record id="action_hr_salary_category" model="ir.actions.act_window">
248+ <field name="name">Salary Categories</field>
249+ <field name="res_model">hr.salary.category</field>
250 <field name="view_type">form</field>
251- <field name="view_id" ref="hr_salary_head_tree"/>
252- <field name="search_view_id" ref="view_hr_salary_head_filter"/>
253+ <field name="view_id" ref="hr_salary_category_tree"/>
254+ <field name="search_view_id" ref="view_hr_salary_category_filter"/>
255 </record>
256 <menuitem
257- id="menu_hr_salary_head"
258- action="action_hr_salary_head"
259+ id="menu_hr_salary_category"
260+ action="action_hr_salary_category"
261 parent="payroll_configure"
262 sequence="11"
263 />
264
265=== modified file 'hr_payroll/security/ir.model.access.csv'
266--- hr_payroll/security/ir.model.access.csv 2011-04-12 17:01:28 +0000
267+++ hr_payroll/security/ir.model.access.csv 2011-05-10 12:04:58 +0000
268@@ -1,7 +1,7 @@
269 "id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
270 "access_hr_payroll_structure","hr.payroll.structure","model_hr_payroll_structure","base.group_hr_user",1,1,1,1
271 "access_hr_contribution_register","hr.contribution.register","model_hr_contribution_register","base.group_hr_user",1,1,1,1
272-"access_hr_salary_head","hr.salary.head","model_hr_salary_head","base.group_hr_user",1,1,1,1
273+"access_hr_salary_category","hr.salary.category","model_hr_salary_category","base.group_hr_user",1,1,1,1
274 "access_hr_payslip","hr.payslip","model_hr_payslip","base.group_hr_user",1,1,1,1
275 "access_hr_payslip_line","hr.payslip.line","model_hr_payslip_line","base.group_hr_user",1,1,1,1
276 "access_res_partner_payroll","res.partner.payroll","base.model_res_partner","base.group_hr_user",1,1,1,1

Subscribers

People subscribed via source and target branches