← Back to team overview

credativ team mailing list archive

[Bug 1025819] Re: New units of measure reference old ones that have been deleted

 

** Branch linked: lp:~zaber/openupgrade-addons/recreate-uom

-- 
You received this bug notification because you are a member of
OpenUpgrade Committers, which is the registrant for OpenUpgrade Addons.
https://bugs.launchpad.net/bugs/1025819

Title:
  New units of measure reference old ones that have been deleted

Status in OpenUpgrade Addons:
  New

Bug description:
  When I try to upgrade from 5.0.16 to 6.0, I get the following error
  (slightly edited):

  [...] INFO:OpenUpgrade:product: loading migrations/6.0.1.1/data.xml
  [...] ERROR:db.cursor:bad query: insert into "product_uom" (id,"uom_type","rounding","active","factor",create_uid,create_date) values (10,'reference','0.01','True',1.0,1,now())
  Traceback (most recent call last):
    File "[...]/server/upgrade-6.0/bin/sql_db.py", line 131, in execute
      res = self._obj.execute(query, params)
  IntegrityError: null value in column "category_id" violates not-null constraint

  [...] ERROR:tools.convert.xml_import:Parse error in [...]/addons/upgrade-6.0/product/migrations/6.0.1.1/data.xml:19: 
  <record id="product_uom_kgm" model="product.uom">
              <field name="factor" eval="1"/>
          </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 Products menu, choose Configuration: Units of Measure: Units of Measure.
  5. Delete the record with code "KGM".
  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:
  I think the data.xml file is being processed as if the module were being installed for the first time, so it tries to insert the missing kilogram unit. However, that record in the data file was intended to update an existing record and doesn't have all the required fields, so the insert fails. This is similar to bug 1025797.

  Suggested fix:
  Recreate any deleted unit of measure records and mark them as inactive. I'll create a merge proposal with the code, but it requires the fix to bug 1025797 first.

To manage notifications about this bug go to:
https://bugs.launchpad.net/openupgrade-addons/+bug/1025819/+subscriptions


References