[REF] all: pass pre-commit on the whole repo
Needed for the lint job of the CI to go green. Mostly automatic hook fixes (black, isort, prettier, pyupgrade, autoflake, whitespace). By hand: - flake8: two unused imports, an ambiguous variable name `l`. - pylint-odoo mandatory: manifest keys equal to their default value (installable, application, data, external_dependencies). - end-of-file-fixer skips *.patch too, like trailing-whitespace: the upstream patches stay as git format-patch wrote them. No behaviour change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d9d9e8be2d
commit
fbd43bb459
45 changed files with 330 additions and 295 deletions
|
|
@ -3,9 +3,10 @@
|
|||
from urllib.parse import urlencode
|
||||
|
||||
from odoo import http
|
||||
from odoo.addons.website_sale.controllers.main import WebsiteSale
|
||||
from odoo.http import request
|
||||
|
||||
from odoo.addons.website_sale.controllers.main import WebsiteSale
|
||||
|
||||
SIGNUP_FLAG = "membership_signup=1"
|
||||
|
||||
|
||||
|
|
@ -36,24 +37,37 @@ class WebsiteSaleMembershipSignup(WebsiteSale):
|
|||
|
||||
@http.route()
|
||||
def cart_update(
|
||||
self, product_id, add_qty=1, set_qty=0,
|
||||
self,
|
||||
product_id,
|
||||
add_qty=1,
|
||||
set_qty=0,
|
||||
product_custom_attribute_values=None,
|
||||
no_variant_attribute_value_ids=None, **kwargs
|
||||
no_variant_attribute_value_ids=None,
|
||||
**kwargs,
|
||||
):
|
||||
if self._membership_signup_is_required(product_id):
|
||||
self._membership_signup_mark_session(product_id)
|
||||
return request.redirect(self._membership_signup_redirect_url(product_id))
|
||||
return super().cart_update(
|
||||
product_id=product_id, add_qty=add_qty, set_qty=set_qty,
|
||||
product_id=product_id,
|
||||
add_qty=add_qty,
|
||||
set_qty=set_qty,
|
||||
product_custom_attribute_values=product_custom_attribute_values,
|
||||
no_variant_attribute_value_ids=no_variant_attribute_value_ids,
|
||||
**kwargs
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
@http.route()
|
||||
def cart_update_json(
|
||||
self, product_id, line_id=None, add_qty=None, set_qty=None, display=True,
|
||||
product_custom_attribute_values=None, no_variant_attribute_value_ids=None, **kwargs
|
||||
self,
|
||||
product_id,
|
||||
line_id=None,
|
||||
add_qty=None,
|
||||
set_qty=None,
|
||||
display=True,
|
||||
product_custom_attribute_values=None,
|
||||
no_variant_attribute_value_ids=None,
|
||||
**kwargs,
|
||||
):
|
||||
if self._membership_signup_is_required(product_id):
|
||||
self._membership_signup_mark_session(product_id)
|
||||
|
|
@ -90,11 +104,14 @@ class WebsiteSaleMembershipSignup(WebsiteSale):
|
|||
"notification_info": {"lines": [], "warning": ""},
|
||||
}
|
||||
return super().cart_update_json(
|
||||
product_id=product_id, line_id=line_id, add_qty=add_qty,
|
||||
set_qty=set_qty, display=display,
|
||||
product_id=product_id,
|
||||
line_id=line_id,
|
||||
add_qty=add_qty,
|
||||
set_qty=set_qty,
|
||||
display=display,
|
||||
product_custom_attribute_values=product_custom_attribute_values,
|
||||
no_variant_attribute_value_ids=no_variant_attribute_value_ids,
|
||||
**kwargs
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
def _get_mandatory_address_fields(self, country_sudo):
|
||||
|
|
@ -122,4 +139,4 @@ class WebsiteSaleMembershipSignup(WebsiteSale):
|
|||
# So even after we drop 'phone' from the address set above, the
|
||||
# portal set re-adds it for billing. We need to drop it here too.
|
||||
fields = list(super()._get_mandatory_fields())
|
||||
return [f for f in fields if f != "phone"]
|
||||
return [f for f in fields if f != "phone"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue