You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
746 B

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2012-2018 Akretion France
  3. # @author: Alexis de Lattre <alexis.delattre@akretion.com>
  4. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  5. from odoo import api, models
  6. class HrEmployee(models.Model):
  7. _name = 'hr.employee'
  8. _inherit = ['hr.employee', 'phone.validation.mixin']
  9. _phone_name_sequence = 30
  10. _phone_name_fields = ['work_phone', 'mobile_phone']
  11. @api.onchange('work_phone')
  12. def work_phone_change(self):
  13. if self.work_phone:
  14. self.work_phone = self.phone_format(self.work_phone)
  15. @api.onchange('mobile_phone')
  16. def mobile_phone_change(self):
  17. if self.mobile_phone:
  18. self.mobile_phone = self.phone_format(self.mobile_phone)