[18.0][website_sale_empty_cart] TypeError on /shop/cart when website_sale_loyalty is installed
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
Start in website_sale_empty_cart/controllers/main.py at the cart method and inspect how it calls the parent controller. Check the cart overrides involved when website_sale_loyalty is installed, then reproduce the issue using the listed module installation steps. Done means /shop/cart renders and the empty-cart action works with and without the empty_cart parameter.
Written by the indexing model from the issue text.
Description
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
- Install
website_sale - Install
website_sale_empty_cart - Install
website_sale_loyalty - Go to
/shop/cart - 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.
- Dominant language
- HTML
- Stars
- 206
- Forks
- 578
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 15
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from OCA/e-commerce
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
OCA/e-commerce#1383 ·
Maintainers usually reply within 1 day
-
help wanted no stale work in progress
Difficulty 2/5 Half a day Newbie friendliness 68/100
OCA/e-commerce#1343 · 4 comments ·
Maintainers usually reply within 1 day
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 78/100
OCA/e-commerce#1274 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 28/100
OCA/e-commerce#1156 · 1 comment ·
Maintainers usually reply within 1 day
-
help wanted no stale work in progress
Difficulty 4/5 3-5 days Newbie friendliness 45/100
OCA/e-commerce#1115 · 6 comments ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
milind-soni/OpenMausBot#5829 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
finos/fluxnova-bpm-platform#387 ·
Maintainers usually reply within 4 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
OHDSI/Data2Evidence#3693 ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Project-N-E-K-O/N.E.K.O#3725 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
kubernetes-sigs/headlamp#8408 ·
Maintainers usually reply within 1 day