From 1ad4f68148fadb09d79ae307a4d0eff4aeee1198 Mon Sep 17 00:00:00 2001 From: braisab Date: Tue, 26 Dec 2023 12:21:33 +0100 Subject: [PATCH] [IMP]pms: added field to filter segmentations that are only used at check-in --- pms/README.rst | 2 +- pms/__manifest__.py | 1 + pms/models/__init__.py | 1 + pms/models/pms_checkin_partner.py | 1 + pms/models/pms_folio.py | 1 + pms/models/pms_reservation.py | 1 + pms/models/res_partner_category.py | 7 +++++++ pms/static/description/index.html | 2 +- pms/views/res_partner_category.xml | 14 ++++++++++++++ pms/wizards/pms_booking_duplicate.py | 1 + pms/wizards/pms_booking_engine.py | 1 + 11 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 pms/models/res_partner_category.py create mode 100644 pms/views/res_partner_category.xml diff --git a/pms/README.rst b/pms/README.rst index bad80030ea..91414fbd47 100644 --- a/pms/README.rst +++ b/pms/README.rst @@ -7,7 +7,7 @@ PMS (Property Management System) !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:f4de1bfaabc4df67eda74523262d7db3d537c6aebf1b400df5180f4a326f0fc6 + !! source digest: sha256:6c5b31264d3e7504c6c81ec1ae9fc2222be30ccd7362e5d444f6d7cfe97069fa !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png diff --git a/pms/__manifest__.py b/pms/__manifest__.py index 4d1d8d1d60..66a4624292 100644 --- a/pms/__manifest__.py +++ b/pms/__manifest__.py @@ -102,6 +102,7 @@ "views/payment_acquirer_views.xml", "views/account_analytic_distribution_view.xml", "views/account_analytic_line_view.xml", + "views/res_partner_category.xml", ], "demo": [ "demo/pms_master_data_no_update.xml", diff --git a/pms/models/__init__.py b/pms/models/__init__.py index 7713519bc8..b2f6cc7021 100644 --- a/pms/models/__init__.py +++ b/pms/models/__init__.py @@ -50,3 +50,4 @@ from . import ir_pms_property from . import payment_acquirer from . import account_analytic_line +from . import res_partner_category diff --git a/pms/models/pms_checkin_partner.py b/pms/models/pms_checkin_partner.py index cb4300acf0..ac21121d83 100644 --- a/pms/models/pms_checkin_partner.py +++ b/pms/models/pms_checkin_partner.py @@ -93,6 +93,7 @@ class PmsCheckinPartner(models.Model): help="Segmentation tags to classify checkin partners", readonly=True, related="reservation_id.segmentation_ids", + domain="[('is_used_in_checkin', '=', True)]", ) checkin = fields.Date( string="Checkin", diff --git a/pms/models/pms_folio.py b/pms/models/pms_folio.py index 63f0213311..a57ae975e3 100644 --- a/pms/models/pms_folio.py +++ b/pms/models/pms_folio.py @@ -356,6 +356,7 @@ class PmsFolio(models.Model): help="Segmentation tags to classify folios", comodel_name="res.partner.category", ondelete="restrict", + domain="[('is_used_in_checkin', '=', True)]", ) reservation_type = fields.Selection( string="Type", diff --git a/pms/models/pms_reservation.py b/pms/models/pms_reservation.py index 32bf0ca36f..1b5f3d342d 100644 --- a/pms/models/pms_reservation.py +++ b/pms/models/pms_reservation.py @@ -327,6 +327,7 @@ class PmsReservation(models.Model): default=lambda self: self._get_default_segmentation(), comodel_name="res.partner.category", ondelete="restrict", + domain="[('is_used_in_checkin', '=', True)]", ) currency_id = fields.Many2one( string="Currency", diff --git a/pms/models/res_partner_category.py b/pms/models/res_partner_category.py new file mode 100644 index 0000000000..2ea27075cf --- /dev/null +++ b/pms/models/res_partner_category.py @@ -0,0 +1,7 @@ +from odoo import fields, models + + +class ResPartnerCategory(models.Model): + _inherit = "res.partner.category" + + is_used_in_checkin = fields.Boolean(string="Used in checkin") diff --git a/pms/static/description/index.html b/pms/static/description/index.html index b0383878a3..f9f2d0b408 100644 --- a/pms/static/description/index.html +++ b/pms/static/description/index.html @@ -367,7 +367,7 @@

PMS (Property Management System)

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:f4de1bfaabc4df67eda74523262d7db3d537c6aebf1b400df5180f4a326f0fc6 +!! source digest: sha256:6c5b31264d3e7504c6c81ec1ae9fc2222be30ccd7362e5d444f6d7cfe97069fa !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Beta License: AGPL-3 OCA/pms Translate me on Weblate Try me on Runboat

This module is an all-in-one property management system (PMS) focused on medium-sized properties diff --git a/pms/views/res_partner_category.xml b/pms/views/res_partner_category.xml new file mode 100644 index 0000000000..26f11182d2 --- /dev/null +++ b/pms/views/res_partner_category.xml @@ -0,0 +1,14 @@ + + + + view.partner.category.form.inherited + res.partner.category + + + + + + + + + diff --git a/pms/wizards/pms_booking_duplicate.py b/pms/wizards/pms_booking_duplicate.py index 91ee57a89f..1d98403dbd 100644 --- a/pms/wizards/pms_booking_duplicate.py +++ b/pms/wizards/pms_booking_duplicate.py @@ -50,6 +50,7 @@ class BookingDuplicate(models.TransientModel): compute="_compute_segmentation_ids", store=True, readonly=False, + domain="[('is_used_in_checkin', '=', True)]", ) partner_name = fields.Char( string="Partner name", diff --git a/pms/wizards/pms_booking_engine.py b/pms/wizards/pms_booking_engine.py index bb7a26e9f1..6c6e100a95 100644 --- a/pms/wizards/pms_booking_engine.py +++ b/pms/wizards/pms_booking_engine.py @@ -40,6 +40,7 @@ class BookingEngine(models.TransientModel): help="Partner Tags", ondelete="restrict", comodel_name="res.partner.category", + domain="[('is_used_in_checkin', '=', True)]", ) partner_name = fields.Char( string="Partner name",