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)
|
paymentState = fields.String(required=False, allow_none=True)
|
||||||
dateStart = fields.String(required=False, allow_none=True)
|
dateStart = fields.String(required=False, allow_none=True)
|
||||||
dateEnd = 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):
|
class PmsAccountInvoiceInfo(Datamodel):
|
||||||
_name = "pms.invoice.info"
|
_name = "pms.invoice.info"
|
||||||
@@ -39,6 +40,7 @@ class PmsAccountInvoiceInfo(Datamodel):
|
|||||||
originDownPaymentId = fields.Integer(required=False, allow_none=True)
|
originDownPaymentId = fields.Integer(required=False, allow_none=True)
|
||||||
originAgencyId = fields.Integer(required=False, allow_none=True)
|
originAgencyId = fields.Integer(required=False, allow_none=True)
|
||||||
ref = fields.String(required=False, allow_none=True)
|
ref = fields.String(required=False, allow_none=True)
|
||||||
|
pmsPropertyId = fields.Integer(required=False, allow_none=True)
|
||||||
|
|
||||||
class PmsInvoiceResults(Datamodel):
|
class PmsInvoiceResults(Datamodel):
|
||||||
_name = "pms.invoice.results"
|
_name = "pms.invoice.results"
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ class PmsInvoiceService(Component):
|
|||||||
domain_fields.append(
|
domain_fields.append(
|
||||||
("origin_agency_id", "=", pms_invoice_search_param.originAgencyId),
|
("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":
|
if pms_invoice_search_param.paymentState == "paid":
|
||||||
domain_fields.append(
|
domain_fields.append(
|
||||||
("payment_state", "in", ("paid", "reversed", "invoicing_legacy"))
|
("payment_state", "in", ("paid", "reversed", "invoicing_legacy"))
|
||||||
@@ -83,7 +85,6 @@ class PmsInvoiceService(Component):
|
|||||||
domain = expression.AND([domain_fields, domain_filter[0]])
|
domain = expression.AND([domain_fields, domain_filter[0]])
|
||||||
else:
|
else:
|
||||||
domain = domain_fields
|
domain = domain_fields
|
||||||
|
|
||||||
PmsInvoiceResults = self.env.datamodels["pms.invoice.results"]
|
PmsInvoiceResults = self.env.datamodels["pms.invoice.results"]
|
||||||
PmsInvoiceInfo = self.env.datamodels["pms.invoice.info"]
|
PmsInvoiceInfo = self.env.datamodels["pms.invoice.info"]
|
||||||
PmsInvoiceLineInfo = self.env.datamodels["pms.invoice.line.info"]
|
PmsInvoiceLineInfo = self.env.datamodels["pms.invoice.line.info"]
|
||||||
@@ -171,7 +172,8 @@ class PmsInvoiceService(Component):
|
|||||||
originAgencyId=invoice.origin_agency_id.id
|
originAgencyId=invoice.origin_agency_id.id
|
||||||
if invoice.origin_agency_id
|
if invoice.origin_agency_id
|
||||||
else None,
|
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(
|
return PmsInvoiceResults(
|
||||||
|
|||||||
Reference in New Issue
Block a user