[7.0] updating account_invoice.partner_id change 'number' field & crash

Asked by Sylvain LE GAL (GRAP)


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 ?

Question information

English Edit question
OpenUpgrade Addons Edit question
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) said :

Have not encountered the error. The question is, why is this a bad query? I just ran the query on a 7.0 database and it is perfectly valid. Have you customized the 'number' field, for instance changed it into a non-stored function field?

Can you help with this problem?

Provide an answer of your own, or ask Sylvain LE GAL (GRAP) for more information if necessary.

To post a message you must log in.