[19.0][MIG] hr_attendance#5705
Conversation
|
/ocabot migration hr_attendance Depends on :
|
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
|
@legalsylvain done in #5745, now setting our whole discussion as off-topic |
thanks a lot for this Job. I manually run the script a last time for the V19. new 19 PR should be handled by your script. |
|
|
||
| @openupgrade.migrate() | ||
| def migrate(env, version): | ||
| openupgrade.load_data(env, "hr_attendance", "19.0.2.0/noupdate_changes.xml") |
There was a problem hiding this comment.
For letting the record as it's in 19, we should remove the group hr_attendance.group_hr_attendance_manager from hr_attendance.hr_attendance_rule_attendance_admin record.
| ---Models in module 'hr_attendance'--- | ||
| obsolete model hr.attendance.overtime (renamed to hr.attendance.overtime.line) | ||
| new model hr.attendance.overtime.line (renamed from hr.attendance.overtime) | ||
|
|
There was a problem hiding this comment.
Why adding these empty lines that makes the reading harder? I think the comment should be together with the analysis lines block.
There was a problem hiding this comment.
well I think the empty lines improve readability. If that's so important to you, add it to https://oca.github.io/OpenUpgrade/090_contribute.html#how-to-contribute-new-migration-scripts and I'll bulk update the whole branch, as I've been doing this for a long time
|
|
||
| # NOTHING TO DO | ||
|
|
||
| hr_attendance / hr.attendance / in_location (char) : NEW |
There was a problem hiding this comment.
Reorganize this line into in_city DEL comment for seeing both together and to understand the change.
There was a problem hiding this comment.
hard disagree about reordering lines in the work file. I want to be able to say diff upgrade_analysis* to easily verify all lines from the generated file are in the work file (=only whitespace or comments in the diff)
| # date is required in v19, fill with create_date if empty, possibly wrong | ||
| env.cr.execute( | ||
| f""" | ||
| UPDATE hr_attendance_overtime_line SET date=( |
There was a problem hiding this comment.
Why not get it the same from the nearest attendance record?
There was a problem hiding this comment.
how do you propose to find the nearest record? create_date? that's just as prone to filling in a wrong date here.
I consider overtime lines without date garbage data which people should clean up, and do the update only to satisfy the non-null constraint
| SQL_EMPLOYEE2TZ = """ | ||
| ( | ||
| SELECT | ||
| hr_employee.id employee_id, |
There was a problem hiding this comment.
I find you new SQL style a bit difficult to read, and very vertical scroll intensive. Either indent the lines after the command (SELECT, FROM, etc), or put them in the same line as always.
There was a problem hiding this comment.
It's not so new, but indeed was lacking indentation
| WHERE | ||
| hr_attendance.employee_id=hr_attendance_overtime_line.employee_id | ||
| AND | ||
| hr_attendance.date=hr_attendance_overtime_line.date |
There was a problem hiding this comment.
This part may not fit according current code, and even more, we may have more than one record for the same date.
There was a problem hiding this comment.
which code do you mean? and indeed this can lead to updating the same record multiple times, but how does this matter?
| """ | ||
| Pre-fill hr.attendance#date | ||
| """ | ||
| openupgrade.add_fields( |
There was a problem hiding this comment.
Why using add_fields instead of add_columns or a simply ALTER TABLE?
There was a problem hiding this comment.
good question, changed to add_columns
No description provided.