mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[ADD] multichannels migration scripts
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
{
|
||||
"name": "PMS (Property Management System)",
|
||||
"summary": "A property management system",
|
||||
"version": "14.0.2.35.1",
|
||||
"version": "14.0.2.36.1",
|
||||
"development_status": "Beta",
|
||||
"category": "Generic Modules/Property Management System",
|
||||
"website": "https://github.com/OCA/pms",
|
||||
|
||||
@@ -7,7 +7,7 @@ def migrate(env, version):
|
||||
env.cr,
|
||||
"""
|
||||
UPDATE pms_reservation
|
||||
SET to_send_confirmation_mail = to_send_mail,
|
||||
SET to_send_confirmation_mail = False,
|
||||
to_send_cancelation_mail = False,
|
||||
to_send_exit_mail = False,
|
||||
to_send_modification_mail = False;
|
||||
|
||||
32
pms/migrations/14.0.2.36.1/post-migration.py
Normal file
32
pms/migrations/14.0.2.36.1/post-migration.py
Normal file
@@ -0,0 +1,32 @@
|
||||
import logging
|
||||
|
||||
from openupgradelib import openupgrade
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@openupgrade.migrate()
|
||||
def migrate(env, version):
|
||||
openupgrade.logged_query(
|
||||
env.cr,
|
||||
"""
|
||||
UPDATE pms_reservation_line rl
|
||||
SET sale_channel_id = r.sale_channel_origin_id
|
||||
FROM pms_reservation r
|
||||
WHERE r.id = rl.reservation_id
|
||||
""",
|
||||
)
|
||||
openupgrade.logged_query(
|
||||
env.cr,
|
||||
"""
|
||||
UPDATE pms_service ser
|
||||
SET sale_channel_origin_id = fol.sale_channel_origin_id
|
||||
FROM pms_folio fol
|
||||
WHERE fol.id = ser.folio_id
|
||||
""",
|
||||
)
|
||||
|
||||
_logger.info("Recompute reservations sale channel ids...")
|
||||
env["pms.reservation"].search(
|
||||
[("reservation_type", "!=", "out")]
|
||||
)._compute_sale_channel_ids()
|
||||
11
pms/migrations/14.0.2.36.1/pre-migration.py
Normal file
11
pms/migrations/14.0.2.36.1/pre-migration.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from openupgradelib import openupgrade
|
||||
|
||||
_field_renames = [
|
||||
("pms.folio", "pms_folio", "channel_type_id", "sale_channel_origin_id"),
|
||||
("pms.reservation", "pms_reservation", "channel_type_id", "sale_channel_origin_id"),
|
||||
]
|
||||
|
||||
|
||||
@openupgrade.migrate()
|
||||
def migrate(env, version):
|
||||
openupgrade.rename_fields(env, _field_renames)
|
||||
@@ -146,9 +146,8 @@ class PmsReservation(models.Model):
|
||||
compute="_compute_force_update_origin",
|
||||
)
|
||||
is_origin_channel_check_visible = fields.Boolean(
|
||||
string="Update Sale Channel Origin",
|
||||
help="This field is for force update in sale channel "
|
||||
"origin of folio and another reservations",
|
||||
string="Check force update origin visible",
|
||||
help="Technical field to make visible update " "origin channel check",
|
||||
store=True,
|
||||
readonly=False,
|
||||
compute="_compute_is_origin_channel_check_visible",
|
||||
|
||||
Reference in New Issue
Block a user