Skip to content

[18.0][website_sale_empty_cart] TypeError on /shop/cart when website_sale_loyalty is installed #1237

Description

@matnoublanche

Module

website_sale_empty_cart (18.0)

Odoo version

18.0

Current behavior

Accessing /shop/cart raises:

TypeError: WebsiteSale.cart() takes 1 positional argument but 3 were given

Expected behavior

Cart page should render normally, and empty-cart action should work.

Steps to reproduce

  1. Install website_sale
  2. Install website_sale_empty_cart
  3. Install website_sale_loyalty
  4. Go to /shop/cart
  5. Trigger cart route (with or without empty_cart param)

Traceback

Traceback (most recent call last):
File "/var/odoo/staging-ordonnanceur.odoo.kiub.fr/src/odoo/http.py", line 2167, in _transactioning
return service_model.retrying(func, env=self.env)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/odoo/staging-ordonnanceur.odoo.kiub.fr/src/odoo/service/model.py", line 157, in retrying
result = func()
^^^^^^
File "/var/odoo/staging-ordonnanceur.odoo.kiub.fr/src/odoo/http.py", line 2134, in _serve_ir_http
response = self.dispatcher.dispatch(rule.endpoint, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/odoo/staging-ordonnanceur.odoo.kiub.fr/src/odoo/http.py", line 2295, in dispatch
return self.request.registry['ir.http']._dispatch(endpoint)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/odoo/staging-ordonnanceur.odoo.kiub.fr/src/odoo/addons/base/models/ir_http.py", line 333, in _dispatch
result = endpoint(**request.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/odoo/staging-ordonnanceur.odoo.kiub.fr/src/odoo/http.py", line 754, in route_wrapper
result = endpoint(self, *args, **params_ok)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/odoo/staging-ordonnanceur.odoo.kiub.fr/extra-addons/e-commerce.git-6916c9356ea0f/website_sale_empty_cart/controllers/main.py", line 18, in cart
return super().cart(access_token, revive, **post)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/odoo/staging-ordonnanceur.odoo.kiub.fr/src/odoo/http.py", line 754, in route_wrapper
result = endpoint(self, *args, **params_ok)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: WebsiteSale.cart() takes 1 positional argument but 3 were given

Analysis

website_sale_empty_cart calls parent with positional args:
super().cart(access_token, revive, **post)

In a stack where another controller override defines cart as kwargs-only (e.g. loyalty override), this fails with the positional-argument TypeError.

Proposed fix

Use keyword arguments when calling super:
super().cart(access_token=access_token, revive=revive, **post)

This is compatible with both parent signatures.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions