[FIX] m2o t-field rendering: use uid 1 for name_get

This is done automatically on a read(), but t-field uses a browse,
which does not do access-rights bypassing. We've already browsed the
root record so we should have the rights to the reading, and we just
want the textual representation for the child m2o.

bzr revid: xmo@openerp.com-20131025124720-i10eywz70o9c9dpc
This commit is contained in:
Xavier Morel 2013-10-25 14:47:20 +02:00
parent a622a5ad55
commit d06d6f7fd9
1 changed files with 3 additions and 1 deletions

View File

@ -662,7 +662,9 @@ class ManyToOneConverter(osv.AbstractModel):
def value_to_html(self, cr, uid, value, column, options=None, context=None):
# value may be a browse_null
if not value: return ''
return werkzeug.utils.escape(value.name_get()[0][1]).replace('\n', '<br>\n')
name_got = value._model.name_get(
cr, openerp.SUPERUSER_ID, value.id, context=context)[0][1]
return werkzeug.utils.escape(name_got).replace('\n', '<br>\n')
class HTMLConverter(osv.AbstractModel):
_name = 'ir.qweb.field.html'