19.0 vanilla

This commit is contained in:
Ernad Husremovic 2026-03-09 09:31:00 +01:00
parent a1137a1456
commit e1d89e11e3
2789 changed files with 1093187 additions and 605897 deletions

View file

@ -0,0 +1,26 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
from .hr_employee import _ALLOW_READ_HR_EMPLOYEE
class HrMixin(models.AbstractModel):
_name = _description = 'hr.mixin'
# Those overrides deal with many2many fields to comodel 'hr.employee'. In
# the past, one could assign such a many2many field without having any
# access to its comodel. Since Odoo 19, one must have read access to the
# comodel to modify the relation. The hack consists in passing a special
# value in the context, and pretend 'hr.employee' records to be readable
# when that value is present.
@api.model_create_multi
def create(self, vals_list):
special_self = self.with_context(_allow_read_hr_employee=_ALLOW_READ_HR_EMPLOYEE)
records = super(HrMixin, special_self).create(vals_list)
return records.with_env(self.env)
def write(self, vals):
special_self = self.with_context(_allow_read_hr_employee=_ALLOW_READ_HR_EMPLOYEE)
return super(HrMixin, special_self).write(vals)