f41c3b1d9e6383bbdfae2fc8d8b5c8c16c0c4f27
Suppose a user who has CRM module and wants to import some leads thanks to this CSV file: ```csv name,recurring_plan Coca-Cola,Plan01 SAP,Plan02 ``` And, because the recurring plans are not yet created on his database, he enables the option "Create new values" for that field. An error will occur and here is the only info the user will have: > current transaction is aborted, commands ignored until end of > transaction block When importing, we convert the data encoded by the user ([1]). To do so, we convert the provided values, field by field ([2]). Since `recurring_plan` is a `many2one` field, we go (through `_str_to_many2one`) in `db_id_for`. In this method, we `name_search` the record and then, if it does not exist and if the feature is enabled, we `name_create` it ([3]). Back to the above use case. We start with the first line and there is not any recurring plan called "Plan01" so we try to create it. But here is the issue: we only have a name to create the record although there is another required field: `number_of_months`. Therefore, it leads to a `NotNullViolation` error. This error is caught (see [3]) and, later in the same method, we will raise a `ValueError`. This error will be caught by one of the except in [2]: we will save the error and will then continue with the convertion of next values. However, because of the `NotNullViolation`, the current SQL transaction is broken. As a result, while trying to convert the second line of the file, we will `name_search` "Plan02" and it will simply lead to a `InFailedSqlTransaction` [1] https://github.com/odoo/odoo/blob/f3d7fdce608f692ecb08498ee158edf9dfbced5e/odoo/models.py#L1170-L1182 [2] https://github.com/odoo/odoo/blob/b80d4294a000e748677a3a0c1849140bf46ddbe8/odoo/addons/base/models/ir_fields.py#L117-L118 [3] https://github.com/odoo/odoo/blob/b80d4294a000e748677a3a0c1849140bf46ddbe8/odoo/addons/base/models/ir_fields.py#L472-L475 sentry-3969379125 closes odoo/odoo#132897 X-original-commit: 28373b9d261a48154b233fbbd895880680b0aed0 Signed-off-by: Adrien Widart (awt) <awt@odoo.com>
…
…
…
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
Languages
Python
49.6%
JavaScript
47.8%
SCSS
2%
CSS
0.3%
HTML
0.2%