openerp-india team mailing list archive
-
openerp-india team
-
Mailing list archive
-
Message #09162
[Bug 950118] Re: Duplication of a Group with application name containing ampersand character.
The fix provided by Valentin in the related merge proposal did solve the
issue and improve the code at the same time, well done! It was merged in
the 6.1 branch of openobject-server[1], which will itself be merged soon
in trunk as well (to port all recent fixes)
Thanks for reporting this issue and providing a very welcome patch!
[1] At rev. 4115 rev-id: odo@xxxxxxxxxxx-20120319170454-cjzbtk2aqodaz2xm
** Changed in: openobject-server
Status: Fix Committed => Fix Released
** Changed in: openobject-server
Milestone: None => 6.1
** Summary changed:
- Duplication of a Group with application name containing ampersand character.
+ Dynamic group view does not properly handle application names containing ampersands
--
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/950118
Title:
Dynamic group view does not properly handle application names
containing ampersands
Status in OpenERP Server:
Fix Released
Bug description:
When trying to duplicate a group which application contains an
ampersand (as "Invoice & Payments" does), the server issues:
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 360, in dispatch_rpc
result = ExportService.getService(service_name).dispatch(method, params)
File "openobject-server/openerp/service/web_services.py", line 572, 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/addons/base/res/res_users.py", line 83, in copy
return super(groups, self).copy(cr, uid, id, default, context)
File "openobject-server/openerp/osv/orm.py", line 4732, in copy
new_id = self.create(cr, uid, data, context)
File "openobject-server/openerp/addons/base/res/res_users.py", line 727, in create
res = super(groups_view, self).create(cr, uid, values, context)
File "openobject-server/openerp/addons/base/res/res_users.py", line 637, in create
self.write(cr, uid, [gid], {'users': users}, context)
File "openobject-server/openerp/addons/base/res/res_users.py", line 733, in write
self.update_user_groups_view(cr, uid, context)
File "openobject-server/openerp/addons/base/res/res_users.py", line 768, in update_user_groups_view
view.write({'arch': xml % ('\n'.join(xml1), '\n'.join(xml2))})
File "openobject-server/openerp/osv/orm.py", line 368, in function_proxy
return attr(self._cr, self._uid, [self._id], *args, **kwargs)
File "openobject-server/openerp/addons/base/ir/ir_ui_view.py", line 117, in write
result = super(view, self).write(cr, uid, ids, vals, context)
File "openobject-server/openerp/osv/orm.py", line 3943, in write
self._validate(cr, user, ids, context)
File "openobject-server/openerp/osv/orm.py", line 1448, in _validate
if not fun(self, cr, uid, ids):
File "openobject-server/openerp/addons/base/ir/ir_ui_view.py", line 78, in _check_xml
eview = etree.fromstring(view.arch.encode('utf8'))
File "lxml.etree.pyx", line 2743, in lxml.etree.fromstring (src/lxml/lxml.etree.c:52665)
File "parser.pxi", line 1573, in lxml.etree._parseMemoryDocument (src/lxml/lxml.etree.c:79932)
File "parser.pxi", line 1452, in lxml.etree._parseDoc (src/lxml/lxml.etree.c:78774)
File "parser.pxi", line 960, in lxml.etree._BaseParser._parseDoc (src/lxml/lxml.etree.c:75389)
File "parser.pxi", line 564, in lxml.etree._ParserContext._handleParseResultDoc (src/lxml/lxml.etree.c:71739)
File "parser.pxi", line 645, in lxml.etree._handleParseResult (src/lxml/lxml.etree.c:72614)
File "parser.pxi", line 585, in lxml.etree._raiseParseError (src/lxml/lxml.etree.c:71955)
XMLSyntaxError: xmlParseEntityRef: no name, line 11, column 30
TO REPRODUCE:
From a new empty database,
1 - go to Settings/Users/Groups
2 - create new group with application "Invoicing & Payments". The group name doesn't matters.
3 - try to duplicate this new Group.
DIAGNOSTIC:
Characters in the application name are not protected in
"base/res/res_users.py" in "groups_view" model, method
'update_user_groups_view' line 764:
xml2.append('<separator string="%s" colspan="4"/>' % app_name)
At validation time, the xml is checked by launching
etree.fromstring(...) which cast the reported exception.
SOLUTION PROPOSED:
Why write some XML bare handed ? lxml is at your disposal and is used
in others location of the code...
I might post some code to remove the problem in the next day.
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/950118/+subscriptions
References