Skip to content

Commit

Permalink
[MIG] resource: migrate to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
haumenphai authored and royle-vietnam committed May 20, 2024
1 parent 7f2de62 commit aba5d69
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docsource/modules160-170.rst
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ Module coverage 16.0 -> 17.0
+---------------------------------------------------+----------------------+-------------------------------------------------+
| repair | | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
| resource | | |
| resource |Done | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
| sale | | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
Expand Down
17 changes: 17 additions & 0 deletions openupgrade_scripts/scripts/resource/17.0.1.1/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2024 Viindoo Technology Joint Stock Company (Viindoo)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openupgradelib import openupgrade

_deleted_xml_records = [
"resource.resource_calendar_std_35h",
"resource.resource_calendar_std_38h",
]


@openupgrade.migrate()
def migrate(env, version):
openupgrade.delete_records_safely_by_xml_id(
env,
_deleted_xml_records,
)
16 changes: 16 additions & 0 deletions openupgrade_scripts/scripts/resource/17.0.1.1/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2024 Viindoo Technology Joint Stock Company (Viindoo)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
openupgrade.set_xml_ids_noupdate_value(
env,
"resource",
[
"resource_calendar_std",
],
True,
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ resource / resource.calendar.attendance / _order : _o
resource / resource.calendar.attendance / day_period (selection) : selection_keys is now '['afternoon', 'lunch', 'morning']' ('['afternoon', 'morning']')
resource / resource.calendar.attendance / duration_days (float) : NEW hasdefault: compute
---XML records in module 'resource'---
DEL ir.model.constraint: resource.constraint_resource_resource_check_time_efficiency
resource.calendar: resource.resource_calendar_std (noupdate) (noupdate switched)
DEL resource.calendar: resource.resource_calendar_std_35h (noupdate)
DEL resource.calendar: resource.resource_calendar_std_38h (noupdate)
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---Models in module 'resource'---
---Fields in module 'resource'---
resource / resource.calendar / hours_per_day (float) : now a function
# Nothing To Do, compute non-stored

resource / resource.calendar.attendance / _order : _order is now 'sequence, week_type, dayofweek, hour_from' ('week_type, dayofweek, hour_from')
# Nothing To Do, default order when search

resource / resource.calendar.attendance / day_period (selection) : selection_keys is now '['afternoon', 'lunch', 'morning']' ('['afternoon', 'morning']')
# Nothing To Do, new option: lunch

resource / resource.calendar.attendance / duration_days (float) : NEW hasdefault: compute
# Nothing To Do, no need precomputation

---XML records in module 'resource'---
resource.calendar: resource.resource_calendar_std (noupdate) (noupdate switched)
# DONE: switched noupdate

DEL resource.calendar: resource.resource_calendar_std_35h (noupdate)
DEL resource.calendar: resource.resource_calendar_std_38h (noupdate)
# DONE: safely delete in post-migration

0 comments on commit aba5d69

Please sign in to comment.