view editor will remove any inner form elements

Bug #968002 reported by Valentin Lab
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Odoo Web (MOVED TO GITHUB)
Fix Released
Medium
OpenERP R&D Web Team

Bug Description

View Editor seems broken as of rev. 2291.

I'll try to upload a video I've recorded reproducing the bug in the next comment.

Here are the steps described in full text.

From an empty database,
1 - log in administrator, get the extended view and in the debug mode (by adding "?debug" to your URL before any "#")
2 - get into Settings/Users/Groups
3 - in the debug input select widget, select: Manage Views
4 - select the only choice, and click on "Edit" to get access to the "View Editor"
5 - do any little change (for example, switch the 2 first fields "name" and "category_id" by clicking on the green arrow)
6 - Close the "View Editor", and the "View selector".

An Exception is casted by the server:

Server Traceback (most recent call last):
  File "openerp-web/addons/web/common/http.py", line 592, in send
    result = openerp.netsvc.dispatch_rpc(service_name, method, args)
  File "openobject-server/openerp/netsvc.py", line 361, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "openobject-server/openerp/service/web_services.py", line 604, in dispatch
    res = fn(db, uid, *params)
  File "openobject-server/openerp/osv/osv.py", line 167, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
  File "openobject-server/openerp/osv/osv.py", line 121, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "openobject-server/openerp/osv/osv.py", line 176, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "openobject-server/openerp/osv/osv.py", line 164, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "openobject-server/openerp/osv/orm.py", line 2149, in fields_view_get
    xarch, xfields = self.__view_look_dom_arch(cr, user, result['arch'], view_id, context=ctx)
  File "openobject-server/openerp/osv/orm.py", line 1802, in __view_look_dom_arch
    cr.execute('select name, model from ir_ui_view where (id=%s or inherit_id=%s) and arch like %s', (view_id, view_id, '%%%s%%' % field))
  File "openobject-server/openerp/sql_db.py", line 152, in wrapper
    return f(self, *args, **kwargs)
  File "openobject-server/openerp/sql_db.py", line 212, in execute
    res = self._obj.execute(query, params)
ProgrammingError: operator does not exist: integer = boolean
LINE 1: select name, model from ir_ui_view where (id=false or inheri...
                                                    ^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.

MY DIAGNOSTIC

openerp-web saves a mutilated version of the view on step 5 (modification in the View Editor), and in consequence when coming back to render the corresponding view, it crashes.

Line 634 in "addons/web/static/src/js/view_editor.js", the instruction:

  $(arch.arch)

is used to get DOM elements from raw string stored in "arch.arch". And this seems very wrong as jQuery IS NOT a xml tokenizer.

A quick check in javascript console can show that:

  > $("<form><a/><form><b/></form></form>")[0].outerHTML
  "<form><a></a><b></b></form>"

Note that the second inner form element has disappeared. This is not a jQuery bug. And this could be much worse !

And this is what is happening to our group view: a second inner "form" element in this view which is removed by the view editor.

I've provided a fix proposal which seems to work on my system.

Related branches

Revision history for this message
Valentin Lab (vaab) wrote :
Changed in openerp-web:
assignee: nobody → OpenERP R&D Web Team (openerp-dev-web)
importance: Undecided → Medium
status: New → Confirmed
Changed in openerp-web:
status: Confirmed → Fix Committed
Changed in openerp-web:
status: Fix Committed → Fix Released
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.