diff --git a/odex25_hr/hr_base/models/hr_base.py b/odex25_hr/hr_base/models/hr_base.py index 6cf449a78..797eb9ae9 100644 --- a/odex25_hr/hr_base/models/hr_base.py +++ b/odex25_hr/hr_base/models/hr_base.py @@ -28,7 +28,7 @@ class HrEmployee(models.Model): _order = 'id' # iqama fields in employee view - identity_number = fields.Char(compute='_compute_identity_number', string='Identity Number',store=True) + identity_number = fields.Char(compute_sudo=True, compute='_compute_identity_number', string='Identity Number',store=True) iqama_creat_date = fields.Date(related="iqama_number.issue_date", readonly=True) iqama_expiy_date = fields.Date(related="iqama_number.expiry_date", readonly=True) iqama_job = fields.Many2one(related="iqama_number.job_id", readonly=True) @@ -78,7 +78,7 @@ class HrEmployee(models.Model): airport = fields.Char("Nearest Airport") first_hiring_date = fields.Date(string="First Hiring Date") - # duration_in_months = fields.Float(compute='_get_months_no') + # duration_in_months = fields.Float(compute_sudo=True, compute='_get_months_no') contact_no = fields.Char("Contact No") reason = fields.Char(string="Reason") r_name = fields.Char("Name") @@ -170,10 +170,10 @@ class HrEmployee(models.Model): ("widower", "Widower"), ("divorced", "Divorced")], string="Marital Status", groups="base.group_user", default="single", tracking=True) - base_salary = fields.Float(compute='compute_base_salary') - salary_in_words = fields.Char(compute='get_salary_amount') - payslip_lines = fields.One2many(comodel_name='hr.payslip.line', compute='compute_base_salary') - check_nationality = fields.Boolean(compute="_check_nationality_type") + base_salary = fields.Float(compute_sudo=True, compute='compute_base_salary') + salary_in_words = fields.Char(compute_sudo=True, compute='get_salary_amount') + payslip_lines = fields.One2many(comodel_name='hr.payslip.line', compute_sudo=True, compute='compute_base_salary') + check_nationality = fields.Boolean(compute_sudo=True, compute="_check_nationality_type") # National address address_city = fields.Many2one("address.city") address_region = fields.Many2one("address.region") @@ -185,14 +185,14 @@ class HrEmployee(models.Model): drug_type = fields.Selection([('company_property', 'Company Property'), ('property', 'Employee Property'), ('rent', 'Rent')], default="rent") apartment_number = fields.Char() - service_year = fields.Integer(compute='_compute_service_duration') - service_month = fields.Integer(compute='_compute_service_duration') - service_day = fields.Integer(compute='_compute_service_duration') - experience_year = fields.Integer(compute='_compute_duration_experience') - experience_month = fields.Integer(compute='_compute_duration_experience') - experience_day = fields.Integer(compute='_compute_duration_experience') + service_year = fields.Integer(compute_sudo=True, compute='_compute_service_duration') + service_month = fields.Integer(compute_sudo=True, compute='_compute_service_duration') + service_day = fields.Integer(compute_sudo=True, compute='_compute_service_duration') + experience_year = fields.Integer(compute_sudo=True, compute='_compute_duration_experience') + experience_month = fields.Integer(compute_sudo=True, compute='_compute_duration_experience') + experience_day = fields.Integer(compute_sudo=True, compute='_compute_duration_experience') relationship = fields.Char(string="Relationship") - employee_age = fields.Integer(string="Age", compute='_compute_employee_age', store=True) + employee_age = fields.Integer(string="Age", compute_sudo=True, compute='_compute_employee_age', store=True) personal_email = fields.Char('Personal Email') @@ -202,9 +202,9 @@ class HrEmployee(models.Model): domain="[('company_id', '=', company_id)]", help='Current contract of the employee') phone_ext = fields.Char(string="Extension Phone") - first_contract_date = fields.Date(compute='_compute_first_contract_date', groups="base.group_user") + first_contract_date = fields.Date(compute_sudo=True, compute='_compute_first_contract_date', groups="base.group_user") - contract_warning = fields.Boolean(string='Contract Warning', store=True, compute='_compute_contract_warning', + contract_warning = fields.Boolean(string='Contract Warning', store=True, compute_sudo=True, compute='_compute_contract_warning', groups="base.group_user") barcode = fields.Char(string="Badge ID", help="ID used for employee identification.", groups="base.group_user", @@ -245,7 +245,7 @@ class HrEmployee(models.Model): branch_name = fields.Many2one(related='department_id.branch_name', store=True, string="Branch Name") - '''employee_cars_count = fields.Integer(compute="_compute_employee_cars_count", string="Cars", + '''employee_cars_count = fields.Integer(compute_sudo=True, compute="_compute_employee_cars_count", string="Cars", groups="base.group_user") def _compute_employee_cars_count(self):