[CLN] global: apply ruff

This commit is contained in:
Stéphan Sainléger
2025-07-08 15:09:51 +02:00
parent 92577de600
commit ff07b3aa17
43 changed files with 192 additions and 169 deletions

View File

@@ -65,11 +65,7 @@ This module is maintained by Elabore.
""",
# any module necessary for this one to work correctly
"depends": [
"base",
"project",
"project_user_default_project"
],
"depends": ["base", "project", "project_user_default_project"],
"qweb": [
# "static/src/xml/*.xml",
],
@@ -77,10 +73,7 @@ This module is maintained by Elabore.
"python": [],
},
# always loaded
"data": [
"views/project_project.xml",
"views/portal_home_template.xml"
],
"data": ["views/project_project.xml", "views/portal_home_template.xml"],
# only loaded in demonstration mode
"demo": [],
"js": [],

View File

@@ -1,2 +1 @@
from . import custom_portal
from . import custom_portal

View File

@@ -7,15 +7,19 @@ from odoo.addons.portal.controllers.portal import CustomerPortal
class CustomCustomerPortal(CustomerPortal):
@route(["/my/account"], type="http", auth="user", website=True)
def account(self, redirect=None, **post):
self.OPTIONAL_BILLING_FIELDS.append("average_acceptable_time") #unecessary save in res partner, but necessary to avoid error on form post
self.OPTIONAL_BILLING_FIELDS.append(
"average_acceptable_time"
) # unecessary save in res partner, but necessary to avoid error on form post
response = super(CustomCustomerPortal, self).account(redirect, **post)
if post and request.httprequest.method == "POST":
error, error_message = self.details_form_validate(post)
if not error:
user = request.env.user
if user.default_project_id and post["average_acceptable_time"]:
user.default_project_id.average_acceptable_time = post["average_acceptable_time"]
user.default_project_id.average_acceptable_time = post[
"average_acceptable_time"
]
return response

View File

@@ -1,3 +1,2 @@
from . import project_project
from . import res_partner
from . import res_partner

View File

@@ -1,10 +1,7 @@
from odoo import models, fields, _, api
class Project(models.Model):
_inherit = "project.project"
average_acceptable_time = fields.Float('Average acceptable time')
average_acceptable_time = fields.Float("Average acceptable time")

View File

@@ -1,10 +1,9 @@
from odoo import models, fields, _, api
class ResPartner(models.Model):
_inherit = "res.partner"
average_acceptable_time = fields.Float('Average acceptable time') # not used, but necessary to post custom field from /my/account
average_acceptable_time = fields.Float(
"Average acceptable time"
) # not used, but necessary to post custom field from /my/account