From 1c7b8efdc586dfc0b023683001ea365bbd459e4c Mon Sep 17 00:00:00 2001 From: miguelpadin Date: Mon, 27 Dec 2021 16:32:59 +0100 Subject: [PATCH] [FIX] pms-api-rest: fix precommit & PEP --- pms_api_rest/services/folio_services.py | 14 ++++++++------ pms_api_rest/services/login_service.py | 2 +- pms_api_rest/services/property_services.py | 10 +++------- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/pms_api_rest/services/folio_services.py b/pms_api_rest/services/folio_services.py index 0c80a345b..a985335cf 100644 --- a/pms_api_rest/services/folio_services.py +++ b/pms_api_rest/services/folio_services.py @@ -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: diff --git a/pms_api_rest/services/login_service.py b/pms_api_rest/services/login_service.py index 3176b17ba..67fad6570 100644 --- a/pms_api_rest/services/login_service.py +++ b/pms_api_rest/services/login_service.py @@ -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 diff --git a/pms_api_rest/services/property_services.py b/pms_api_rest/services/property_services.py index afdc37470..3ad41d29f 100644 --- a/pms_api_rest/services/property_services.py +++ b/pms_api_rest/services/property_services.py @@ -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)]) )