|
@ -1,10 +1,9 @@ |
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
|
# Copyright 2016-2018 Akretion France |
|
|
|
|
|
|
|
|
# Copyright 2016-2019 Akretion France (http://www.akretion.com/) |
|
|
# @author: Alexis de Lattre <alexis.delattre@akretion.com> |
|
|
# @author: Alexis de Lattre <alexis.delattre@akretion.com> |
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from odoo import models |
|
|
|
|
|
|
|
|
from odoo import api, models |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ResPartner(models.Model): |
|
|
class ResPartner(models.Model): |
|
@ -28,3 +27,18 @@ class ResPartner(models.Model): |
|
|
return res |
|
|
return res |
|
|
else: |
|
|
else: |
|
|
return super(ResPartner, self).name_get() |
|
|
return super(ResPartner, self).name_get() |
|
|
|
|
|
|
|
|
|
|
|
# These 2 onchange have the same name (and same code) than in the |
|
|
|
|
|
# module crm_phone_validation ; but we don't depend on that module |
|
|
|
|
|
# because we don't want base_phone to depend on crm. |
|
|
|
|
|
# When both base_phone AND crm_phone_validation are installed, |
|
|
|
|
|
# as the methods have the same name, only one of the 2 will be executed |
|
|
|
|
|
@api.onchange('phone', 'country_id', 'company_id') |
|
|
|
|
|
def _onchange_phone_validation(self): |
|
|
|
|
|
if self.phone: |
|
|
|
|
|
self.phone = self.phone_format(self.phone) |
|
|
|
|
|
|
|
|
|
|
|
@api.onchange('mobile', 'country_id', 'company_id') |
|
|
|
|
|
def _onchange_mobile_validation(self): |
|
|
|
|
|
if self.mobile: |
|
|
|
|
|
self.mobile = self.phone_format(self.mobile) |