** Branch linked: lp:~zaber/openupgrade-server/recreate-currencies
--
You received this bug notification because you are a member of
OpenUpgrade Committers, which is the registrant for OpenUpgrade Server.
https://bugs.launchpad.net/bugs/1025797
Title:
New configuration records reference old ones that have been deleted
Status in OpenUpgrade Server:
New
Bug description:
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:
<record id="rateIDR1" model="res.currency.rate">
<field name="rate">14352.00</field>
<field name="currency_id" ref="IDR"/>
<field eval="time.strftime('2009-01-01')" name="name"/>
</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.
5. Delete the record with code "IDR".
6. 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.
To manage notifications about this bug go to:
https://bugs.launchpad.net/openupgrade-server/+bug/1025797/+subscriptions
--
Mailing list: https://launchpad.net/~credativ
Post to : [email protected]
Unsubscribe : https://launchpad.net/~credativ
More help : https://help.launchpad.net/ListHelp