mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[FIX] compute folio/reservation name from agency
This commit is contained in:
@@ -633,6 +633,10 @@ class PmsFolio(models.Model):
|
|||||||
for folio in self:
|
for folio in self:
|
||||||
if folio.agency_id and folio.agency_id.invoice_to_agency:
|
if folio.agency_id and folio.agency_id.invoice_to_agency:
|
||||||
folio.partner_id = folio.agency_id.id
|
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:
|
elif not folio.partner_id:
|
||||||
folio.partner_id = False
|
folio.partner_id = False
|
||||||
|
|
||||||
|
|||||||
@@ -698,12 +698,10 @@ class PmsReservation(models.Model):
|
|||||||
)
|
)
|
||||||
reservation.allowed_room_ids = rooms_available
|
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):
|
def _compute_partner_id(self):
|
||||||
for reservation in self:
|
for reservation in self:
|
||||||
if reservation.reservation_type == "out":
|
if not reservation.partner_id:
|
||||||
reservation.partner_id = reservation.pms_property_id.partner_id.id
|
|
||||||
elif not reservation.partner_id:
|
|
||||||
if reservation.folio_id:
|
if reservation.folio_id:
|
||||||
reservation.partner_id = reservation.folio_id.partner_id
|
reservation.partner_id = reservation.folio_id.partner_id
|
||||||
elif reservation.agency_id:
|
elif reservation.agency_id:
|
||||||
|
|||||||
Reference in New Issue
Block a user