← Back to team overview

credativ team mailing list archive

[Bug 1260372] Re: [7.0][trunk] Reference field and module dependency

 

** Also affects: openupgrade-server
   Importance: Undecided
       Status: New

** No longer affects: openupgrade-addons

** No longer affects: openobject-server

-- 
You received this bug notification because you are a member of
OpenUpgrade Committers, which is subscribed to OpenUpgrade Server.
https://bugs.launchpad.net/bugs/1260372

Title:
  [7.0][trunk] Reference field and module dependency

Status in OpenUpgrade Server:
  New

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.reference('Reference', selection=crm._links_get, size=128),
  - 'ref2': fields.reference('Reference 2', selection=crm._links_get, size=128),

  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_line[field_name]:
          if isinstance(result_line[field_name], browse_record):
              new_data[field_name] = result_line[field_name]
          else:
              ref_obj, ref_id = result_line[field_name].split(',')
              ref_id = long(ref_id)
              if ref_id:
                  obj = self._table.pool.get(ref_obj)
                  new_data[field_name] = browse_record(...)
              else:
                  new_data[field_name] = browse_null()
      else:
          new_data[field_name] = browse_null()

  It will produced this error:

    File "/openerp/osv/orm.py", line 340, in __init__
      self._table_name = self._table._name
  AttributeError: 'NoneType' object has no attribute '_name'

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


References