From 596b9ea568b6d3774a4a1f93a6f62533793abed5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dar=C3=ADo=20Lodeiros?= Date: Mon, 6 Mar 2023 17:26:31 +0100 Subject: [PATCH] [IMP]pms_l10n_es: INE wizard avoid differences between rooms and hosts filters --- pms_l10n_es/wizards/wizard_ine.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/pms_l10n_es/wizards/wizard_ine.py b/pms_l10n_es/wizards/wizard_ine.py index 146386809..c60e45cca 100644 --- a/pms_l10n_es/wizards/wizard_ine.py +++ b/pms_l10n_es/wizards/wizard_ine.py @@ -84,7 +84,8 @@ class WizardIne(models.TransientModel): .filtered( lambda l: len( l.reservation_id.checkin_partner_ids.filtered( - lambda c: c.state not in ["draft", "cancel"] + lambda c: c.state + not in ["dummy", "draft", "cancel", "precheckin"] ) ) == 1 @@ -113,7 +114,8 @@ class WizardIne(models.TransientModel): .filtered( lambda l: len( l.reservation_id.checkin_partner_ids.filtered( - lambda c: c.state not in ["draft", "cancel"] + lambda c: c.state + not in ["dummy", "draft", "cancel", "precheckin"] ) ) == 2 @@ -168,7 +170,8 @@ class WizardIne(models.TransientModel): .filtered( lambda l: len( l.reservation_id.checkin_partner_ids.filtered( - lambda c: c.state not in ["draft", "cancel"] + lambda c: c.state + not in ["dummy", "draft", "cancel", "precheckin"] ) ) > 0 @@ -332,9 +335,9 @@ class WizardIne(models.TransientModel): # search for checkin partners hosts = self.env["pms.checkin.partner"].search( [ - ("pms_property_id", "=", pms_property_id), - ("checkin", "<=", p_date), - ("checkout", ">=", p_date), + ("reservation_id.pms_property_id", "=", pms_property_id), + ("reservation_id.checkin", "<=", p_date), + ("reservation_id.checkout", ">=", p_date), ("reservation_id.reservation_type", "=", "normal"), ("state", "not in", ["dummy", "draft", "cancel", "precheckin"]), ] @@ -346,7 +349,7 @@ class WizardIne(models.TransientModel): ) # arrivals - arrivals = hosts.filtered(lambda x: x.checkin == p_date) + arrivals = hosts.filtered(lambda x: x.reservation_id.checkin == p_date) # arrivals grouped by nationality_id read_by_arrivals = self.env["pms.checkin.partner"].read_group( @@ -358,7 +361,7 @@ class WizardIne(models.TransientModel): ) # departures - departures = hosts.filtered(lambda x: x.checkout == p_date) + departures = hosts.filtered(lambda x: x.reservation_id.checkout == p_date) # departures grouped by nationality_id read_by_departures = self.env["pms.checkin.partner"].read_group(