Comment 9 for bug 982751

Revision history for this message
Patrick Monnerat (monnerat) wrote : Re: 6.1 - Installing the Document Management module breaks leads

I can reproduce it both with 6.1 stable and the 6.1 snapshots mentioned in comment 8: this bug should then be reopened.
In addition, I can provide some more details:

An easier way to reproduce:
Create a new database and install in that order:
a) crm
b) base_contact
c) document or product

Then go to sales/leads/create, type-in some name and then save: the crash occurs here.
Server Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/openerp/addons/web/common/http.py", line 592, in send
    result = openerp.netsvc.dispatch_rpc(service_name, method, args)
  File "/usr/lib/python2.7/site-packages/openerp/netsvc.py", line 359, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/usr/lib/python2.7/site-packages/openerp/service/web_services.py", line 572, in dispatch
    res = fn(db, uid, *params)
  File "/usr/lib/python2.7/site-packages/openerp/osv/osv.py", line 167, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
  File "/usr/lib/python2.7/site-packages/openerp/osv/osv.py", line 121, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/openerp/osv/osv.py", line 176, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/usr/lib/python2.7/site-packages/openerp/osv/osv.py", line 164, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/usr/lib/python2.7/site-packages/openerp/addons/base_contact/base_contact.py", line 223, in create
    result = super(res_partner_address, self).create(cr, uid, data, context=context)
  File "/usr/lib/python2.7/site-packages/openerp/osv/orm.py", line 4154, in create
    cr.execute('insert into "'+self._table+'" (id'+upd0+") values ("+str(id_new)+upd1+')', tuple(upd2))
  File "/usr/lib/python2.7/site-packages/openerp/sql_db.py", line 152, in wrapper
    return f(self, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/openerp/sql_db.py", line 212, in execute
    res = self._obj.execute(query, params)
ProgrammingError: column "location_id" of relation "crm_lead" does not exist
LINE 1: ...id","city","user_id","zip","title","partner_name","location_...
                                                             ^
I used the web interface, but gtk client shows a server error too.
If you install base_contact before crm, the problem does not occur.
If you do not install a module after base_contact, the problem does not occur.

I tried to look at the code, but this is too complicated for my little C-programmer brain :-/

However, it looks like creation of the crm_lead record is performed by the base_contact's res_partner_address create method, that adds a "location_id" field to the data, but the crm_lead table has no such column. Of course, the problem does not occur if the base_contact module is not installed.

I hope these informations can help. A patch would be welcomed.
Thanks for support,
Patrick