Merge lp:~savoirfairelinux-openerp/openerp-hr/hr_employee_firstname into lp:openerp-hr

Status: Rejected
Rejected by: Sandy Carter (http://www.savoirfairelinux.com)
Proposed branch: lp:~savoirfairelinux-openerp/openerp-hr/hr_employee_firstname
Merge into: lp:openerp-hr
Diff against target: 271 lines (+240/-0)
6 files modified
hr_employee_firstname/__init__.py (+23/-0)
hr_employee_firstname/__openerp__.py (+54/-0)
hr_employee_firstname/hr.py (+50/-0)
hr_employee_firstname/hr_view.xml (+29/-0)
hr_employee_firstname/i18n/employee_firstname.pot (+42/-0)
hr_employee_firstname/i18n/fr.po (+42/-0)
To merge this branch: bzr merge lp:~savoirfairelinux-openerp/openerp-hr/hr_employee_firstname
Reviewer Review Type Date Requested Status
Daniel Reis Needs Information
OpenERP Community Reviewer/Maintainer Pending
HR Core Editors Pending
Review via email: mp+204065@code.launchpad.net

Description of the change

Add hr_employee_firstname module; it adds the firstname field on employee; name is considered like the last name

To post a comment you must log in.
80. By El Hadji Dem (http://www.savoirfairelinux.com)

[IMP] add 'from .' to import hr line in employee_firstname module

Revision history for this message
Daniel Reis (dreis-pt) wrote :

Thanks for the contribution. Comments:

L64: shouldn't the Category be "Human Resources" instead of MISC?
L86: why is the module declares inactive?
L126: the SQL uses a "name_related" field. I'm not aware of it in standard HR modules. Are you sure this is ok?; also, you're missing a blank line after the method (PEP8).

review: Needs Information
Revision history for this message
Sandy Carter (http://www.savoirfairelinux.com) (sandy-carter) wrote :

@Daniel, name_related is in the standard hr.employee model

81. By Sandy Carter (http://www.savoirfairelinux.com)

Cleanup module

Revision history for this message
Sandy Carter (http://www.savoirfairelinux.com) (sandy-carter) wrote :

Unmerged revisions

81. By Sandy Carter (http://www.savoirfairelinux.com)

Cleanup module

80. By El Hadji Dem (http://www.savoirfairelinux.com)

[IMP] add 'from .' to import hr line in employee_firstname module

79. By El Hadji Dem (http://www.savoirfairelinux.com)

[ADD]Add hr_employee_firstname module; it adds the firstname field on employee; name is considered like the last name

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'hr_employee_firstname'
2=== added file 'hr_employee_firstname/__init__.py'
3--- hr_employee_firstname/__init__.py 1970-01-01 00:00:00 +0000
4+++ hr_employee_firstname/__init__.py 2014-03-04 16:23:46 +0000
5@@ -0,0 +1,23 @@
6+# -*- encoding: utf-8 -*-
7+##############################################################################
8+#
9+# OpenERP, Open Source Management Solution
10+# This module copyright (C) 2010 - 2014 Savoir-faire Linux
11+# (<http://www.savoirfairelinux.com>).
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+from . import hr
29
30=== added file 'hr_employee_firstname/__openerp__.py'
31--- hr_employee_firstname/__openerp__.py 1970-01-01 00:00:00 +0000
32+++ hr_employee_firstname/__openerp__.py 2014-03-04 16:23:46 +0000
33@@ -0,0 +1,54 @@
34+# -*- encoding: utf-8 -*-
35+##############################################################################
36+#
37+# OpenERP, Open Source Management Solution
38+# This module copyright (C) 2010 - 2014 Savoir-faire Linux
39+# (<http://www.savoirfairelinux.com>).
40+#
41+# This program is free software: you can redistribute it and/or modify
42+# it under the terms of the GNU Affero General Public License as
43+# published by the Free Software Foundation, either version 3 of the
44+# License, or (at your option) any later version.
45+#
46+# This program is distributed in the hope that it will be useful,
47+# but WITHOUT ANY WARRANTY; without even the implied warranty of
48+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
49+# GNU Affero General Public License for more details.
50+#
51+# You should have received a copy of the GNU Affero General Public License
52+# along with this program. If not, see <http://www.gnu.org/licenses/>.
53+#
54+##############################################################################
55+
56+{
57+ 'name': 'Employee First Name, Last Name',
58+ 'version': '0.1',
59+ 'author': 'Savoir-faire Linux',
60+ 'maintainer': 'Savoir-faire Linux',
61+ 'website': 'http://www.savoirfairelinux.com',
62+ 'license': 'AGPL-3',
63+ 'category': 'Human Resources',
64+ 'summary': 'Adds First Name to Employee',
65+ 'description': """
66+Employee First Name, Last Name
67+==============================
68+
69+This module allows you to add firstname and lastname in employee form,
70+and concatenate both in name field.
71+
72+Contributors
73+------------
74+* El Hadji Dem (elhadji.dem@savoirfairelinux.com)
75+* Sandy Carter (sandy.carter@savoirfairelinux.com)
76+""",
77+ 'depends': [
78+ 'hr',
79+ ],
80+ 'external_dependencies': {},
81+ 'data': [
82+ 'hr_view.xml',
83+ ],
84+ 'demo': [],
85+ 'test': [],
86+ 'installable': True,
87+}
88
89=== added file 'hr_employee_firstname/hr.py'
90--- hr_employee_firstname/hr.py 1970-01-01 00:00:00 +0000
91+++ hr_employee_firstname/hr.py 2014-03-04 16:23:46 +0000
92@@ -0,0 +1,50 @@
93+# -*- encoding: utf-8 -*-
94+##############################################################################
95+#
96+# OpenERP, Open Source Management Solution
97+# This module copyright (C) 2010 - 2014 Savoir-faire Linux
98+# (<http://www.savoirfairelinux.com>).
99+#
100+# This program is free software: you can redistribute it and/or modify
101+# it under the terms of the GNU Affero General Public License as
102+# published by the Free Software Foundation, either version 3 of the
103+# License, or (at your option) any later version.
104+#
105+# This program is distributed in the hope that it will be useful,
106+# but WITHOUT ANY WARRANTY; without even the implied warranty of
107+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
108+# GNU Affero General Public License for more details.
109+#
110+# You should have received a copy of the GNU Affero General Public License
111+# along with this program. If not, see <http://www.gnu.org/licenses/>.
112+#
113+##############################################################################
114+
115+from openerp.osv import orm, fields
116+
117+
118+class hr_employee(orm.Model):
119+ _inherit = 'hr.employee'
120+
121+ def init(self, cursor):
122+ cursor.execute('''\
123+SELECT id
124+FROM hr_employee
125+WHERE lastname IS NOT NULL
126+LIMIT 1''')
127+ if not cursor.fetchone():
128+ cursor.execute('''\
129+UPDATE hr_employee
130+SET lastname = name_related
131+WHERE name_related IS NOT NULL''')
132+
133+ def create(self, cursor, uid, vals, context=None):
134+ names = (vals['firstname'], vals['lastname'])
135+ vals['name'] = " ".join(s for s in names if s)
136+ return super(hr_employee, self).create(
137+ cursor, uid, vals, context=context)
138+
139+ _columns = {
140+ 'firstname': fields.char("Firstname"),
141+ 'lastname': fields.char("Lastname", required=True)
142+ }
143
144=== added file 'hr_employee_firstname/hr_view.xml'
145--- hr_employee_firstname/hr_view.xml 1970-01-01 00:00:00 +0000
146+++ hr_employee_firstname/hr_view.xml 2014-03-04 16:23:46 +0000
147@@ -0,0 +1,29 @@
148+<?xml version="1.0" encoding="utf-8"?>
149+<openerp>
150+ <data>
151+
152+ <record id="view_employee_form" model="ir.ui.view">
153+ <field name="model">hr.employee</field>
154+ <field name="inherit_id" ref="hr.view_employee_form"/>
155+ <field name="arch" type="xml">
156+
157+ <label for="name" position="replace">
158+ <label for="firstname" class="oe_edit_only"/>
159+ </label>
160+ <field name="name" position="replace">
161+ <field name="name" invisible="True" nolabel="1" required="False"/>
162+ <field name="firstname"/>
163+ </field>
164+
165+ <label for="category_ids" position="before">
166+ <label for="lastname" class="oe_edit_only"/>
167+ <h1>
168+ <field name="lastname"/>
169+ </h1>
170+ </label>
171+
172+ </field>
173+ </record>
174+
175+ </data>
176+</openerp>
177
178=== added directory 'hr_employee_firstname/i18n'
179=== added file 'hr_employee_firstname/i18n/employee_firstname.pot'
180--- hr_employee_firstname/i18n/employee_firstname.pot 1970-01-01 00:00:00 +0000
181+++ hr_employee_firstname/i18n/employee_firstname.pot 2014-03-04 16:23:46 +0000
182@@ -0,0 +1,42 @@
183+# Translation of OpenERP Server.
184+# This file contains the translation of the following modules:
185+# * employee_firstname
186+#
187+msgid ""
188+msgstr ""
189+"Project-Id-Version: OpenERP Server 7.0\n"
190+"Report-Msgid-Bugs-To: \n"
191+"POT-Creation-Date: 2014-01-03 07:55+0000\n"
192+"PO-Revision-Date: 2014-01-03 02:55-0500\n"
193+"Last-Translator: EL Hadji DEM <elhadji.dem@savoirfairelinux.com>\n"
194+"Language-Team: \n"
195+"MIME-Version: 1.0\n"
196+"Content-Type: text/plain; charset=UTF-8\n"
197+"Content-Transfer-Encoding: 8bit\n"
198+"Plural-Forms: \n"
199+"X-Generator: Poedit 1.5.4\n"
200+
201+#. module: employee_firstname
202+#: model:ir.model,name:employee_firstname.model_hr_employee
203+msgid "Employee"
204+msgstr ""
205+
206+#. module: employee_firstname
207+#: field:hr.employee,lastname:0
208+msgid "Lastname"
209+msgstr ""
210+
211+#. module: employee_firstname
212+#: view:hr.employee:0
213+msgid "e.g. Lastname"
214+msgstr ""
215+
216+#. module: employee_firstname
217+#: field:hr.employee,firstname:0
218+msgid "Firstname"
219+msgstr ""
220+
221+#. module: employee_firstname
222+#: view:hr.employee:0
223+msgid "e.g. Firstname"
224+msgstr ""
225
226=== added file 'hr_employee_firstname/i18n/fr.po'
227--- hr_employee_firstname/i18n/fr.po 1970-01-01 00:00:00 +0000
228+++ hr_employee_firstname/i18n/fr.po 2014-03-04 16:23:46 +0000
229@@ -0,0 +1,42 @@
230+# Translation of OpenERP Server.
231+# This file contains the translation of the following modules:
232+# * employee_firstname
233+#
234+msgid ""
235+msgstr ""
236+"Project-Id-Version: OpenERP Server 7.0\n"
237+"Report-Msgid-Bugs-To: \n"
238+"POT-Creation-Date: 2014-01-03 07:56+0000\n"
239+"PO-Revision-Date: 2014-01-03 02:56-0500\n"
240+"Last-Translator: EL Hadji DEM <elhadji.dem@savoirfairelinux.com>\n"
241+"Language-Team: \n"
242+"MIME-Version: 1.0\n"
243+"Content-Type: text/plain; charset=UTF-8\n"
244+"Content-Transfer-Encoding: 8bit\n"
245+"Plural-Forms: \n"
246+"X-Generator: Poedit 1.5.4\n"
247+
248+#. module: employee_firstname
249+#: model:ir.model,name:employee_firstname.model_hr_employee
250+msgid "Employee"
251+msgstr "Employé"
252+
253+#. module: employee_firstname
254+#: field:hr.employee,lastname:0
255+msgid "Lastname"
256+msgstr "Nom"
257+
258+#. module: employee_firstname
259+#: view:hr.employee:0
260+msgid "e.g. Lastname"
261+msgstr "Nom"
262+
263+#. module: employee_firstname
264+#: field:hr.employee,firstname:0
265+msgid "Firstname"
266+msgstr "Prénom"
267+
268+#. module: employee_firstname
269+#: view:hr.employee:0
270+msgid "e.g. Firstname"
271+msgstr "Prénom"