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

View File

@@ -3,7 +3,7 @@ import time
from jose import jwt
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_datamodel.restapi import Datamodel

View File

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