← Back to team overview

openupgrade-drivers team mailing list archive

[Question #236464]: [7.0] updating account_invoice.partner_id change 'number' field & crash

 

New question #236464 on OpenUpgrade Addons:
https://answers.launchpad.net/openupgrade-addons/+question/236464

Hi, 

I'm trying to run openUpgrade on a database and I have a problem in the migration of 'account' module. 

in the post_migration.py script, there is a call to 'set_partner_id_from_partner_address_id' for the model 'account.invoice'.
This function does a 'write' with vals={'partner_id' : XXX}

In this operation, the orm try to change 'number' fields and raise an error.
ERROR my_db_name openerp.sql_db: bad query: update "account_invoice" set "number"='26' where id = 33

I don't understand why changing a 'partner_id' raise the change of 'number' but the fact is that the function "_store_get_values" in orm.py return 'number' reference.

Temporary workaround I found is to replace (in openupgrade_70.py) the line : 
model.write(cr, SUPERUSER_ID, row[0], {partner_field: row[1]})
by : 
cr.execute("""UPDATE %s set %s = %s where id=%s""" %(table, partner_field, row[1], row[0]))

Are you facing with the same kind of behaviour ?

-- 
You received this question notification because you are a member of
OpenUpgrade Drivers, which is an answer contact for OpenUpgrade Addons.