When I try to upgrade from 5.0.16 to 6.0, I get the following error (slightly edited):
IntegrityError: insert or update on table "res_currency_rate" violates foreign key constraint "res_currency_rate_currency_id_fkey"
DETAIL: Key (currency_id)=(12) is not present in table "res_currency".
Steps to reproduce:
1. Create a new database in 5.0 with no sample data and the manufacturing industry profile.
2. Set the view mode to Extended Interface.
3. Leave the default values for all the other setup steps, and set the chart of accounts to "None".
4. From the Financial Management menu, choose Configuration: Currencies.
4. Delete the record with code "IDR".
5. Run the migration using the options, "--update all --stop-after-init". The error occurs as listed above.
The full command line I use for the migration is as follows:
python openerp-server.py --database migrationtest --update all --stop-after-init --addons ~/upgrade-addons-6.0 --config ~/openerp-server.config
Analysis:
The new import record that you see from base_data.xml references a currency with the XML id "IDR". The import process finds the ir_model_data record that matches and reads a currency id of 12. When it tries to use that id for the insert of res_currency_rate, it violates the foreign key constraint because the original currency was deleted. (Deleting the currency record doesn't delete its matching ir_model_data record in version 5.0.)
During our migration, we found similar problems on other tables: document_directory and product_uom. I'll create separate bugs for them.
Suggested fix:
Recreate any deleted configuration records and mark them as inactive. I'll create a merge proposal with the code.
When I try to upgrade from 5.0.16 to 6.0, I get the following error (slightly edited):
IntegrityError: insert or update on table "res_currency_rate" violates foreign key constraint "res_currency_ rate_currency_ id_fkey"
DETAIL: Key (currency_id)=(12) is not present in table "res_currency".
[...] ERROR:tools. convert. xml_import: Parse error in [...]/server/ upgrade- 6.0/bin/ addons/ base/base_ data.xml: 1215: res.currency. rate"> >14352. 00</field> strftime( '2009-01- 01')" name="name"/>
<record id="rateIDR1" model="
<field name="rate"
<field name="currency_id" ref="IDR"/>
<field eval="time.
</record>
Steps to reproduce:
1. Create a new database in 5.0 with no sample data and the manufacturing industry profile.
2. Set the view mode to Extended Interface.
3. Leave the default values for all the other setup steps, and set the chart of accounts to "None".
4. From the Financial Management menu, choose Configuration: Currencies.
4. Delete the record with code "IDR".
5. Run the migration using the options, "--update all --stop-after-init". The error occurs as listed above.
The full command line I use for the migration is as follows: addons- 6.0 --config ~/openerp- server. config
python openerp-server.py --database migrationtest --update all --stop-after-init --addons ~/upgrade-
Analysis:
The new import record that you see from base_data.xml references a currency with the XML id "IDR". The import process finds the ir_model_data record that matches and reads a currency id of 12. When it tries to use that id for the insert of res_currency_rate, it violates the foreign key constraint because the original currency was deleted. (Deleting the currency record doesn't delete its matching ir_model_data record in version 5.0.)
During our migration, we found similar problems on other tables: document_directory and product_uom. I'll create separate bugs for them.
Suggested fix:
Recreate any deleted configuration records and mark them as inactive. I'll create a merge proposal with the code.