9248395e92179ca7ab22868fce62d178c31f7ea8
Steps to reproduce: - Create an empty database (without demo data) - Install stock_account - Go to Invoicing settings - Select Austria as Fiscal Localization - Go to Apps - Try to upgrade stock_account module Issue: A traceback is raised. The module tries to create the default stock accounts properties on the main company, but they already exist, which triggers a violation of the SQL unique constraint (ir_property_unique_index) of "ir.property" on the combination of (fields_id, company_id, res_id) fields. Cause: When "stock_account" module is installed/upgraded, the default stock accounts properties are created for the main company with forcecreate="True" option, which means they will be created if their "xml_id" doesn't exist, even if they are declared inside <data noupdate="1">. In this case, they are created with their "xml_id" at the module installation with the following values: - company_id: [the main company] - fields_id: ["property_stock_account_output_categ_id" field of "product.category" model] - res_id: False (to be used as a default value) - value: False When the Austrian localization (or other localizations defining their own stock accounts properties) is selected in the settings, these default properties are deleted and replaced by those coming from the localization package with some similar values but without "xml_id": - company_id: [the main company] - fields_id: ["property_stock_account_output_categ_id" field of "product.category" model] - res_id: False (to be used as a default value) - value: [depends on the localization package] Then, when upgrading "stock_account" module, as the "xml_id" of the default stock accounts properties cannot be found anymore, the upgrade process will try to re-create them and will trigger the SQL unique constraint. Solution: Move the creation of the default stock accounts properties in a python function to check if the default properties already exist based on the combination of "company_id", "fields_id" and "res_id" fields and not based on the "xml_id". opw-3682320 closes odoo/odoo#157703 X-original-commit: 7e710e4effae6dc812a9304090b5796b39fed640 Signed-off-by: William Henrotin (whe) <whe@odoo.com> Signed-off-by: Anh Thao Pham (pta) <pta@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%