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.

18 lines
602 B

  1. # -*- coding: utf-8 -*-
  2. # Copyright 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 models
  6. class PhoneValidationMixin(models.AbstractModel):
  7. _inherit = 'phone.validation.mixin'
  8. def _phone_get_country(self):
  9. if 'country_id' in self and self.country_id:
  10. return self.country_id
  11. if 'partner_id' in self and self.partner_id and self.partner_id.country_id:
  12. return self.partner_id.country_id
  13. return self.env.user.company_id.country_id