Renaming custom m2m fields is not supported

Bug #849887 reported by Amit Dodiya (OpenERP)
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Confirmed
Wishlist
OpenERP's Framework R&D

Bug Description

To reproduce the issue follow the given steps :

1). Create a object x_product.material with one char field
2). Create a m2m field x_material_id in product.product object with object reference to x_product.material and save it.
3). Edit the m2m x_material_id column name

It raise the following error.

[2011-09-14 15:30:11,081][16933] ERROR:db.cursor:Programming error: column "x_material_id" does not exist
, in query ALTER TABLE "product_product" RENAME COLUMN "x_material_id" TO "x_dsdfsd_id"
[2011-09-14 15:30:11,081][16933] ERROR:web-services:Uncaught exception
Traceback (most recent call last):
  File "/home/ado/Desktop/6.0/stable-6/openobject-server/bin/osv/osv.py", line 122, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/ado/Desktop/6.0/stable-6/openobject-server/bin/osv/osv.py", line 176, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/ado/Desktop/6.0/stable-6/openobject-server/bin/osv/osv.py", line 167, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/ado/Desktop/6.0/stable-6/openobject-server/bin/addons/base/ir/ir_model.py", line 144, in write
    return super(ir_model,self).write(cr, user, ids, vals, context)
  File "/home/ado/Desktop/6.0/stable-6/openobject-server/bin/osv/orm.py", line 3438, in write
    result += self._columns[field].set(cr, self, id, field, vals[field], user, context=rel_context) or []
  File "/home/ado/Desktop/6.0/stable-6/openobject-server/bin/osv/fields.py", line 505, in set
    obj.write(cr, user, [act[1]], act[2], context=context)
  File "/home/ado/Desktop/6.0/stable-6/openobject-server/bin/addons/base/ir/ir_model.py", line 381, in write
    cr.execute('ALTER TABLE "%s" RENAME COLUMN "%s" TO "%s"' % column_rename[1])
  File "/home/ado/Desktop/6.0/stable-6/openobject-server/bin/sql_db.py", line 78, in wrapper
    return f(self, *args, **kwargs)
  File "/home/ado/Desktop/6.0/stable-6/openobject-server/bin/sql_db.py", line 131, in execute
    res = self._obj.execute(query, params)
ProgrammingError: column "x_material_id" does not exist

affects: openobject-addons → openobject-server
Changed in openobject-server:
assignee: nobody → OpenERP's Framework R&D (openerp-dev-framework)
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :

looking at the bug description and traceback and following what is described on the bug this does not seems to be reproduced on latest trunk. I can easily add a custom field. I attach images to show the m2m on product added.

please reopen if you still find a problem.

Thanks,

Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :
Changed in openobject-server:
status: Confirmed → Incomplete
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

I confirm that on latest trunk (rev. 4072) trying to rename a custom m2m column does not work and causes the following traceback. However the importance of this bug should be corrected, it is at best a Low priority issue, and rather a Wishlist.
Renaming of custom columns is experimental, especially for many2many fields. The fix might involve returning a clear error message that explains this is not supported, and the custom column should instead be dropped and re-added.

Server Traceback (most recent call last):
  File "/home/odoo/runbot/static/openerp-dev-trunk-3243/server/openerp/addons/web/common/http.py", line 592, in send
    result = openerp.netsvc.dispatch_rpc(service_name, method, args)
  File "/home/odoo/runbot/static/openerp-dev-trunk-3243/server/openerp/netsvc.py", line 360, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/home/odoo/runbot/static/openerp-dev-trunk-3243/server/openerp/service/web_services.py", line 572, in dispatch
    res = fn(db, uid, *params)
  File "/home/odoo/runbot/static/openerp-dev-trunk-3243/server/openerp/osv/osv.py", line 167, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
  File "/home/odoo/runbot/static/openerp-dev-trunk-3243/server/openerp/osv/osv.py", line 121, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/odoo/runbot/static/openerp-dev-trunk-3243/server/openerp/osv/osv.py", line 176, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/odoo/runbot/static/openerp-dev-trunk-3243/server/openerp/addons/audittrail/audittrail.py", line 495, in execute_cr
    return fct_src(cr, uid, model, method, *args)
  File "/home/odoo/runbot/static/openerp-dev-trunk-3243/server/openerp/osv/osv.py", line 164, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/odoo/runbot/static/openerp-dev-trunk-3243/server/openerp/addons/base/ir/ir_model.py", line 153, in write
    return super(ir_model,self).write(cr, user, ids, vals, context)
  File "/home/odoo/runbot/static/openerp-dev-trunk-3243/server/openerp/osv/orm.py", line 3920, in write
    result += self._columns[field].set(cr, self, id, field, vals[field], user, context=rel_context) or []
  File "/home/odoo/runbot/static/openerp-dev-trunk-3243/server/openerp/osv/fields.py", line 567, in set
    obj.write(cr, user, [act[1]], act[2], context=context)
  File "/home/odoo/runbot/static/openerp-dev-trunk-3243/server/openerp/addons/base/ir/ir_model.py", line 400, in write
    cr.execute('ALTER TABLE "%s" RENAME COLUMN "%s" TO "%s"' % column_rename[1])
  File "/home/odoo/runbot/static/openerp-dev-trunk-3243/server/openerp/sql_db.py", line 152, in wrapper
    return f(self, *args, **kwargs)
  File "/home/odoo/runbot/static/openerp-dev-trunk-3243/server/openerp/sql_db.py", line 212, in execute
    res = self._obj.execute(query, params)
ProgrammingError: column "x_test_ids" does not exist

Changed in openobject-server:
importance: Medium → Wishlist
status: Incomplete → Confirmed
summary: - Editing of custom m2m field in Object raise an error
+ Renaming custom m2m fields is not supported
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.