[6.1]If base_contact installed after crm :Lead will break due to location_id and contact _id field (problem on _inherit)

Bug #982751 reported by Dan Lawson
90
This bug affects 13 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Confirmed
Medium
OpenERP Publisher's Warranty Team

Bug Description

After installing CRM, leads works fine. If you install Document Management after (document), then you get the following when going to the leads list view:

InternalError: current transaction is aborted, commands ignored until end of transaction block

And the leads already there don't display. If you try to save a lead, you get:

ProgrammingError: column "location_id" of relation "crm_lead" does not exist
LINE 1: ...id","city","user_id","zip","title","partner_name","location_...
                                                             ^
(arrow lines up under location)

Revision history for this message
Dan Lawson (dlawson) wrote :

More info. If I install only those two modules, it works ok. If I install the following:

  crm Customer Relationship Management CRM Easy OpenERP SA 6.1.1.0 6.1.1.0 Installed
  account_voucher Accounting & Finance eInvoicing & Payments Normal OpenERP SA 6.1.1.0 6.1.1.0 Installed
  project Project Management Project Management Easy OpenERP SA 6.1.1.1 6.1.1.1 Installed
  account_accountant Accounting & Finance Accounting and Finance Normal OpenERP SA 6.1.1.1 6.1.1.1 Installed
  hr Human Resources Employee Directory Easy OpenERP SA 6.1.1.1 6.1.1.1 Installed
  sale Sales Management Sales Management Easy OpenERP SA 6.1.1.0 6.1.1.0 Installed
  stock Warehouse Management Warehouse Management Easy OpenERP SA 6.1.1.1 6.1.1.1 Installed
  mrp Manufacturing MRP Normal OpenERP SA 6.1.1.1 6.1.1.1 Installed
  purchase Purchase Management Purchase Management Easy OpenERP SA 6.1.1.1 6.1.1.1 Installed
  account Accounting & Finance eInvoicing Easy OpenERP SA 6.1.1.1 6.1.1.1 Installed
  account_analytic_default Accounting & Finance Account Analytic Defaults Normal OpenERP SA 6.1.1.0 6.1.1.0 Installed
  account_analytic_plans Accounting & Finance Multiple Analytic Plans Normal OpenERP SA 6.1.1.0 6.1.1.0 Installed
  account_invoice_layout Accounting & Finance Invoice Layouts Easy OpenERP SA 6.1.1.0 6.1.1.0 Installed
  base_action_rule Sales Management Automated Action Rules Normal OpenERP SA 6.1.1.0 6.1.1.0 Installed
  base_contact Customer Relationship Management Contacts Management Expert OpenERP SA 6.1.1.0 6.1.1.0 Installed
  document Knowledge Management Document Management System Normal OpenERP SA 6.1.2.1 6.1.2.1 Installed
  edi Extra Tools Electronic Data Interchange (EDI) Easy OpenERP SA 6.1.1.0 6.1.1.0 Installed
  email_template Marketing E-Mail Templates Expert OpenERP,OpenLabs 6.1.1.1 6.1.1.1 Installed
  fetchmail Extra Tools Email Gateway Normal OpenERP SA 6.1.1.0 6.1.1.0 Installed
  l10n_us Account Charts United States - Chart of accounts Normal OpenERP SA 6.1.1.1 6.1.1.1 Installed
  product Sales Management Products & Pricelists Normal OpenERP SA 6.1.1.1 6.1.1.1 Installed
  web_process Uncategorized Process Normal 6.1.2.0 6.1.2.0 Installed

In that order, it fails.

Revision history for this message
Vishal Parmar(Open ERP) (vpa-openerp) wrote :

Hello Dan Lawson,

I have checked your issue with the latest updated code of 6.1 but I didn't face the same problem and it's working fine at my end. So would you please try one's again and informed us still you have faced the same problem.

Thanks and waiting for your reply.

Changed in openobject-addons:
status: New → Incomplete
Revision history for this message
Nicolas Thomas (thomnico) wrote :

Out of the box installation using the deb package from nightly build, then installing CRM. Get the same error on trying to create first lead ..

Revision history for this message
Nicolas Thomas (thomnico) wrote :

Server Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/common/http.py", line 592, in send
    result = openerp.netsvc.dispatch_rpc(service_name, method, args)
  File "/usr/lib/pymodules/python2.7/openerp/netsvc.py", line 360, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/usr/lib/pymodules/python2.7/openerp/service/web_services.py", line 586, in dispatch
    res = fn(db, uid, *params)
  File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 167, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
  File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 121, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 176, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 164, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/usr/lib/pymodules/python2.7/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/pymodules/python2.7/openerp/osv/orm.py", line 4179, in create
    cr.execute('insert into "'+self._table+'" (id'+upd0+") values ("+str(id_new)+upd1+')', tuple(upd2))
  File "/usr/lib/pymodules/python2.7/openerp/sql_db.py", line 152, in wrapper
    return f(self, *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/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: ...d","zip","title","partner_name","planned_revenue","location_...
                                                             ^

When trying to create an opportunity...

Revision history for this message
Vishal Parmar(Open ERP) (vpa-openerp) wrote :

Hello,

Nicolas Thomas ,Thanks for reply.

I have faced the problem in trunk also. Can't create lead, opportunities.

Thanks.

Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 1 (openerp-dev-addons1)
importance: Undecided → Medium
status: Incomplete → Confirmed
Revision history for this message
Vishal Parmar(Open ERP) (vpa-openerp) wrote :
Revision history for this message
Vishal Parmar(Open ERP) (vpa-openerp) wrote :
Changed in openobject-addons:
status: Confirmed → In Progress
Revision history for this message
Turkesh Patel (openERP) (turkesh-tinyerp) wrote :

Hello Dan Lawson ,

I have checked your issue at my end its working fine with latest code. you can reopen if you still face the same problem with more detail information.

Trunk

server: 4159
addons: 6779

6.1

server: 4149
addons: 6769

Thanks,
Turkesh patel.

Changed in openobject-addons:
status: In Progress → Invalid
Revision history for this message
Patrick Monnerat (monnerat) wrote :

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

Revision history for this message
Patrick Monnerat (monnerat) wrote :

Additional info for comment #9:
System: Fedora 14 64-bit
python 2.7

Changed in openobject-addons:
status: Invalid → Confirmed
Changed in openobject-addons:
assignee: OpenERP R&D Addons Team 1 (openerp-dev-addons1) → OpenERP Publisher's Warranty Team (openerp-opw)
Revision history for this message
Ravish(OpenERP) (rmu-openerp) wrote :

Hello,

This issue is only reproduce-able in stable 6.1 .In trunk (base_contact) contact_management is remove.

Thanks..!!

Revision history for this message
Patrick Monnerat (monnerat) wrote :

According to comment #8, I tried with 6.1 branch (server: 4149, addons: 6769), but not for trunk (server: 4159, addons: 6779):
6.1 branch as tested does fail like 6.1 stable.
Would it be possible to have a backported patch for 6.1 stable ?
Thanks
Patrick

Revision history for this message
Amit Parik (amit-parik) wrote : Re: If base_contact installed after crm :Lead will break due to location_id and contact _id field (problem on _inherit)

Hello Folks,

The same another problem generated, If same scenario follow first install crm then base_contact. Try to create a lead with check opt_in or opt_out following error will generated.

2012-05-12 11:57:19,521 6593 ERROR ? openerp.sql_db: Programming error: column crm_lead.contact_id does not exist
LINE 1: ...."partner_address_id",crm_lead."date_action_last",crm_lead."...
                                                             ^
 That's why I am requesting to OPW team please fix both the issue with same bug report!

Thank you!

summary: - 6.1 - Installing the Document Management module breaks leads
+ If base_contact installed after crm :Lead will break due to location_id
+ and contact _id field (problem on _inherit)
Revision history for this message
Amit Parik (amit-parik) wrote :

Hello,

I investigate more on this issue this problem occurs due to creating a table (object loading) sequence.

On crm_lead object we have inherit(_inherit) the res.partner.address with _name= crm.lead, So it will create a new table with contains all field of res.partner.address. After that we have again inherit res.partner.address and add the location_id(res.partner.location) as well as contact_id (res.partner.contact). So if you install base_contact after the crm then crm_lead doesn't contains (location_id, contact_id) because it will doesn't update the crm.lead object (due to the framework limitation). This issue already posted on framework please check lp:996816 (We are trying to fix this from server side first).

Let me explain further from fixing: We can not add directly location_id, contact_id because we need to add res.partner.location and res.partner.contact on crm (Which is not feasible for stable version). Also for stable version we can't wait for that this issue will fix from server side. So Finally this is a blocking point for 6.1 and we have fix it.

As per my suggestion we have to put a base_contact under dependency of crm then this issue will fix easily.

@Patrick : For temporary solution of this issue please update your db with (-u all -d dbname) then your issue will be solved or put a base_contact under the depends on crm.

Thanks

Amit Parik (amit-parik)
summary: - If base_contact installed after crm :Lead will break due to location_id
- and contact _id field (problem on _inherit)
+ [6.1]If base_contact installed after crm :Lead will break due to
+ location_id and contact _id field (problem on _inherit)
Revision history for this message
Patrick Monnerat (monnerat) wrote :

@Amit: thanks for the temporary solution: I added the dependency following your recommendation and it did the job as expected!
Many thanks again
Cheers,
Patrick

Revision history for this message
sluc23 (sluc23) wrote :

Hi, We installed v6.1 recently and we are facing the same issue.

Is there another solution than changing the dependencies? That means to do a fresh installation and then re-install from scratch the modules right?
We are already using the installation and with a big DB loaded, and cannot reinstall everything

Cheers

Revision history for this message
Amit Parik (amit-parik) wrote :

Hello,

As I said on my comment#14. Update your database like (-u all -d database name) then It will solved your problem.

Thanks!

Revision history for this message
pokoli (pokoli) wrote :

Added base_contact as dependency of crm module and updated the database (-u all -d database name) and solved the problem.

Revision history for this message
Alex (gravicaper) wrote :

Hello Amit Parikh.
Please explain me, what you mean update db?
I need run this like - openerp-server -u all -d db_name
Please, help me

Revision history for this message
Amit Parik (amit-parik) wrote :

Hello Alex,

As I said on my comment#14, "For temporary solution of this issue please update your db with (-u all -d dbname) then your issue will be solved or put a base_contact under the depends on crm.

So for 1st point as you said on your comment please do it. Othewise put the base_contact is under dependency of crm. Its not a correct solution but you can use it for temporary based.

Note: We have already removed the base_contact on trunk for v7, So this issue doesn't affect for the future version!

Thank you!

Revision history for this message
DaleEMoore (daleemoore) wrote :

In some installs you must enable openerp's login.

# vi /etc/passwd
Change openerp's line from /bin/false to /bin/bash.
# mkdir /home/openerp
# chown openerp:openerp /home/openerp

Stop the running the openerp service, become openerp user, update the database, restart openerp

# service openerp stop
# su - openerp
$ openerp-server --update=all --database=<insert name of database here>
$ openerp-server --update=all --database=openerp1
$ openerp-server -u=all -d=openerp1
# service openerp start

Revision history for this message
Alex (gravicaper) wrote :

Hello Amit Parik and DaleEMoore
I had make all of you described. And now all OK with my OpenERP

I want to tell one thing. My OpenERP user in postgres password protected. That is for update DB I used this command line:

$ openerp-server --update=all --db_user=openerp --db_password=MYPASSWD --database=MYDB

Thanks

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.