From 2e8e82401c17c45e6ee92dcb803d17c0fbccf19c Mon Sep 17 00:00:00 2001 From: Sara Lago Date: Mon, 23 Nov 2020 14:07:24 +0100 Subject: [PATCH] [IMP] add sale channel views --- pms/__manifest__.py | 1 + pms/data/pms_data.xml | 17 +++++++++++++ pms/models/__init__.py | 1 + pms/models/pms_reservation.py | 14 ++++++----- pms/security/ir.model.access.csv | 2 ++ pms/views/pms_reservation_views.xml | 4 +-- pms/views/pms_sale_channel.xml | 39 +++++++++++++++++++++++++++++ pms/views/res_partner_views.xml | 16 +++++------- 8 files changed, 76 insertions(+), 18 deletions(-) create mode 100644 pms/views/pms_sale_channel.xml diff --git a/pms/__manifest__.py b/pms/__manifest__.py index b541bb84a..a9e6c1db9 100644 --- a/pms/__manifest__.py +++ b/pms/__manifest__.py @@ -60,6 +60,7 @@ "views/res_partner_views.xml", "views/product_pricelist_views.xml", "views/product_pricelist_item_views.xml", + "views/pms_sale_channel.xml", "views/product_template_views.xml", "views/webclient_templates.xml", "views/ir_sequence_views.xml", diff --git a/pms/data/pms_data.xml b/pms/data/pms_data.xml index 1a55c1da1..3152d83f7 100644 --- a/pms/data/pms_data.xml +++ b/pms/data/pms_data.xml @@ -34,5 +34,22 @@ + + + Door + Direct + + + Phone + Direct + + + Mail + Direct + + + Agency + Indirect + diff --git a/pms/models/__init__.py b/pms/models/__init__.py index 5343f0ca8..92f2ace63 100644 --- a/pms/models/__init__.py +++ b/pms/models/__init__.py @@ -31,6 +31,7 @@ from . import pms_checkin_partner from . import product_pricelist from . import product_pricelist_item from . import res_partner +from . import pms_sale_channel # from . import mail_compose_message from . import pms_room_type_class diff --git a/pms/models/pms_reservation.py b/pms/models/pms_reservation.py index ac5077310..9c71e2f00 100644 --- a/pms/models/pms_reservation.py +++ b/pms/models/pms_reservation.py @@ -824,19 +824,21 @@ class PmsReservation(models.Model): @api.model def create(self, vals): - if "folio_id" in vals and "channel_type" not in vals: + if "folio_id" in vals and "channel_type_id" not in vals: folio = self.env["pms.folio"].browse(vals["folio_id"]) - channel_type = ( - vals["channel_type"] if "channel_type" in vals else folio.channel_type + channel_type_id = ( + vals["channel_type_id"] + if "channel_type_id" in vals + else folio.channel_type_id ) partner_id = ( vals["partner_id"] if "partner_id" in vals else folio.partner_id.id ) - vals.update({"channel_type": channel_type, "partner_id": partner_id}) + vals.update({"channel_type_id": channel_type_id, "partner_id": partner_id}) elif "partner_id" in vals: folio_vals = { "partner_id": int(vals.get("partner_id")), - "channel_type": vals.get("channel_type"), + "channel_type_id": vals.get("channel_type_id"), } # Create the folio in case of need # (To allow to create reservations direct) @@ -845,7 +847,7 @@ class PmsReservation(models.Model): { "folio_id": folio.id, "reservation_type": vals.get("reservation_type"), - "channel_type": vals.get("channel_type"), + "channel_type_id": vals.get("channel_type_id"), } ) record = super(PmsReservation, self).create(vals) diff --git a/pms/security/ir.model.access.csv b/pms/security/ir.model.access.csv index 02f4a382b..2c6a46253 100644 --- a/pms/security/ir.model.access.csv +++ b/pms/security/ir.model.access.csv @@ -24,6 +24,7 @@ user_access_pms_cancelation_rule,user_access_pms_cancelation_rule,model_pms_canc user_access_account_full_reconcile,user_access_account_full_reconcile,account.model_account_full_reconcile,pms.group_pms_user,1,1,1,1 user_access_property,user_access_property,model_pms_property,pms.group_pms_user,1,0,0,0 user_access_availability,user_access_availability,model_pms_room_type_availability,pms.group_pms_user,1,0,0,0 +user_access_pms_sale_channel,user_access_pms_sale_channel,model_pms_sale_channel,pms.group_pms_user,1,0,0,0 manager_access_pms_floor,manager_access_pms_floor,model_pms_floor,pms.group_pms_manager,1,1,1,1 manager_access_pms_amenity,manager_access_pms_amenity,model_pms_amenity,pms.group_pms_manager,1,1,1,1 manager_access_pms_amenity_type,manager_access_pms_amenity_type,model_pms_amenity_type,pms.group_pms_manager,1,1,1,1 @@ -47,4 +48,5 @@ manager_access_pms_board_service_line,manager_access_pms_board_service_line,mode manager_access_property,manager_access_property,model_pms_property,pms.group_pms_manager,1,1,1,1 manager_access_pms_cancelation_rule,manager_access_pms_cancelation_rule,model_pms_cancelation_rule,pms.group_pms_manager,1,1,1,1 manager_access_availability,manager_access_availability,model_pms_room_type_availability,pms.group_pms_manager,1,1,1,1 +manager_access_pms_sale_channel,manager_access_pms_sale_channel,model_pms_sale_channel,pms.group_pms_manager,1,1,1,1 user_access_pms_reservation_wizard,user_access_pms_reservation_wizard,model_pms_reservation_wizard,pms.group_pms_user,1,1,1,1 diff --git a/pms/views/pms_reservation_views.xml b/pms/views/pms_reservation_views.xml index bcdde8c26..a49fc2c60 100644 --- a/pms/views/pms_reservation_views.xml +++ b/pms/views/pms_reservation_views.xml @@ -289,8 +289,6 @@ name="agency_id" options="{'no_create': True,'no_open': True}" />--> - - + + + + + pms.sale.channel.form + pms.sale.channel + +
+ + + + + + +
+
+
+ + pms.sale.channel.tree + pms.sale.channel + + + + + + + + + Sale Channel + pms.sale.channel + tree,form + + +
diff --git a/pms/views/res_partner_views.xml b/pms/views/res_partner_views.xml index dd8ce2f40..f7d35348d 100644 --- a/pms/views/res_partner_views.xml +++ b/pms/views/res_partner_views.xml @@ -39,19 +39,15 @@ - + - -