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.

21 lines
653 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 (
  12. 'partner_id' in self and
  13. self.partner_id and
  14. self.partner_id.country_id):
  15. return self.partner_id.country_id
  16. return self.env.user.company_id.country_id