Damien Bouvy 897296208f [FIX] base_automation: avoid key error when trying to return a warning
Before the refactoring introduced at 0a744ac, it was possible to return
a warning from a `code`-type base automation with the `action` variable:
```py
if len(record.name) > 20:
    action = {
        "warning": {
            "title": "Name too long",
	    "message": "The name of the record is too long",
	}
    }
```

This would trigger a visual dialog with the title and message in the
client.

Due to a louche `+=` operator change in the refacto, this kind of
automation raises a key error on the server, as the additive part of
the operator will try to access the 'warning' key in the result dict,
which may not (and usually will not) exist.

I assume this was done in an attempt to 'accumulate' warnings, but the
warnings in questions are dict that are not really additive anyway.
Better to support the *last* returned warning rather than none at all.

This commit basically returns to the previous situation for onchange
warnings.

closes odoo/odoo#148140

Signed-off-by: Bouvy Damien (dbo) <dbo@odoo.com>
2024-01-04 18:17:34 +00:00
2023-11-02 21:02:44 +00:00
2023-12-26 08:36:45 +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%