partner-contact/partner_phone_secondary/models/res_partner.py

18 lines
529 B
Python
Raw Permalink Normal View History

2021-03-23 19:13:18 +00:00
# Copyright 2020 - Iván Todorovich
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from flectra import api, fields, models
class ResPartner(models.Model):
_inherit = "res.partner"
phone2 = fields.Char("Phone (Secondary)")
@api.onchange("phone2", "country_id", "company_id")
def _onchange_phone2_validation(self):
# Compatibility with phone_validation
if hasattr(self, "phone_format"):
if self.phone2:
self.phone2 = self.phone_format(self.phone2)