diff options
| author | Nicolas Lempereur <nle@odoo.com> | 2018-03-06 09:32:34 +0100 |
|---|---|---|
| committer | Nicolas Lempereur <nle@odoo.com> | 2018-03-06 10:25:24 +0100 |
| commit | 1bf25fc018a49bce36c1c19d424e3e2f2800e81c (patch) | |
| tree | cc8d6c293b3284a85df957fc2484701ccd121e2c | |
| parent | 38ae172c3b9f7bc012edf80757fd0d72e40e3117 (diff) | |
[FIX] stock_account: no creating 2 def ir.property
property_stock_account_input_categ_id,
property_stock_account_output_categ_id,
property_stock_valuation_account_id ir.property default values on
product.category could be duplicated eg. if l10n_generic_coa was
installed before stock_account.
This did not happen in enterprise but happened in enterprise breaking
the test added in odoo/odoo@6bcf9ac2e.
| -rw-r--r-- | addons/stock_account/data/stock_account_data_post_install.yml | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/addons/stock_account/data/stock_account_data_post_install.yml b/addons/stock_account/data/stock_account_data_post_install.yml index 332c995f708..d8d867b2080 100644 --- a/addons/stock_account/data/stock_account_data_post_install.yml +++ b/addons/stock_account/data/stock_account_data_post_install.yml @@ -56,7 +56,10 @@ 'value': value, 'res_id': 'product.category,'+str(ref('product.product_category_all')), } - properties = PropertyObj.search([('name', '=', record), ('company_id', '=', company.id), ('value_reference', '!=', False)]) - if not properties: - #create the property + properties = PropertyObj.search([('name', '=', record), ('company_id', '=', company.id)]) + if properties: + # the property exist: modify it + properties.write(vals) + else: + # create the property PropertyObj.create(vals) |
