Browse Source

Port hr_phone to v9

pull/88/head
Alexis de Lattre 9 years ago
parent
commit
ff8fbfcfcd
  1. 19
      hr_phone/__init__.py
  2. 30
      hr_phone/__openerp__.py
  3. 46
      hr_phone/hr_phone.py
  4. 6
      hr_phone/hr_view.xml

19
hr_phone/__init__.py

@ -1,22 +1,3 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# HR Phone module for Odoo/OpenERP
# Copyright (C) 2014 Alexis de Lattre <alexis@via.ecp.fr>
#
# 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/>.
#
##############################################################################
from . import hr_phone

30
hr_phone/__openerp__.py

@ -1,28 +1,10 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# HR Phone module for OpenERP
# Copyright (C) 2014 Alexis de Lattre <alexis@via.ecp.fr>
#
# 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/>.
#
##############################################################################
# -*- coding: utf-8 -*-
# © 2014-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'HR Phone',
'version': '8.0.0.1.0',
'version': '9.0.1.0.0',
'category': 'Phone',
'license': 'AGPL-3',
'summary': 'Validate phone numbers in HR',
@ -46,8 +28,6 @@ for any help or question about this module.
'security/ir.model.access.csv',
'hr_view.xml',
],
'images': [],
'installable': False,
'installable': True,
'auto_install': True,
'active': False,
}

46
hr_phone/hr_phone.py

@ -1,29 +1,11 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# HR phone module for Odoo/OpenERP
# Copyright (c) 2012-2014 Akretion (http://www.akretion.com)
# @author: Alexis de Lattre <alexis.delattre@akretion.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/>.
#
##############################################################################
# -*- coding: utf-8 -*-
# © 2012-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp.osv import orm
from openerp import models, api
class hr_employee(orm.Model):
class HrEmployee(models.Model):
_name = 'hr.employee'
_inherit = ['hr.employee', 'phone.common']
_phone_fields = ['work_phone', 'mobile_phone']
@ -31,14 +13,12 @@ class hr_employee(orm.Model):
_country_field = 'country_id'
_partner_field = None
def create(self, cr, uid, vals, context=None):
vals_reformated = self._generic_reformat_phonenumbers(
cr, uid, None, vals, context=context)
return super(hr_employee, self).create(
cr, uid, vals_reformated, context=context)
@api.model
def create(self, vals):
vals_reformated = self._reformat_phonenumbers_create(vals)
return super(HrEmployee, self).create(vals_reformated)
def write(self, cr, uid, ids, vals, context=None):
vals_reformated = self._generic_reformat_phonenumbers(
cr, uid, ids, vals, context=context)
return super(hr_employee, self).write(
cr, uid, ids, vals_reformated, context=context)
@api.multi
def write(self, vals):
vals_reformated = self._reformat_phonenumbers_write(vals)
return super(HrEmployee, self).write(vals_reformated)

6
hr_phone/hr_view.xml

@ -1,12 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2014 Alexis de Lattre <alexis@via.ecp.fr>
The licence is in the file __openerp__.py
© 2014-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<openerp>
<data>
<record id="view_employee_form" model="ir.ui.view">
<field name="name">hr_phone.hr_employee.form</field>
<field name="model">hr.employee</field>
@ -43,5 +44,6 @@
</field>
</record>
</data>
</openerp>
Loading…
Cancel
Save