mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[FIX] timedelta use
This commit is contained in:
@@ -952,7 +952,7 @@ class PmsCheckinPartner(models.Model):
|
|||||||
)[self.id]
|
)[self.id]
|
||||||
self.reservation_id.message_post(body=body)
|
self.reservation_id.message_post(body=body)
|
||||||
|
|
||||||
if self.reservation_id.to_send_mail:
|
if self.reservation_id.to_send_exit_mail:
|
||||||
emails = self.reservation_id.checkin_partner_ids.mapped("email")
|
emails = self.reservation_id.checkin_partner_ids.mapped("email")
|
||||||
if (
|
if (
|
||||||
self.reservation_id.partner_id
|
self.reservation_id.partner_id
|
||||||
@@ -972,4 +972,4 @@ class PmsCheckinPartner(models.Model):
|
|||||||
"body_html", [6, 0, self.id], compute_lang=True, post_process=True
|
"body_html", [6, 0, self.id], compute_lang=True, post_process=True
|
||||||
)[self.id]
|
)[self.id]
|
||||||
self.reservation_id.message_post(body=body)
|
self.reservation_id.message_post(body=body)
|
||||||
self.reservation_id.to_send_mail = False
|
self.reservation_id.to_send_exit_mail = False
|
||||||
|
|||||||
@@ -1391,7 +1391,7 @@ class PmsFolio(models.Model):
|
|||||||
record.days_to_checkin = (record.first_checkin - fields.Date.today()).days
|
record.days_to_checkin = (record.first_checkin - fields.Date.today()).days
|
||||||
|
|
||||||
def _search_days_to_checkin(self, operator, value):
|
def _search_days_to_checkin(self, operator, value):
|
||||||
target_date = fields.Date.today() + timedelta(days=value)
|
target_date = fields.Date.today() + datetime.timedelta(days=value)
|
||||||
if operator in ("=", ">=", ">", "<=", "<"):
|
if operator in ("=", ">=", ">", "<=", "<"):
|
||||||
return [("first_checkin", operator, target_date)]
|
return [("first_checkin", operator, target_date)]
|
||||||
raise UserError(
|
raise UserError(
|
||||||
@@ -1410,7 +1410,7 @@ class PmsFolio(models.Model):
|
|||||||
record.days_to_checkout = (record.last_checkout - fields.Date.today()).days
|
record.days_to_checkout = (record.last_checkout - fields.Date.today()).days
|
||||||
|
|
||||||
def _search_days_to_checkout(self, operator, value):
|
def _search_days_to_checkout(self, operator, value):
|
||||||
target_date = fields.Date.today() + timedelta(days=value)
|
target_date = fields.Date.today() + datetime.timedelta(days=value)
|
||||||
if operator in ("=", ">=", ">", "<=", "<"):
|
if operator in ("=", ">=", ">", "<=", "<"):
|
||||||
return [("last_checkout", operator, target_date)]
|
return [("last_checkout", operator, target_date)]
|
||||||
raise UserError(
|
raise UserError(
|
||||||
|
|||||||
@@ -497,6 +497,12 @@ class PmsReservationLine(models.Model):
|
|||||||
|
|
||||||
@api.model_create_multi
|
@api.model_create_multi
|
||||||
def create(self, vals_list):
|
def create(self, vals_list):
|
||||||
|
for vals in vals_list:
|
||||||
|
if vals.get("reservation_id") and not vals.get("sale_channel_id"):
|
||||||
|
reservation = self.env["pms.reservation"].browse(
|
||||||
|
vals.get("reservation_id")
|
||||||
|
)
|
||||||
|
vals["sale_channel_id"] = reservation.sale_channel_origin_id.id
|
||||||
records = super().create(vals_list)
|
records = super().create(vals_list)
|
||||||
for line in records:
|
for line in records:
|
||||||
reservation = line.reservation_id
|
reservation = line.reservation_id
|
||||||
|
|||||||
@@ -38,5 +38,6 @@ from . import test_pms_wizard_split_join_swap_reservation
|
|||||||
from . import test_product_template
|
from . import test_product_template
|
||||||
from . import test_pms_multiproperty
|
from . import test_pms_multiproperty
|
||||||
from . import test_shared_room
|
from . import test_shared_room
|
||||||
|
|
||||||
# from . import test_automated_mails
|
# from . import test_automated_mails
|
||||||
from . import test_pms_service
|
from . import test_pms_service
|
||||||
|
|||||||
@@ -455,7 +455,10 @@
|
|||||||
name="force_update_origin"
|
name="force_update_origin"
|
||||||
attrs="{'invisible': [('is_origin_channel_check_visible','=',False)]}"
|
attrs="{'invisible': [('is_origin_channel_check_visible','=',False)]}"
|
||||||
/>
|
/>
|
||||||
<field name="is_origin_channel_check_visible" invisible="1" />
|
<field
|
||||||
|
name="is_origin_channel_check_visible"
|
||||||
|
invisible="1"
|
||||||
|
/>
|
||||||
<field
|
<field
|
||||||
name="sale_channel_ids"
|
name="sale_channel_ids"
|
||||||
widget="many2many_tags"
|
widget="many2many_tags"
|
||||||
|
|||||||
Reference in New Issue
Block a user