[FIX] pms-api-rest: fix precommit & PEP

This commit is contained in:
miguelpadin
2021-12-27 16:32:59 +01:00
committed by Darío Lodeiros
parent af960fcec3
commit 1c7b8efdc5
3 changed files with 12 additions and 14 deletions

View File

@@ -98,9 +98,13 @@ class PmsFolioService(Component):
pendingAmount=folio.pending_amount, pendingAmount=folio.pending_amount,
reservations=[] if not reservations else reservations, reservations=[] if not reservations else reservations,
salesPerson=folio.user_id.name if folio.user_id else "", salesPerson=folio.user_id.name if folio.user_id else "",
paymentState=dict(folio.fields_get(["payment_state"])["payment_state"]["selection"])[ paymentState=dict(
folio.payment_state folio.fields_get(["payment_state"])["payment_state"][
] if folio.payment_state else "", "selection"
]
)[folio.payment_state]
if folio.payment_state
else "",
propertyId=folio.pms_property_id, propertyId=folio.pms_property_id,
) )
) )
@@ -235,9 +239,7 @@ class PmsFolioService(Component):
output_param=Datamodel("pms.payment.info", is_list=True), output_param=Datamodel("pms.payment.info", is_list=True),
) )
def get_folio_payments(self, folio_id): def get_folio_payments(self, folio_id):
folio = ( folio = self.env["pms.folio"].sudo().search([("id", "=", folio_id)])
self.env["pms.folio"].sudo().search([("id", "=", folio_id)])
)
payments = [] payments = []
PmsPaymentInfo = self.env.datamodels["pms.payment.info"] PmsPaymentInfo = self.env.datamodels["pms.payment.info"]
if not folio: if not folio:

View File

@@ -3,7 +3,7 @@ import time
from jose import jwt from jose import jwt
from odoo import _ from odoo import _
from odoo.exceptions import ValidationError, AccessDenied, UserError from odoo.exceptions import ValidationError
from odoo.addons.base_rest import restapi from odoo.addons.base_rest import restapi
from odoo.addons.base_rest_datamodel.restapi import Datamodel from odoo.addons.base_rest_datamodel.restapi import Datamodel

View File

@@ -86,17 +86,13 @@ class PmsPropertyComponent(Component):
) )
def get_method_payments_property(self, property_id): def get_method_payments_property(self, property_id):
property = ( pms_property = self.env["pms.property"].sudo().search([("id", "=", property_id)])
self.env["pms.property"].sudo().search([("id", "=", property_id)])
)
PmsAccountJournalInfo = self.env.datamodels["pms.account.journal.info"] PmsAccountJournalInfo = self.env.datamodels["pms.account.journal.info"]
res = [] res = []
if not property: if not pms_property:
pass pass
else: else:
for method in property._get_payment_methods( for method in pms_property._get_payment_methods(automatic_included=True):
automatic_included=True
):
payment_method = ( payment_method = (
self.env["account.journal"].sudo().search([("id", "=", method.id)]) self.env["account.journal"].sudo().search([("id", "=", method.id)])
) )