Travis Waelbroeck 6ae751e808 [FIX] website_sale: error during shipping address creation
closes #149428

**Impacted versions:** master, 17.0

This appears to have been introduced by
24c8ff9b28 on #139474.

**Steps to reproduce:**

1. Log in as admin user
    * _The error also happens while logged in as portal user, but they
      do not see the traceback._
2. Go to website, add item to cart, and click "Checkout"
3. Under the "shipping' section, click "Add address"
4. Click save and an error is raised (see traceback below and in task
   comments)
    * _The error also occurs if you just leave one required field as
      blank, rather than all fields._

**Current behavior:** If logged in as an internal user, a traceback
error (below) is raised. If logged in as a portal user, a 500 error page
is shown.

```
Traceback (most recent call last):
  File "/opt/odoo/core/odoo/http.py", line 1722, in _serve_db
    return service_model.retrying(self._serve_ir_http, self.env)
  File "/opt/odoo/core/odoo/service/model.py", line 133, in retrying
    result = func()
  File "/opt/odoo/core/odoo/http.py", line 1749, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
  File "/opt/odoo/core/odoo/http.py", line 1866, in dispatch
    return self.request.registry['ir.http']._dispatch(endpoint)
  File "/opt/odoo/core/addons/website/models/ir_http.py", line 235, in _dispatch
    response = super()._dispatch(endpoint)
  File "/opt/odoo/core/odoo/addons/base/models/ir_http.py", line 222, in _dispatch
    result = endpoint(**request.params)
  File "/opt/odoo/core/odoo/http.py", line 722, in route_wrapper
    result = endpoint(self, *args, **params_ok)
  File "/opt/odoo/core/addons/website_sale/controllers/main.py", line 1346, in address
    'use_same': is_public_user or ('use_same' in kw and str2bool(kw.get('use_same'))),
  File "/opt/odoo/core/odoo/tools/misc.py", line 468, in str2bool
    raise ValueError('Use 0/1/yes/no/true/false/on/off')
ValueError: Use 0/1/yes/no/true/false/on/off
```

Note: Based on a quick check, the value of `kw.get('use_same')` is
`None`, which causes the `str2bool` check to fail. The value of
`use_same` appears to be set within the `website_sale.address` template,
but it seems that the value should always be `True` or `False`, not
`None`.

**Expected behavior:** The "add address" page is shown with a red
highlight around any required fields that are missing a value.

**Video link:**
https://github.com/odoo/odoo/assets/7907616/4e103c73-417f-4d1a-93e3-8c1d7beeb918

Support ticket number submitted via odoo.com/help: 3,685,876

closes odoo/odoo#149432

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2024-01-16 09:55:28 +00:00
2024-01-16 09:55:28 +00:00
…
…
…
…
…
…

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials

S
Description
No description provided
Readme LGPL-3.0
3.4 GiB
Languages
Python 49.6%
JavaScript 47.8%
SCSS 2%
CSS 0.3%
HTML 0.2%