[7.0][trunk] Reference field and module dependency
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenUpgrade Server |
New
|
Undecided
|
Unassigned |
Bug Description
I'm stuck on something really hard.
I experienced this bug while upgrading from 6.1 to 7.0 and the error occurred when upgrading "crm.lead" partners.
A call write is done via model.write(cr, SUPERUSER_ID, row[0], {partner_field: row[1]}).
Since the "crm.lead" model own some stored fields ('day_open, 'day_close', 'state'), their values are computed on write and I don't know why, but all fields are "get" in _store_set_values.
The problem here is that two references fields exists in the "crm.lead" module:
- 'ref': fields.
- 'ref2': fields.
A reference field can be a "sale.order" and that's the problem since "sale.order" is not loaded when upgrading the crm module (and sale is not a dependency of crm), so the obj return by pool.get is None in __getitem__ [orm.py:468]:
elif field_column._type == 'reference':
if result_
if isinstance(
else:
ref_id = long(ref_id)
if ref_id:
obj = self._table.
else:
else:
It will produced this error:
File "/openerp/
self.
AttributeError: 'NoneType' object has no attribute '_name'
description: | updated |
no longer affects: | openupgrade-addons |
no longer affects: | openobject-server |
Not so hard in fact, I just added a new condition on obj and the upgrade worked fine. I'm reporting this as a bug for OpenERP server as it could occurred in other situations
if obj: data[field_ name] = browse_record(...) data[field_ name] = browse_null()
new_
else:
new_