Merge lp:~gs.clearcorp/openerp-ccorp-addons/7.0_hr_wage_increase into lp:openerp-ccorp-addons/7.0

Proposed by Glen Sojo
Status: Merged
Merged at revision: 879
Proposed branch: lp:~gs.clearcorp/openerp-ccorp-addons/7.0_hr_wage_increase
Merge into: lp:openerp-ccorp-addons/7.0
Diff against target: 522 lines (+467/-0)
9 files modified
hr_wage_increase/__init__.py (+23/-0)
hr_wage_increase/__openerp__.py (+58/-0)
hr_wage_increase/i18n/es.po (+105/-0)
hr_wage_increase/i18n/hr_wage_increase.pot (+105/-0)
hr_wage_increase/view/hr_wage_increase_menu.xml (+11/-0)
hr_wage_increase/view/hr_wage_increase_view.xml (+13/-0)
hr_wage_increase/wizard/__init__.py (+23/-0)
hr_wage_increase/wizard/increase_wizard.py (+89/-0)
hr_wage_increase/wizard/increase_wizard_view.xml (+40/-0)
To merge this branch: bzr merge lp:~gs.clearcorp/openerp-ccorp-addons/7.0_hr_wage_increase
Reviewer Review Type Date Requested Status
ClearCorp drivers Pending
Review via email: mp+223485@code.launchpad.net

Description of the change

[ADD] - hr_wage_increase: Added new module update the contracts wage using a simple wizard.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'hr_wage_increase'
2=== added file 'hr_wage_increase/__init__.py'
3--- hr_wage_increase/__init__.py 1970-01-01 00:00:00 +0000
4+++ hr_wage_increase/__init__.py 2014-06-17 22:08:47 +0000
5@@ -0,0 +1,23 @@
6+# -*- coding: utf-8 -*-
7+##############################################################################
8+#
9+# OpenERP, Open Source Management Solution
10+# Addons modules by CLEARCORP S.A.
11+# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
12+#
13+# This program is free software: you can redistribute it and/or modify
14+# it under the terms of the GNU Affero General Public License as
15+# published by the Free Software Foundation, either version 3 of the
16+# License, or (at your option) any later version.
17+#
18+# This program is distributed in the hope that it will be useful,
19+# but WITHOUT ANY WARRANTY; without even the implied warranty of
20+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+# GNU Affero General Public License for more details.
22+#
23+# You should have received a copy of the GNU Affero General Public License
24+# along with this program. If not, see <http://www.gnu.org/licenses/>.
25+#
26+##############################################################################
27+
28+import wizard
29\ No newline at end of file
30
31=== added file 'hr_wage_increase/__openerp__.py'
32--- hr_wage_increase/__openerp__.py 1970-01-01 00:00:00 +0000
33+++ hr_wage_increase/__openerp__.py 2014-06-17 22:08:47 +0000
34@@ -0,0 +1,58 @@
35+# -*- coding: utf-8 -*-
36+##############################################################################
37+#
38+# OpenERP, Open Source Management Solution
39+# Addons modules by CLEARCORP S.A.
40+# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
41+#
42+# This program is free software: you can redistribute it and/or modify
43+# it under the terms of the GNU Affero General Public License as
44+# published by the Free Software Foundation, either version 3 of the
45+# License, or (at your option) any later version.
46+#
47+# This program is distributed in the hope that it will be useful,
48+# but WITHOUT ANY WARRANTY; without even the implied warranty of
49+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
50+# GNU Affero General Public License for more details.
51+#
52+# You should have received a copy of the GNU Affero General Public License
53+# along with this program. If not, see <http://www.gnu.org/licenses/>.
54+#
55+##############################################################################
56+
57+{
58+ 'name': 'Wage Increase',
59+ 'version': '1.0',
60+ 'category': 'Human Resources',
61+ 'sequence': 3,
62+ 'summary': 'Contract, Wage, Increase',
63+ 'description': """
64+Increase the contract wage
65+==========================
66+
67+This module allow you to increase the employees wage using a simple wizard.
68+
69+Main features
70+-------------
71+
72+* Multiple contract selection
73+* Increase by fixed amount
74+* Percent increase
75+""",
76+ 'author': 'CLEARCORP S.A.',
77+ 'website': 'http://clearcorp.co.cr',
78+ 'complexity': 'easy',
79+ 'images' : [],
80+ 'depends': ['hr_contract',],
81+ 'data': [
82+ 'wizard/increase_wizard_view.xml',
83+ 'view/hr_wage_increase_view.xml',
84+ 'view/hr_wage_increase_menu.xml',
85+ ],
86+ 'test' : [],
87+ 'demo': [],
88+ 'installable': True,
89+ 'auto_install': False,
90+ 'application': False,
91+ 'license': 'AGPL-3',
92+}
93\ No newline at end of file
94
95=== added directory 'hr_wage_increase/i18n'
96=== added file 'hr_wage_increase/i18n/es.po'
97--- hr_wage_increase/i18n/es.po 1970-01-01 00:00:00 +0000
98+++ hr_wage_increase/i18n/es.po 2014-06-17 22:08:47 +0000
99@@ -0,0 +1,105 @@
100+# Translation of OpenERP Server.
101+# This file contains the translation of the following modules:
102+# * hr_wage_increase
103+#
104+msgid ""
105+msgstr ""
106+"Project-Id-Version: OpenERP Server 7.0\n"
107+"Report-Msgid-Bugs-To: \n"
108+"POT-Creation-Date: 2014-06-17 21:16+0000\n"
109+"PO-Revision-Date: 2014-06-17 21:16+0000\n"
110+"Last-Translator: <>\n"
111+"Language-Team: \n"
112+"MIME-Version: 1.0\n"
113+"Content-Type: text/plain; charset=UTF-8\n"
114+"Content-Transfer-Encoding: \n"
115+"Plural-Forms: \n"
116+
117+#. module: hr_wage_increase
118+#: view:hr.wage.increase.increase.wizard:0
119+msgid "Are you sure want to process the selected contracts? You will be redirected to the updated contracts."
120+msgstr "¿Estás seguro que deseas procesar los contratos seleccionados? Serás redireccionado a los contratos actualizados."
121+
122+#. module: hr_wage_increase
123+#: selection:hr.wage.increase.increase.wizard,increase_type:0
124+msgid "Percentage (%)"
125+msgstr "Porcentaje (%)"
126+
127+#. module: hr_wage_increase
128+#: view:hr.wage.increase.increase.wizard:0
129+#: model:ir.ui.menu,name:hr_wage_increase.menu_increase_wizard
130+msgid "Wage Increase"
131+msgstr "Incremento de salario"
132+
133+#. module: hr_wage_increase
134+#: field:hr.wage.increase.increase.wizard,contract_ids:0
135+msgid "Contracts"
136+msgstr "Contratos"
137+
138+#. module: hr_wage_increase
139+#: code:addons/hr_wage_increase/wizard/increase_wizard.py:59
140+#, python-format
141+msgid "Updated contracts"
142+msgstr "Contratos actualizados"
143+
144+#. module: hr_wage_increase
145+#: selection:hr.wage.increase.increase.wizard,increase_type:0
146+msgid "Fixed Amount"
147+msgstr "Monto fijo"
148+
149+#. module: hr_wage_increase
150+#: code:addons/hr_wage_increase/wizard/increase_wizard.py:69
151+#, python-format
152+msgid "Error Processing Contracts"
153+msgstr "Error procesando contratos"
154+
155+#. module: hr_wage_increase
156+#: view:hr.wage.increase.increase.wizard:0
157+msgid "or"
158+msgstr "o"
159+
160+#. module: hr_wage_increase
161+#: view:hr.wage.increase.increase.wizard:0
162+msgid "Process"
163+msgstr "Procesar"
164+
165+#. module: hr_wage_increase
166+#: field:hr.wage.increase.increase.wizard,amount_fixed:0
167+msgid "Amount"
168+msgstr "Monto"
169+
170+#. module: hr_wage_increase
171+#: constraint:hr.wage.increase.increase.wizard:0
172+msgid "Value must be greater than 0."
173+msgstr "El valor debe ser mayor que 0."
174+
175+#. module: hr_wage_increase
176+#: code:addons/hr_wage_increase/wizard/increase_wizard.py:70
177+#, python-format
178+msgid "An error occurred while processing the contracts"
179+msgstr "Un error ocurrión mientras se procesaban los contratos"
180+
181+#. module: hr_wage_increase
182+#: model:ir.actions.act_window,name:hr_wage_increase.action_increase_wizard
183+msgid "Wage Increases"
184+msgstr "Incrementos de salario"
185+
186+#. module: hr_wage_increase
187+#: view:hr.wage.increase.increase.wizard:0
188+msgid "Cancel"
189+msgstr "Descartar"
190+
191+#. module: hr_wage_increase
192+#: field:hr.wage.increase.increase.wizard,amount_percentage:0
193+msgid "Increase Percentage"
194+msgstr "Porcentaje de incremento"
195+
196+#. module: hr_wage_increase
197+#: constraint:hr.wage.increase.increase.wizard:0
198+msgid "Value must be greater than 0 and lower or equal than 100."
199+msgstr "El valor debe ser mayor que 0 y menor o igual que 100."
200+
201+#. module: hr_wage_increase
202+#: field:hr.wage.increase.increase.wizard,increase_type:0
203+msgid "Increase Type"
204+msgstr "Tipo de incremento"
205
206=== added file 'hr_wage_increase/i18n/hr_wage_increase.pot'
207--- hr_wage_increase/i18n/hr_wage_increase.pot 1970-01-01 00:00:00 +0000
208+++ hr_wage_increase/i18n/hr_wage_increase.pot 2014-06-17 22:08:47 +0000
209@@ -0,0 +1,105 @@
210+# Translation of OpenERP Server.
211+# This file contains the translation of the following modules:
212+# * hr_wage_increase
213+#
214+msgid ""
215+msgstr ""
216+"Project-Id-Version: OpenERP Server 7.0\n"
217+"Report-Msgid-Bugs-To: \n"
218+"POT-Creation-Date: 2014-06-17 21:16+0000\n"
219+"PO-Revision-Date: 2014-06-17 21:16+0000\n"
220+"Last-Translator: <>\n"
221+"Language-Team: \n"
222+"MIME-Version: 1.0\n"
223+"Content-Type: text/plain; charset=UTF-8\n"
224+"Content-Transfer-Encoding: \n"
225+"Plural-Forms: \n"
226+
227+#. module: hr_wage_increase
228+#: view:hr.wage.increase.increase.wizard:0
229+msgid "Are you sure want to process the selected contracts? You will be redirected to the updated contracts."
230+msgstr ""
231+
232+#. module: hr_wage_increase
233+#: selection:hr.wage.increase.increase.wizard,increase_type:0
234+msgid "Percentage (%)"
235+msgstr ""
236+
237+#. module: hr_wage_increase
238+#: view:hr.wage.increase.increase.wizard:0
239+#: model:ir.ui.menu,name:hr_wage_increase.menu_increase_wizard
240+msgid "Wage Increase"
241+msgstr ""
242+
243+#. module: hr_wage_increase
244+#: field:hr.wage.increase.increase.wizard,contract_ids:0
245+msgid "Contracts"
246+msgstr ""
247+
248+#. module: hr_wage_increase
249+#: code:addons/hr_wage_increase/wizard/increase_wizard.py:59
250+#, python-format
251+msgid "Updated contracts"
252+msgstr ""
253+
254+#. module: hr_wage_increase
255+#: selection:hr.wage.increase.increase.wizard,increase_type:0
256+msgid "Fixed Amount"
257+msgstr ""
258+
259+#. module: hr_wage_increase
260+#: code:addons/hr_wage_increase/wizard/increase_wizard.py:69
261+#, python-format
262+msgid "Error Processing Contracts"
263+msgstr ""
264+
265+#. module: hr_wage_increase
266+#: view:hr.wage.increase.increase.wizard:0
267+msgid "or"
268+msgstr ""
269+
270+#. module: hr_wage_increase
271+#: view:hr.wage.increase.increase.wizard:0
272+msgid "Process"
273+msgstr ""
274+
275+#. module: hr_wage_increase
276+#: field:hr.wage.increase.increase.wizard,amount_fixed:0
277+msgid "Amount"
278+msgstr ""
279+
280+#. module: hr_wage_increase
281+#: constraint:hr.wage.increase.increase.wizard:0
282+msgid "Value must be greater than 0."
283+msgstr ""
284+
285+#. module: hr_wage_increase
286+#: code:addons/hr_wage_increase/wizard/increase_wizard.py:70
287+#, python-format
288+msgid "An error occurred while processing the contracts"
289+msgstr ""
290+
291+#. module: hr_wage_increase
292+#: model:ir.actions.act_window,name:hr_wage_increase.action_increase_wizard
293+msgid "Wage Increases"
294+msgstr ""
295+
296+#. module: hr_wage_increase
297+#: view:hr.wage.increase.increase.wizard:0
298+msgid "Cancel"
299+msgstr ""
300+
301+#. module: hr_wage_increase
302+#: field:hr.wage.increase.increase.wizard,amount_percentage:0
303+msgid "Increase Percentage"
304+msgstr ""
305+
306+#. module: hr_wage_increase
307+#: constraint:hr.wage.increase.increase.wizard:0
308+msgid "Value must be greater than 0 and lower or equal than 100."
309+msgstr ""
310+
311+#. module: hr_wage_increase
312+#: field:hr.wage.increase.increase.wizard,increase_type:0
313+msgid "Increase Type"
314+msgstr ""
315
316=== added directory 'hr_wage_increase/view'
317=== added file 'hr_wage_increase/view/hr_wage_increase_menu.xml'
318--- hr_wage_increase/view/hr_wage_increase_menu.xml 1970-01-01 00:00:00 +0000
319+++ hr_wage_increase/view/hr_wage_increase_menu.xml 2014-06-17 22:08:47 +0000
320@@ -0,0 +1,11 @@
321+<?xml version="1.0" encoding="UTF-8"?>
322+<openerp>
323+ <data>
324+ <menuitem id="menu_increase_wizard"
325+ parent="hr.menu_hr_main"
326+ name="Wage Increase"
327+ action="action_increase_wizard"
328+ groups="base.group_hr_manager"
329+ sequence="10"/>
330+ </data>
331+</openerp>
332\ No newline at end of file
333
334=== added file 'hr_wage_increase/view/hr_wage_increase_view.xml'
335--- hr_wage_increase/view/hr_wage_increase_view.xml 1970-01-01 00:00:00 +0000
336+++ hr_wage_increase/view/hr_wage_increase_view.xml 2014-06-17 22:08:47 +0000
337@@ -0,0 +1,13 @@
338+<?xml version="1.0" encoding="UTF-8"?>
339+<openerp>
340+ <data>
341+ <record id="action_increase_wizard" model="ir.actions.act_window">
342+ <field name="name">Wage Increases</field>
343+ <field name="view_id" ref="view_increase_wizard_form"/>
344+ <field name="res_model">hr.wage.increase.increase.wizard</field>
345+ <field name="view_type">form</field>
346+ <field name="view_mode">form</field>
347+ <field name="target">new</field>
348+ </record>
349+ </data>
350+</openerp>
351\ No newline at end of file
352
353=== added directory 'hr_wage_increase/wizard'
354=== added file 'hr_wage_increase/wizard/__init__.py'
355--- hr_wage_increase/wizard/__init__.py 1970-01-01 00:00:00 +0000
356+++ hr_wage_increase/wizard/__init__.py 2014-06-17 22:08:47 +0000
357@@ -0,0 +1,23 @@
358+# -*- coding: utf-8 -*-
359+##############################################################################
360+#
361+# OpenERP, Open Source Management Solution
362+# Addons modules by CLEARCORP S.A.
363+# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
364+#
365+# This program is free software: you can redistribute it and/or modify
366+# it under the terms of the GNU Affero General Public License as
367+# published by the Free Software Foundation, either version 3 of the
368+# License, or (at your option) any later version.
369+#
370+# This program is distributed in the hope that it will be useful,
371+# but WITHOUT ANY WARRANTY; without even the implied warranty of
372+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
373+# GNU Affero General Public License for more details.
374+#
375+# You should have received a copy of the GNU Affero General Public License
376+# along with this program. If not, see <http://www.gnu.org/licenses/>.
377+#
378+##############################################################################
379+
380+import increase_wizard
381\ No newline at end of file
382
383=== added file 'hr_wage_increase/wizard/increase_wizard.py'
384--- hr_wage_increase/wizard/increase_wizard.py 1970-01-01 00:00:00 +0000
385+++ hr_wage_increase/wizard/increase_wizard.py 2014-06-17 22:08:47 +0000
386@@ -0,0 +1,89 @@
387+# -*- coding: utf-8 -*-
388+##############################################################################
389+#
390+# OpenERP, Open Source Management Solution
391+# Addons modules by CLEARCORP S.A.
392+# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
393+#
394+# This program is free software: you can redistribute it and/or modify
395+# it under the terms of the GNU Affero General Public License as
396+# published by the Free Software Foundation, either version 3 of the
397+# License, or (at your option) any later version.
398+#
399+# This program is distributed in the hope that it will be useful,
400+# but WITHOUT ANY WARRANTY; without even the implied warranty of
401+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
402+# GNU Affero General Public License for more details.
403+#
404+# You should have received a copy of the GNU Affero General Public License
405+# along with this program. If not, see <http://www.gnu.org/licenses/>.
406+#
407+##############################################################################
408+
409+from openerp.osv import osv, fields
410+from openerp.tools.translate import _
411+
412+class WageIncreaseWizard(osv.TransientModel):
413+
414+ _name = 'hr.wage.increase.increase.wizard'
415+
416+ def _check_amount_percentage(self, cr, uid, ids, context=None):
417+ for wizard in self.browse(cr, uid, ids, context=context):
418+ if wizard.increase_type == 'percentage':
419+ if wizard.amount_percentage <= 0.0 or wizard.amount_percentage > 100:
420+ return False
421+ return True
422+
423+ def _check_amount_fixed(self, cr, uid, ids, context=None):
424+ for wizard in self.browse(cr, uid, ids, context=context):
425+ if wizard.increase_type == 'fixed_amount':
426+ if wizard.amount_fixed <= 0.0:
427+ return False
428+ return True
429+
430+ def process_wage_increase(self, cr, uid, ids, context=None):
431+ if isinstance(ids,list):
432+ ids = ids and ids[0]
433+ wizard = self.browse(cr, uid, ids, context=context)
434+ try:
435+ contract_ids = []
436+ for contract in wizard.contract_ids:
437+ new_wage = None
438+ if wizard.increase_type == 'percentage':
439+ new_wage = contract.wage + (contract.wage * wizard.amount_percentage / 100)
440+ else:
441+ new_wage = contract.wage + wizard.amount_fixed
442+ contract.write({'wage': new_wage}, context=context)
443+ contract_ids.append(contract.id)
444+ return {
445+ 'name': _('Updated contracts'),
446+ 'view_type': 'form',
447+ 'view_mode': 'tree,form',
448+ 'res_model': 'hr.contract',
449+ 'view_id': False,
450+ 'context': context,
451+ 'domain': "[('id','in',%s)]" % contract_ids,
452+ 'type': 'ir.actions.act_window',
453+ }
454+ except:
455+ raise osv.except_osv(_('Error Processing Contracts'),
456+ _('An error occurred while processing the contracts'))
457+
458+ _columns = {
459+ 'increase_type': fields.selection([('percentage','Percentage (%)'),('fixed_amount','Fixed Amount')],
460+ string='Increase Type', required=True),
461+ 'amount_percentage': fields.float('Increase Percentage'),
462+ 'amount_fixed': fields.float('Amount', digits=(16,2)),
463+ 'contract_ids': fields.many2many('hr.contract', string='Contracts', required=True),
464+ }
465+
466+ _defaults = {
467+ 'increase_type': 'fixed_amount',
468+ }
469+
470+ _constraints = [(_check_amount_percentage,
471+ 'Value must be greater than 0 and lower or equal than 100.',
472+ ['Increase Percentage']),
473+ (_check_amount_fixed,
474+ 'Value must be greater than 0.',
475+ ['Amount'])]
476\ No newline at end of file
477
478=== added file 'hr_wage_increase/wizard/increase_wizard_view.xml'
479--- hr_wage_increase/wizard/increase_wizard_view.xml 1970-01-01 00:00:00 +0000
480+++ hr_wage_increase/wizard/increase_wizard_view.xml 2014-06-17 22:08:47 +0000
481@@ -0,0 +1,40 @@
482+<?xml version="1.0" encoding="UTF-8"?>
483+<openerp>
484+ <data>
485+ <record id="view_increase_wizard_form" model="ir.ui.view">
486+ <field name="name">view.increase.wizard.form</field>
487+ <field name="model">hr.wage.increase.increase.wizard</field>
488+ <field name="type">form</field>
489+ <field name="priority" eval="16"/>
490+ <field name="arch" type="xml">
491+ <form string="Wage Increase" version="7.0">
492+ <group>
493+ <group name="grp_type">
494+ <field name="increase_type"/>
495+ </group>
496+ <group name="grp_amount">
497+ <field name="amount_percentage" attrs="{'invisible': ['|',('increase_type','=','fixed_amount'),('increase_type','=',False)], 'required': [('increase_type','=','percentage')]}"/>
498+ <field name="amount_fixed" attrs="{'invisible': ['|',('increase_type','=','percentage'),('increase_type','=',False)], 'required': [('increase_type','=','fixed_amount')]}"/>
499+ </group>
500+ <field name="contract_ids" nolabel="1" colspan="2">
501+ <tree>
502+ <field name="name"/>
503+ <field name="employee_id"/>
504+ <field name="type_id"/>
505+ <field name="job_id"/>
506+ <field name="working_hours"/>
507+ <field name="date_start"/>
508+ <field name="date_end"/>
509+ <field name="wage"/>
510+ </tree>
511+ </field>
512+ </group>
513+ <footer>
514+ <button name="process_wage_increase" type="object" class="oe_highlight" string="Process" confirm="Are you sure want to process the selected contracts? You will be redirected to the updated contracts."/> or
515+ <button string="Cancel" class="oe_link" special="cancel"/>
516+ </footer>
517+ </form>
518+ </field>
519+ </record>
520+ </data>
521+</openerp>
522\ No newline at end of file

Subscribers

People subscribed via source and target branches