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
=== added directory 'hr_employee_firstname'
=== added file 'hr_employee_firstname/__init__.py'
--- hr_employee_firstname/__init__.py 1970-01-01 00:00:00 +0000
+++ hr_employee_firstname/__init__.py 2014-03-04 16:23:46 +0000
@@ -0,0 +1,23 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# This module copyright (C) 2010 - 2014 Savoir-faire Linux
6# (<http://www.savoirfairelinux.com>).
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from . import hr
024
=== added file 'hr_employee_firstname/__openerp__.py'
--- hr_employee_firstname/__openerp__.py 1970-01-01 00:00:00 +0000
+++ hr_employee_firstname/__openerp__.py 2014-03-04 16:23:46 +0000
@@ -0,0 +1,54 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# This module copyright (C) 2010 - 2014 Savoir-faire Linux
6# (<http://www.savoirfairelinux.com>).
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23{
24 'name': 'Employee First Name, Last Name',
25 'version': '0.1',
26 'author': 'Savoir-faire Linux',
27 'maintainer': 'Savoir-faire Linux',
28 'website': 'http://www.savoirfairelinux.com',
29 'license': 'AGPL-3',
30 'category': 'Human Resources',
31 'summary': 'Adds First Name to Employee',
32 'description': """
33Employee First Name, Last Name
34==============================
35
36This module allows you to add firstname and lastname in employee form,
37and concatenate both in name field.
38
39Contributors
40------------
41* El Hadji Dem (elhadji.dem@savoirfairelinux.com)
42* Sandy Carter (sandy.carter@savoirfairelinux.com)
43""",
44 'depends': [
45 'hr',
46 ],
47 'external_dependencies': {},
48 'data': [
49 'hr_view.xml',
50 ],
51 'demo': [],
52 'test': [],
53 'installable': True,
54}
055
=== added file 'hr_employee_firstname/hr.py'
--- hr_employee_firstname/hr.py 1970-01-01 00:00:00 +0000
+++ hr_employee_firstname/hr.py 2014-03-04 16:23:46 +0000
@@ -0,0 +1,50 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# This module copyright (C) 2010 - 2014 Savoir-faire Linux
6# (<http://www.savoirfairelinux.com>).
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from openerp.osv import orm, fields
24
25
26class hr_employee(orm.Model):
27 _inherit = 'hr.employee'
28
29 def init(self, cursor):
30 cursor.execute('''\
31SELECT id
32FROM hr_employee
33WHERE lastname IS NOT NULL
34LIMIT 1''')
35 if not cursor.fetchone():
36 cursor.execute('''\
37UPDATE hr_employee
38SET lastname = name_related
39WHERE name_related IS NOT NULL''')
40
41 def create(self, cursor, uid, vals, context=None):
42 names = (vals['firstname'], vals['lastname'])
43 vals['name'] = " ".join(s for s in names if s)
44 return super(hr_employee, self).create(
45 cursor, uid, vals, context=context)
46
47 _columns = {
48 'firstname': fields.char("Firstname"),
49 'lastname': fields.char("Lastname", required=True)
50 }
051
=== added file 'hr_employee_firstname/hr_view.xml'
--- hr_employee_firstname/hr_view.xml 1970-01-01 00:00:00 +0000
+++ hr_employee_firstname/hr_view.xml 2014-03-04 16:23:46 +0000
@@ -0,0 +1,29 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4
5 <record id="view_employee_form" model="ir.ui.view">
6 <field name="model">hr.employee</field>
7 <field name="inherit_id" ref="hr.view_employee_form"/>
8 <field name="arch" type="xml">
9
10 <label for="name" position="replace">
11 <label for="firstname" class="oe_edit_only"/>
12 </label>
13 <field name="name" position="replace">
14 <field name="name" invisible="True" nolabel="1" required="False"/>
15 <field name="firstname"/>
16 </field>
17
18 <label for="category_ids" position="before">
19 <label for="lastname" class="oe_edit_only"/>
20 <h1>
21 <field name="lastname"/>
22 </h1>
23 </label>
24
25 </field>
26 </record>
27
28 </data>
29</openerp>
030
=== added directory 'hr_employee_firstname/i18n'
=== added file 'hr_employee_firstname/i18n/employee_firstname.pot'
--- hr_employee_firstname/i18n/employee_firstname.pot 1970-01-01 00:00:00 +0000
+++ hr_employee_firstname/i18n/employee_firstname.pot 2014-03-04 16:23:46 +0000
@@ -0,0 +1,42 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * employee_firstname
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 7.0\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2014-01-03 07:55+0000\n"
10"PO-Revision-Date: 2014-01-03 02:55-0500\n"
11"Last-Translator: EL Hadji DEM <elhadji.dem@savoirfairelinux.com>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: 8bit\n"
16"Plural-Forms: \n"
17"X-Generator: Poedit 1.5.4\n"
18
19#. module: employee_firstname
20#: model:ir.model,name:employee_firstname.model_hr_employee
21msgid "Employee"
22msgstr ""
23
24#. module: employee_firstname
25#: field:hr.employee,lastname:0
26msgid "Lastname"
27msgstr ""
28
29#. module: employee_firstname
30#: view:hr.employee:0
31msgid "e.g. Lastname"
32msgstr ""
33
34#. module: employee_firstname
35#: field:hr.employee,firstname:0
36msgid "Firstname"
37msgstr ""
38
39#. module: employee_firstname
40#: view:hr.employee:0
41msgid "e.g. Firstname"
42msgstr ""
043
=== added file 'hr_employee_firstname/i18n/fr.po'
--- hr_employee_firstname/i18n/fr.po 1970-01-01 00:00:00 +0000
+++ hr_employee_firstname/i18n/fr.po 2014-03-04 16:23:46 +0000
@@ -0,0 +1,42 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * employee_firstname
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 7.0\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2014-01-03 07:56+0000\n"
10"PO-Revision-Date: 2014-01-03 02:56-0500\n"
11"Last-Translator: EL Hadji DEM <elhadji.dem@savoirfairelinux.com>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: 8bit\n"
16"Plural-Forms: \n"
17"X-Generator: Poedit 1.5.4\n"
18
19#. module: employee_firstname
20#: model:ir.model,name:employee_firstname.model_hr_employee
21msgid "Employee"
22msgstr "Employé"
23
24#. module: employee_firstname
25#: field:hr.employee,lastname:0
26msgid "Lastname"
27msgstr "Nom"
28
29#. module: employee_firstname
30#: view:hr.employee:0
31msgid "e.g. Lastname"
32msgstr "Nom"
33
34#. module: employee_firstname
35#: field:hr.employee,firstname:0
36msgid "Firstname"
37msgstr "Prénom"
38
39#. module: employee_firstname
40#: view:hr.employee:0
41msgid "e.g. Firstname"
42msgstr "Prénom"