[FIX] compute folio/reservation name from agency

This commit is contained in:
Dario Lodeiros
2021-06-19 14:11:26 +02:00
parent ffb0389b83
commit 025b71b769
2 changed files with 6 additions and 4 deletions

View File

@@ -633,6 +633,10 @@ class PmsFolio(models.Model):
for folio in self:
if folio.agency_id and folio.agency_id.invoice_to_agency:
folio.partner_id = folio.agency_id.id
elif folio.agency_id and not folio.partner_name:
# if the customer not is the agency but we dont know the customer's name,
# set the name provisional
folio.partner_name = _("Reservation from ") + folio.agency_id.name
elif not folio.partner_id:
folio.partner_id = False

View File

@@ -698,12 +698,10 @@ class PmsReservation(models.Model):
)
reservation.allowed_room_ids = rooms_available
@api.depends("reservation_type", "agency_id", "folio_id")
@api.depends("reservation_type", "agency_id", "folio_id", "folio_id.agency_id")
def _compute_partner_id(self):
for reservation in self:
if reservation.reservation_type == "out":
reservation.partner_id = reservation.pms_property_id.partner_id.id
elif not reservation.partner_id:
if not reservation.partner_id:
if reservation.folio_id:
reservation.partner_id = reservation.folio_id.partner_id
elif reservation.agency_id: