Skip to content

Commit

Permalink
[MIG] hr_employee_firstname: Migrated to 10.0 (OCA#276)
Browse files Browse the repository at this point in the history
  • Loading branch information
espo-tony authored and Fekete Mihai committed Nov 14, 2017
1 parent 97efeba commit f6a0043
Show file tree
Hide file tree
Showing 20 changed files with 87 additions and 182 deletions.
12 changes: 7 additions & 5 deletions hr_employee_firstname/README.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:alt: License: AGPL-3
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

HR Employee First Name, Last Name
=================================
Expand All @@ -12,7 +13,7 @@ Installation

To install this module, you need to:

* clone the branch 8.0 of the repository https://github.com/OCA/hr
* clone the branch 10.0 of the repository https://github.com/OCA/hr
* add the path to this repository in your configuration (addons-path)
* update the module list
* search for "HR Employee First Name, Last Name" in your addons
Expand Down Expand Up @@ -43,18 +44,19 @@ Contributors
* Fekete Mihai <[email protected]>
* David Dufresne <[email protected]>
* Adrien Peiffer (ACSONE) <[email protected]>
* Antonio Esposito (ONESTEIN BV) <[email protected]>

Maintainer
----------

.. image:: http://odoo-community.org/logo.png
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: http://odoo-community.org
:target: https://odoo-community.org

This module is maintained by the OCA.

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

To contribute to this module, please visit http://odoo-community.org.
To contribute to this module, please visit https://odoo-community.org.
23 changes: 3 additions & 20 deletions hr_employee_firstname/__init__.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2010 - 2014 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# Copyright (C) 2010 - 2014 Savoir-faire Linux (<http://www.savoirfairelinux.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
from .init_hook import post_init_hook
27 changes: 5 additions & 22 deletions hr_employee_firstname/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,10 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2010 - 2014 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# © 2010 - 2014 Savoir-faire Linux (<http://www.savoirfairelinux.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
'name': 'HR Employee First Name, Last Name',
'version': '8.0.0.0.2',
'version': '10.0.1.0.0',
'author': "Savoir-faire Linux, "
"Fekete Mihai (Forest and Biomass Services Romania), "
"Odoo Community Association (OCA)",
Expand All @@ -38,7 +20,8 @@
'data': [
'views/hr_view.xml',
],
"post_init_hook": "post_init_hook",
'demo': [],
'test': [],
'installable': False,
'installable': True,
}
2 changes: 1 addition & 1 deletion hr_employee_firstname/i18n/ar.po
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: hr (8.0)\n"
"Project-Id-Version: hr (10.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-11-30 05:19+0000\n"
"PO-Revision-Date: 2015-08-13 14:31+0000\n"
Expand Down
2 changes: 1 addition & 1 deletion hr_employee_firstname/i18n/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-04-24 10:20+0000\n"
"PO-Revision-Date: 2015-04-24 10:20+0000\n"
Expand Down
2 changes: 1 addition & 1 deletion hr_employee_firstname/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Antonio Trueba, 2016
msgid ""
msgstr ""
"Project-Id-Version: hr (8.0)\n"
"Project-Id-Version: hr (10.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-11-30 05:19+0000\n"
"PO-Revision-Date: 2016-02-05 12:48+0000\n"
Expand Down
2 changes: 1 addition & 1 deletion hr_employee_firstname/i18n/fi.po
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: hr (8.0)\n"
"Project-Id-Version: hr (10.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-04-14 04:15+0000\n"
"PO-Revision-Date: 2016-04-04 11:07+0000\n"
Expand Down
2 changes: 1 addition & 1 deletion hr_employee_firstname/i18n/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-04-24 10:20+0000\n"
"PO-Revision-Date: 2015-04-24 10:20+0000\n"
Expand Down
32 changes: 0 additions & 32 deletions hr_employee_firstname/i18n/hr_employee_firstname.pot

This file was deleted.

2 changes: 1 addition & 1 deletion hr_employee_firstname/i18n/it.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Paolo Valier, 2016
msgid ""
msgstr ""
"Project-Id-Version: hr (8.0)\n"
"Project-Id-Version: hr (10.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-03-12 12:02+0000\n"
"PO-Revision-Date: 2016-03-19 10:38+0000\n"
Expand Down
2 changes: 1 addition & 1 deletion hr_employee_firstname/i18n/nl_NL.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# lfreeke <[email protected]>, 2015
msgid ""
msgstr ""
"Project-Id-Version: hr (8.0)\n"
"Project-Id-Version: hr (10.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-10-03 22:37+0000\n"
"PO-Revision-Date: 2015-09-28 20:59+0000\n"
Expand Down
2 changes: 1 addition & 1 deletion hr_employee_firstname/i18n/pt_BR.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# danimaribeiro <[email protected]>, 2016
msgid ""
msgstr ""
"Project-Id-Version: hr (8.0)\n"
"Project-Id-Version: hr (10.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-03-11 01:48+0000\n"
"PO-Revision-Date: 2016-03-08 03:18+0000\n"
Expand Down
2 changes: 1 addition & 1 deletion hr_employee_firstname/i18n/ro.po
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-04-24 10:20+0000\n"
"PO-Revision-Date: 2015-04-24 10:20+0000\n"
Expand Down
2 changes: 1 addition & 1 deletion hr_employee_firstname/i18n/sl.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Matjaž Mozetič <[email protected]>, 2015
msgid ""
msgstr ""
"Project-Id-Version: hr (8.0)\n"
"Project-Id-Version: hr (10.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-08-18 13:10+0000\n"
"PO-Revision-Date: 2015-08-16 11:40+0000\n"
Expand Down
11 changes: 11 additions & 0 deletions hr_employee_firstname/init_hook.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Onestein (<http://www.onestein.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import SUPERUSER_ID
from odoo.api import Environment


def post_init_hook(cr, pool):
env = Environment(cr, SUPERUSER_ID, {})
env['hr.employee']._update_employee_names()
22 changes: 2 additions & 20 deletions hr_employee_firstname/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2010 - 2014 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# © 2010 - 2014 Savoir-faire Linux (<http://www.savoirfairelinux.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import hr_employee
40 changes: 9 additions & 31 deletions hr_employee_firstname/models/hr_employee.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,10 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2010 - 2014 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# © 2010 - 2014 Savoir-faire Linux (<http://www.savoirfairelinux.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp import models, fields, api, SUPERUSER_ID
from odoo import models, fields, api

UPDATE_PARTNER_FIELDS = set(['firstname', 'lastname', 'user_id',
'address_home_id'])
UPDATE_PARTNER_FIELDS = ['firstname', 'lastname', 'user_id', 'address_home_id']


class HrEmployee(models.Model):
Expand All @@ -34,11 +15,6 @@ def split_name(self, name):
clean_name = u" ".join(name.split(None)) if name else name
return self.env['res.partner']._get_inverse_name(clean_name)

@api.cr_context
def _auto_init(self, cr, context=None):
super(HrEmployee, self)._auto_init(cr, context=context)
self._update_employee_names(cr, SUPERUSER_ID, context=context)

@api.model
def _update_employee_names(self):
employees = self.search([
Expand All @@ -64,11 +40,13 @@ def _update_partner_firstname(self, employee):
def _get_name(self, lastname, firstname):
return self.env['res.partner']._get_computed_name(lastname, firstname)

@api.one
@api.multi
@api.onchange('firstname', 'lastname')
def get_name(self):
if self.firstname and self.lastname:
self.name = self._get_name(self.lastname, self.firstname)
for employee in self:
if employee.firstname and employee.lastname:
employee.name = self._get_name(
employee.lastname, employee.firstname)

def _firstname_default(self):
return ' ' if self.env.context.get('module') else False
Expand Down
3 changes: 3 additions & 0 deletions hr_employee_firstname/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2014 Savoir-faire Linux. All Rights Reserved.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import test_hr_employee_firstname
Loading

0 comments on commit f6a0043

Please sign in to comment.