diff --git a/pms/data/pms_data.xml b/pms/data/pms_data.xml
index 5345432e5..f5f4b88d8 100644
--- a/pms/data/pms_data.xml
+++ b/pms/data/pms_data.xml
@@ -18,7 +18,6 @@
https://www.commitsun.com
-
diff --git a/pms/data/pms_sequence.xml b/pms/data/pms_sequence.xml
index 3af5fe1d4..98d171f72 100644
--- a/pms/data/pms_sequence.xml
+++ b/pms/data/pms_sequence.xml
@@ -8,13 +8,6 @@
5
-
- PMS Reservation
- pms.reservation
- R%(y)s
- 6
-
-
PMS Checkin
pms.checkin.partner
diff --git a/pms/demo/pms_master_data.xml b/pms/demo/pms_master_data.xml
index b4dfbcf0c..23f6dd3fd 100644
--- a/pms/demo/pms_master_data.xml
+++ b/pms/demo/pms_master_data.xml
@@ -28,14 +28,6 @@
4
-
- PMS Reservation 2
- pms.reservation
- R/%(y)s
- %(sec)s
- 4
-
-
PMS Checkin 2
pms.checkin.partner
@@ -51,7 +43,6 @@
-
diff --git a/pms/models/pms_property.py b/pms/models/pms_property.py
index 518170449..a420ef3fb 100644
--- a/pms/models/pms_property.py
+++ b/pms/models/pms_property.py
@@ -67,13 +67,6 @@ class PmsProperty(models.Model):
copy=False,
comodel_name="ir.sequence",
)
- reservation_sequence_id = fields.Many2one(
- string="Reservation Sequence",
- help="The sequence that formed the name of the reservation.",
- check_company=True,
- copy=False,
- comodel_name="ir.sequence",
- )
checkin_sequence_id = fields.Many2one(
string="Checkin Sequence",
help="Field used to create the name of the checkin partner",
@@ -510,20 +503,6 @@ class PmsProperty(models.Model):
}
)
vals.update({"folio_sequence_id": folio_sequence.id})
- if "reservation_sequence_id" not in vals or not vals.get(
- "reservation_sequence_id"
- ):
- reservation_sequence = self.env["ir.sequence"].create(
- {
- "name": "PMS Reservation " + name,
- "code": "pms.reservation",
- "prefix": "R/%(y)s",
- "suffix": "%(sec)s",
- "padding": 4,
- "company_id": vals.get("company_id"),
- }
- )
- vals.update({"reservation_sequence_id": reservation_sequence.id})
if "checkin_sequence_id" not in vals or not vals.get("checkin_sequence_id"):
checkin_sequence = self.env["ir.sequence"].create(
{
diff --git a/pms/models/pms_reservation.py b/pms/models/pms_reservation.py
index 1c6347a5b..604881b74 100644
--- a/pms/models/pms_reservation.py
+++ b/pms/models/pms_reservation.py
@@ -26,6 +26,11 @@ class PmsReservation(models.Model):
help="Reservation Code Identification",
readonly=True,
)
+ folio_sequence = fields.Integer(
+ string="Folio Sequence",
+ help="Techinal field to get reservation name",
+ readonly=True,
+ )
priority = fields.Integer(
string="Priority",
help="Priority of a reservation",
@@ -1878,14 +1883,13 @@ class PmsReservation(models.Model):
else:
raise ValidationError(_("The Property are mandatory in the reservation"))
if vals.get("name", _("New")) == _("New") or "name" not in vals:
- pms_property_id = (
- self.env.user.get_active_property_ids()[0]
- if "pms_property_id" not in vals
- else vals["pms_property_id"]
+ folio_sequence = (
+ max(folio.mapped("reservation_ids.folio_sequence")) + 1
+ if folio.reservation_ids
+ else 1
)
- pms_property = self.env["pms.property"].browse(pms_property_id)
- vals["name"] = pms_property.reservation_sequence_id._next_do()
-
+ vals["folio_sequence"] = folio_sequence
+ vals["name"] = folio.name + "/" + str(folio_sequence)
if not vals.get("reservation_type"):
vals["reservation_type"] = (
folio.reservation_type if folio.reservation_type else "normal"
diff --git a/pms/models/res_partner.py b/pms/models/res_partner.py
index 9866bf033..6c23088c1 100644
--- a/pms/models/res_partner.py
+++ b/pms/models/res_partner.py
@@ -781,5 +781,8 @@ class ResPartner(models.Model):
"pms", "various_pms_partner"
)
if various_partner_id in self.ids:
- raise ValidationError(_("The partner 'Various Clients' cannot be deleted"))
+ various_partner = self.browse(various_partner_id)
+ raise ValidationError(
+ _("The partner %s cannot be deleted"), various_partner.name
+ )
return super().unlink()
diff --git a/pms/views/pms_property_views.xml b/pms/views/pms_property_views.xml
index 61e9ddcb9..4b6fd7745 100644
--- a/pms/views/pms_property_views.xml
+++ b/pms/views/pms_property_views.xml
@@ -69,7 +69,6 @@
-