[IMP] hr: make work permit fields versioned - #5219
Conversation
|
This PR targets the un-managed branch odoo-dev/odoo:master-hr-onboarding-tomic, it needs to be retargeted before it can be merged. |
YassinWalid
left a comment
There was a problem hiding this comment.
Thanks for your work. I left some comments/suggestions.
Also, I believe we'll need an upgrade script to migrate the values previously on the employee to be assigned to the new fields on versions.
There was a problem hiding this comment.
Why didn't we remove this? (since it is no longer done on the employee, and this function will never be called)
| permit_no = fields.Char('Work Permit No', groups="hr.group_hr_user", tracking=True) | ||
| visa_no = fields.Char('Visa No', groups="hr.group_hr_user", tracking=True) | ||
| visa_expire = fields.Date('Visa Expiration Date', groups="hr.group_hr_user", tracking=True) | ||
| work_permit_expiration_date = fields.Date('Work Permit Expiration Date', groups="hr.group_hr_user", tracking=True) | ||
| has_work_permit = fields.Binary(string="Work Permit", groups="hr.group_hr_user") | ||
| work_permit_scheduled_activity = fields.Boolean(default=False, groups="hr.group_hr_user") | ||
| work_permit_name = fields.Char('work_permit_name', compute='_compute_work_permit_name', groups="hr.group_hr_user") |
There was a problem hiding this comment.
why didn't you make these fields related to the new version fields, such that they can still be accessed from the employee right away, but corresponding to the correct version
| @api.depends('name', 'permit_no') | ||
| def _compute_work_permit_name(self): | ||
| for version in self: | ||
| name = version.name.replace(' ', '_') + '_' if version.name else '' | ||
| permit_no = '_' + version.permit_no if version.permit_no else '' | ||
| version.work_permit_name = "%swork_permit%s" % (name, permit_no) |
There was a problem hiding this comment.
I believe the version name is just a date, so if you put the date and then the permit number, it'll be unreadable. I believe we could still use the employee name, along with the permit number. (this is just my suggestion, do you have a specific reasoning for this?)
0768d5a to
0a314b1
Compare
Currently, the work permit information (such as `permit_no` and its associated fields) is stored directly on the `hr.employee` model. This prevents keeping an accurate history of an employee's work permit details over time as their status evolves. To address this, move `permit_no` and its related work permit fields (`work_permit_expiration_date`, `work_permit_name`, `work_permit_scheduled_activity`) from `hr.employee` to `hr.version`. The fields are now versioned on `hr.version` and accessed via delegation on `hr.employee`. Task: 6448688
07c3a2f to
1036472
Compare
Currently, the work permit information (such as
permit_noand its associated fields) is stored directly on thehr.employeemodel.This prevents keeping an accurate history of an employee's work permit details over time as their status evolves.
To address this, move
permit_noand its related work permit fields (work_permit_expiration_date,work_permit_name,work_permit_scheduled_activity) fromhr.employeetohr.version. The fields are now versioned onhr.versionand accessed via delegation onhr.employee.Task: 6448688