mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP] pms_api_rest: add property on domain in get_invoices
This commit is contained in:
committed by
Darío Lodeiros
parent
56eaef7335
commit
f2d9d0ee05
@@ -12,6 +12,7 @@ class PmsInvoiceSearchParam(Datamodel):
|
||||
paymentState = fields.String(required=False, allow_none=True)
|
||||
dateStart = fields.String(required=False, allow_none=True)
|
||||
dateEnd = fields.String(required=False, allow_none=True)
|
||||
pmsPropertyId = fields.Integer(required=False, allow_none=True)
|
||||
|
||||
class PmsAccountInvoiceInfo(Datamodel):
|
||||
_name = "pms.invoice.info"
|
||||
@@ -39,6 +40,7 @@ class PmsAccountInvoiceInfo(Datamodel):
|
||||
originDownPaymentId = fields.Integer(required=False, allow_none=True)
|
||||
originAgencyId = fields.Integer(required=False, allow_none=True)
|
||||
ref = fields.String(required=False, allow_none=True)
|
||||
pmsPropertyId = fields.Integer(required=False, allow_none=True)
|
||||
|
||||
class PmsInvoiceResults(Datamodel):
|
||||
_name = "pms.invoice.results"
|
||||
|
||||
@@ -43,6 +43,8 @@ class PmsInvoiceService(Component):
|
||||
domain_fields.append(
|
||||
("origin_agency_id", "=", pms_invoice_search_param.originAgencyId),
|
||||
)
|
||||
if pms_invoice_search_param.pmsPropertyId:
|
||||
domain_fields.append(("pms_property_id", "=", pms_invoice_search_param.pmsPropertyId))
|
||||
if pms_invoice_search_param.paymentState == "paid":
|
||||
domain_fields.append(
|
||||
("payment_state", "in", ("paid", "reversed", "invoicing_legacy"))
|
||||
@@ -83,7 +85,6 @@ class PmsInvoiceService(Component):
|
||||
domain = expression.AND([domain_fields, domain_filter[0]])
|
||||
else:
|
||||
domain = domain_fields
|
||||
|
||||
PmsInvoiceResults = self.env.datamodels["pms.invoice.results"]
|
||||
PmsInvoiceInfo = self.env.datamodels["pms.invoice.info"]
|
||||
PmsInvoiceLineInfo = self.env.datamodels["pms.invoice.line.info"]
|
||||
@@ -171,7 +172,8 @@ class PmsInvoiceService(Component):
|
||||
originAgencyId=invoice.origin_agency_id.id
|
||||
if invoice.origin_agency_id
|
||||
else None,
|
||||
ref=invoice.ref,
|
||||
ref=invoice.ref if invoice.ref else None,
|
||||
pmsPropertyId=invoice.pms_property_id if invoice.pms_property_id else None,
|
||||
)
|
||||
)
|
||||
return PmsInvoiceResults(
|
||||
|
||||
Reference in New Issue
Block a user