Skip to content

Commit

Permalink
[IMP] pms-api-rest: add authorImageUrl to folio % reservation message…
Browse files Browse the repository at this point in the history
…s service
  • Loading branch information
miguelpadin authored and DarioLodeiros committed Oct 9, 2023
1 parent cc4c16a commit 38743b7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions pms_api_rest/datamodels/pms_reservation_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class PmsReservationMessageInfo(Datamodel):
date = fields.String(required=False, allow_none=True)
messageType = fields.String(required=False, allow_none=True)
authorImageBase64 = fields.String(required=False, allow_none=True)
authorImageUrl = fields.String(required=False, allow_none=True)


class PmsFolioMessageInfo(Datamodel):
Expand All @@ -23,6 +24,7 @@ class PmsFolioMessageInfo(Datamodel):
date = fields.String(required=False, allow_none=True)
messageType = fields.String(required=False, allow_none=True)
authorImageBase64 = fields.String(required=False, allow_none=True)
authorImageUrl = fields.String(required=False, allow_none=True)


class PmsMessageInfo(Datamodel):
Expand Down
9 changes: 6 additions & 3 deletions pms_api_rest/services/pms_folio_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from datetime import datetime, timedelta

from odoo import _, fields
from .manage_url_images import url_image
from odoo.exceptions import MissingError, ValidationError
from odoo.osv import expression
from odoo.tools import get_lang
Expand Down Expand Up @@ -1257,6 +1258,7 @@ def get_folio_reservation_messages(self, folio_id):
).decode("utf-8")
if message.author_id.image_1024
else None,
authorImageUrl=url_image(self, 'res.partner', message.author_id.id, 'image_1024'),
)
)
PmsFolioMessageInfo = self.env.datamodels["pms.folio.message.info"]
Expand All @@ -1268,9 +1270,9 @@ def get_folio_reservation_messages(self, folio_id):
subject = folio_message.subject if folio_message.subject else None
folio_messages.append(
PmsFolioMessageInfo(
author=message.author_id.name
if message.author_id
else message.email_from,
author=folio_message.author_id.name
if folio_message.author_id
else folio_message.email_from,
message=message_body,
subject=subject,
date=folio_message.date.strftime("%d/%m/%y %H:%M:%S"),
Expand All @@ -1280,6 +1282,7 @@ def get_folio_reservation_messages(self, folio_id):
).decode("utf-8")
if folio_message.author_id.image_1024
else None,
authorImageUrl=url_image(self, 'res.partner', folio_message.author_id.id, 'image_1024'),
)
)
PmsMessageInfo = self.env.datamodels["pms.message.info"]
Expand Down
2 changes: 1 addition & 1 deletion pms_api_rest/services/pms_reservation_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def update_reservation(self, reservation_id, reservation_data):
reservation.with_context(skip_compute_service_ids=True).write(reservation_vals)
else:
reservation.write(reservation_vals)
print(reservation.service_ids.mapped("name"))
# print(reservation.service_ids.mapped("name"))


def _get_reservation_lines_mapped(self, origin_data, reservation_line=False):
Expand Down

0 comments on commit 38743b7

Please sign in to comment.