Install ended with error

Bug #511979 reported by Ton Swart
44
This bug affects 9 people
Affects Status Importance Assigned to Milestone
Magento OpenERP Connector
Fix Released
Undecided
Unassigned

Bug Description

I tried to install it on a new Windows installation 5.06 but I getting the following error:

Environment Information :
System : Windows-Vista-6.0.6002-SP2
OS Name : nt
Operating System Release : Vista
Operating System Version : 6.0.6002
Operating System Architecture : 32bit
Operating System Locale : en_US.cp1252
Python Version : 2.5.2
OpenERP-Client Version : 5.0.6
Last revision No. & ID :Bazaar Package not Found !Traceback (most recent call last):
  File "netsvc.pyo", line 244, in dispatch
  File "netsvc.pyo", line 73, in __call__
  File "service\web_services.pyo", line 639, in execute
  File "service\web_services.pyo", line 619, in _execute
  File "wizard\__init__.pyo", line 178, in execute
  File "wizard\__init__.pyo", line 74, in execute_cr
  File "C:\Program Files\OpenErp\OpenERP AllInOne\Server\addons\base\module\wizard\wizard_module_upgrade.py", line 92, in _upgrade_module
  File "pooler.pyo", line 62, in restart_pool
  File "pooler.pyo", line 40, in get_db_and_pool
  File "addons\__init__.pyo", line 728, in load_modules
  File "addons\__init__.pyo", line 581, in load_module_graph
  File "addons\__init__.pyo", line 366, in init_module_objects
  File "C:\Program Files\OpenErp\OpenERP AllInOne\Server\addons\magentoerpconnect_generic\sale.py", line 129, in _auto_init
  File "sql_db.pyo", line 76, in wrapper
  File "sql_db.pyo", line 120, in execute
NotSupportedError: cannot alter type of a column used by a view or rule
DETAIL: rule _RETURN on view sale_journal_picking_stats depends on column "discount"

Revision history for this message
Ton Swart (ton-swart) wrote :

Installed with demo data - new install without demo data and no problem.

Changed in magentoerpconnect:
status: New → Fix Committed
Revision history for this message
Thomas Dreiling (thomas-dreiling) wrote :

I do run into this bug with a new database w/o demo data. This was not a fix. You will trigger the error either if you first install sale_journal and then magentoerpconnect or try to update the magentoerpconnect module with sale_journal being installed.
Here's my error log:

Environment Information :
System : Windows-Vista-6.1.7600
OS Name : nt
Operating System Release : Vista
Operating System Version : 6.1.7600
Operating System Architecture : 32bit
Operating System Locale : de_DE.cp1252
Python Version : 2.5.2
OpenERP-Client Version : 5.0.12
Last revision No. & ID :Bazaar Package not Found !Traceback (most recent call last):
  File "/home/thomdrei/workspace/server/bin/netsvc.py", line 247, in dispatch
    result = LocalService(service_name)(method, *params)
  File "/home/thomdrei/workspace/server/bin/netsvc.py", line 76, in __call__
    return getattr(self, method)(*params)
  File "/home/thomdrei/workspace/server/bin/service/web_services.py", line 633, in execute
    return self._execute(db, uid, wiz_id, datas, action, context)
  File "/home/thomdrei/workspace/server/bin/service/web_services.py", line 613, in _execute
    return wiz.execute(db, uid, self.wiz_datas[wiz_id], action, context)
  File "/home/thomdrei/workspace/server/bin/wizard/__init__.py", line 178, in execute
    res = self.execute_cr(cr, uid, data, state, context)
  File "/home/thomdrei/workspace/server/bin/wizard/__init__.py", line 73, in execute_cr
    action_res = action(self, cr, uid, data, context)
  File "/home/thomdrei/workspace/server/bin/addons/base/module/wizard/wizard_module_upgrade.py", line 92, in _upgrade_module
    db, pool = pooler.restart_pool(cr.dbname, update_module=True)
  File "/home/thomdrei/workspace/server/bin/pooler.py", line 62, in restart_pool
    return get_db_and_pool(db_name, force_demo, status, update_module=update_module)
  File "/home/thomdrei/workspace/server/bin/pooler.py", line 40, in get_db_and_pool
    addons.load_modules(db, force_demo, status, update_module)
  File "/home/thomdrei/workspace/server/bin/addons/__init__.py", line 741, in load_modules
    r = load_module_graph(cr, graph, status, report=report)
  File "/home/thomdrei/workspace/server/bin/addons/__init__.py", line 584, in load_module_graph
    init_module_objects(cr, package.name, modules)
  File "/home/thomdrei/workspace/server/bin/addons/__init__.py", line 367, in init_module_objects
    result = obj._auto_init(cr, {'module': module_name})
  File "/home/thomdrei/workspace/addons/magentoerpconnect/sale.py", line 239, in _auto_init
    cr.execute("ALTER TABLE sale_order_line ALTER COLUMN discount TYPE numeric(16,6);")
  File "/home/thomdrei/workspace/server/bin/sql_db.py", line 77, in wrapper
    return f(self, *args, **kwargs)
  File "/home/thomdrei/workspace/server/bin/sql_db.py", line 122, in execute
    res = self._obj.execute(query, params)
NotSupportedError: FEHLER: Typ einer Spalte, die von einer Sicht oder Regel verwendet wird, kann nicht geändert werden
DETAIL: Regel _RETURN für Sicht sale_journal_picking_stats hängt von Spalte »discount« ab

Changed in magentoerpconnect:
status: Fix Committed → Confirmed
Revision history for this message
Peter Glock (peter-glock) wrote :
Download full text (3.6 KiB)

I've encountered a simialr bug today on a new install 6.0 rc1 without demo data:

Environment Information :
System : Darwin-10.5.0-i386-64bit
OS Name : posix
Your System is not lsb compliant
Operating System Release : 10.5.0
Operating System Version : Darwin Kernel Version 10.5.0: Fri Nov 5 23:20:39 PDT 2010; root:xnu-1504.9.17~1/RELEASE_I386
Operating System Architecture : 64bit
Operating System Locale : en_GB.UTF8
Python Version : 2.7.1
OpenERP-Client Version : 6.0.0-rc1-1
Last revision No. & ID :1718 <email address hidden>
Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/openerp-server/netsvc.py", line 489, in dispatch
    result = ExportService.getService(service_name).dispatch(method, auth, params)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/openerp-server/service/web_services.py", line 598, in dispatch
    res = fn(db, uid, *params)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/openerp-server/osv/osv.py", line 122, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/openerp-server/osv/osv.py", line 176, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/openerp-server/osv/osv.py", line 167, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/openerp-server/addons/base/module/wizard/base_module_upgrade.py", line 100, in upgrade_module
    _, pool = pooler.restart_pool(cr.dbname, update_module=True)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/openerp-server/pooler.py", line 60, in restart_pool
    return get_db_and_pool(db_name, force_demo, status, update_module=update_module)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/openerp-server/pooler.py", line 39, in get_db_and_pool
    addons.load_modules(db, force_demo, status, update_module)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/openerp-server/addons/__init__.py", line 869, in load_modules
    r = load_module_graph(cr, graph, status, report=report)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/openerp-server/addons/__init__.py", line 715, in load_module_graph
    init_module_objects(cr, package.name, modules)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/openerp-server/addons/__init__.py", line 409, in init_module_objects
    result = obj._auto_init(cr, {'module': module_name})
  File "/opt/local/src/openerp/addons/magentoerpconnect6/sale.py", line 259, in _auto_init
    cr.execute("ALTER TABLE account_invoice_line ALTER COLUMN discount TYPE numeric(16,6);")
  File "/opt/local/Library/Frameworks/Python.f...

Read more...

Revision history for this message
Steven_M (stevenmoca) wrote :

Similar error on a database with demo data:

Environment Information :
System : Windows-Vista-6.1.7600
OS Name : nt
Operating System Release : Vista
Operating System Version : 6.1.7600
Operating System Architecture : 32bit
Operating System Locale : en_US.cp1252
Python Version : 2.5.2
OpenERP-Client Version : 6.0.1
Last revision No. & ID :Bazaar Package not Found !Traceback (most recent call last):
  File "/opt/openerp/openobject-server/bin/netsvc.py", line 489, in dispatch
    result = ExportService.getService(service_name).dispatch(method, auth, params)
  File "/opt/openerp/openobject-server/bin/service/web_services.py", line 599, in dispatch
    res = fn(db, uid, *params)
  File "/opt/openerp/openobject-server/bin/osv/osv.py", line 122, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/opt/openerp/openobject-server/bin/osv/osv.py", line 176, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/opt/openerp/openobject-server/bin/osv/osv.py", line 167, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/opt/openerp/openobject-server/bin/addons/base/module/wizard/base_module_upgrade.py", line 98, in upgrade_module
    _db, pool = pooler.restart_pool(cr.dbname, update_module=True)
  File "/opt/openerp/openobject-server/bin/pooler.py", line 60, in restart_pool
    return get_db_and_pool(db_name, force_demo, status, update_module=update_module)
  File "/opt/openerp/openobject-server/bin/pooler.py", line 39, in get_db_and_pool
    addons.load_modules(db, force_demo, status, update_module)
  File "/opt/openerp/openobject-server/bin/addons/__init__.py", line 883, in load_modules
    processed_modules.extend(load_module_graph(cr, graph, status, report=report, skip_modules=processed_modules))
  File "/opt/openerp/openobject-server/bin/addons/__init__.py", line 719, in load_module_graph
    init_module_objects(cr, package.name, modules)
  File "/opt/openerp/openobject-server/bin/addons/__init__.py", line 414, in init_module_objects
    result = obj._auto_init(cr, {'module': module_name})
  File "/opt/openerp/trunk-addons-community/openerp6-module/sale.py", line 283, in _auto_init
    cr.execute("ALTER TABLE account_invoice_line ALTER COLUMN discount TYPE numeric(16,6);")
  File "/opt/openerp/openobject-server/bin/sql_db.py", line 76, in wrapper
    if self.__closed:
  File "/opt/openerp/openobject-server/bin/sql_db.py", line 129, in execute
    try:
NotSupportedError: cannot alter type of a column used by a view or rule
DETAIL: rule _RETURN on view report_account_invoice_product depends on column "discount"

Revision history for this message
photo7 (photo7) wrote :

This is just a limitation on Postgres engine, that you can't alter column if it is involved in any view. Obviously this can be dealt by creating "discount" column with required type in the first place...

This is what needs to be done to bypass this error:

1. get the view definition schema
2. Drop the view
3. alter "dicount" column
4. recreate view
5. Comment the alter statement in sale.py
6. restart erp server
7. install magentoconnect

I did the pl/pgsql script for this - see attachment, but it will only run as is on postgres 9. But it can be adopted to run on 8 as well or you need to do it manually in psql.

Revision history for this message
anaspeople (anaspeople) wrote :

I'm getting the same error with demo data.
Could someone explain how it can be fix with a postgresql-8.4 installation? Does some module need to be installed before others so that this error wont occur?

Revision history for this message
Vincent Serpoul (vincent-serpoul) wrote :

For postgresql-8.4, here is what you can do :
1. launch psql -U <youropenerpusername>
2.
DROP VIEW report_account_invoice_product;

ALTER TABLE account_invoice_line ALTER COLUMN discount TYPE numeric(16,6);

CREATE VIEW report_account_invoice_product AS SELECT min(l.id) AS id, i.create_date AS date, to_char(date_trunc('day'::text, (i.date_invoice)::timestamp with time zone), 'YYYY'::text) AS year, to_char(date_trunc('day'::text, (i.date_invoice)::timestamp with time zone), 'MM'::text) AS month, to_char(date_trunc('day'::text, (i.date_invoice)::timestamp with time zone), 'YYYY-MM-DD'::text) AS day, i.type, i.state, l.product_id, t.categ_id, i.partner_id, sum(((l.quantity * (l.price_unit)::double precision) * ((1.0 - (l.discount / 100.0)))::double precision)) AS amount, sum((l.quantity * (l.cost_price)::double precision)) AS cost_price, sum((((l.quantity * (l.price_unit)::double precision) * ((1.0 - (l.discount / 100.0)))::double precision) - (l.quantity * (l.cost_price)::double precision))) AS margin, sum(l.quantity) AS quantity FROM (((account_invoice i LEFT JOIN account_invoice_line l ON ((i.id = l.invoice_id))) LEFT JOIN product_product p ON ((p.id = l.product_id))) LEFT JOIN product_template t ON ((t.id = p.product_tmpl_id))) GROUP BY t.categ_id, i.partner_id, l.product_id, i.date_invoice, i.type, i.state, i.create_date;

\q

sudo vim /usr/local/lib/python2.6/dist-packages/openerp-server/addons/openerp6-module/sale.py

/ALTER
dd for the line containing ALTER TABLE account_invoice_line ALTER COLUMN discount TYPE numeric(16,6);
:wq

Revision history for this message
Hillebrand Dalstra (hillebrand-dalstra) wrote :

Thx Vincent. Your fix solved my installation problem.

Revision history for this message
dx-vmonroig (dx-vmonroig) wrote :

Vincent solution worked perfectly, but only advice is that instead of using his SQL to recreate the view, you'll have to use the current one in the DB, because there are more modules that can change it.

Thanks, Vincent!

Revision history for this message
oliver brildor (oliver-brildor) wrote :

la solución de Vincent Serpoul funciona perfectamente pero.....

Revision history for this message
Kyle Waid (midwest) wrote :

All you have to do is comment out the cr.execute line and the problem is solved, you do not have to access the database.

Revision history for this message
Kyle Waid (midwest) wrote :

Is there a more proper fix for this, this IS an issue for migration customers.

Revision history for this message
schmutzfuss (78luphr0rnk2-launchpad) wrote :

same problem :( ... is the workaround from Kyle Waid OK? And if Yes .... could you tell me/us exactly which file and which line should be comment out?

Many thx

Revision history for this message
schmutzfuss (78luphr0rnk2-launchpad) wrote :

Additional: I cannot use the described workaround Vincent, because:

DROP VIEW report_account_invoice_product;
-> ERROR: Sicht »report_account_invoice_product« existiert nicht

ALTER TABLE account_invoice_line ALTER COLUMN discount TYPE numeric(16,6);
ERROR: Relation »account_invoice_line« existiert nicht

.....

Revision history for this message
Sébastien BEAU - http://www.akretion.com (sebastien.beau) wrote :

This bug is fixed in rev 472 on trunk version.
It was a incompatibility between sale_margin and magentoerpconnect

Changed in magentoerpconnect:
status: Confirmed → Fix Released
Revision history for this message
alfignorito (alfignorito) wrote :

With a fresh installation, don't install sale_margin and works perfect.

Revision history for this message
Kurt Miebach (kurt-miebach) wrote :

This might help someone who runs a version prior to the bug fix:

I can confirm that in some situations it can be necessary to comment out the cr.execute line, like Kyle Waid said in #11. In my case a module upgrade was not finishing without that.

I think the reason is that the module upgrade recreates the view and tries to alter the field afterwards. Even if the field is already of type numeric(16,6)

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

Other bug subscribers

Bug attachments

Remote bug watches

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