diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-02-05 16:20:48 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-02-05 16:20:48 +0100 |
| commit | eefca5d492d6f35dd4b063a294b6b8a0a576e83e (patch) | |
| tree | 0776e0015aaca70d5d71986846391466a12516e4 /addons/hr/models/hr.py | |
| parent | 1ed7f219a59a2ff036bcaf72cb423b961a39802c (diff) | |
| parent | 73610ff99216ff31eedb6c0a587846ce9209e095 (diff) | |
[MERGE] forward port branch saas-11.1 up to 73610ff9921
Diffstat (limited to 'addons/hr/models/hr.py')
| -rw-r--r-- | addons/hr/models/hr.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/addons/hr/models/hr.py b/addons/hr/models/hr.py index 7e4c2060a9d..49d8a9e0859 100644 --- a/addons/hr/models/hr.py +++ b/addons/hr/models/hr.py @@ -5,7 +5,7 @@ import logging from odoo import api, fields, models from odoo import tools, _ -from odoo.exceptions import ValidationError +from odoo.exceptions import ValidationError, AccessError from odoo.modules.module import get_module_resource _logger = logging.getLogger(__name__) @@ -116,7 +116,6 @@ class Employee(models.Model): is_address_home_a_company = fields.Boolean( 'The employee adress has a company linked', compute='_compute_is_address_home_a_company', - groups="hr.group_hr_user", ) country_id = fields.Many2one( 'res.country', 'Nationality (Country)', groups="hr.group_hr_user") @@ -271,7 +270,11 @@ class Employee(models.Model): """Checks that choosen address (res.partner) is not linked to a company. """ for employee in self: - employee.is_address_home_a_company = employee.address_home_id.parent_id.id is not False + try: + employee.is_address_home_a_company = employee.address_home_id.parent_id.id is not False + except AccessError: + employee.is_address_home_a_company = False + class Department(models.Model): _name = "hr.department" |
