[FIX] views: correct distribute branding

bzr revid: chs@openerp.com-20130702181439-4ghn4ciz5efmzumk
This commit is contained in:
Christophe Simonis 2013-07-02 20:14:39 +02:00
parent 906da9b7ef
commit 0a5b3c9fd7
1 changed files with 2 additions and 5 deletions

View File

@ -744,9 +744,6 @@ class view(osv.osv):
return r['arch']
def distribute_branding(self, e, branding=None, xpath=None, count=None):
def has_qweb_attr(node):
return node.tag == 't' or any(a.startswith('t-') for a in node.attrib)
branding_copy = ['data-oe-model','data-oe-id','data-oe-field','data-oe-xpath']
branding_dist = {}
xpath = "%s/%s[%s]" % (xpath or '', e.tag, (count and count.get(e.tag)) or 1)
@ -756,12 +753,12 @@ class view(osv.osv):
if e.attrib.get('data-oe-model'):
# if a branded tag containg branded tag distribute to the childs
child_text = "".join([etree.tostring(x, encoding='utf-8') for x in e])
if re.search('(data-oe-model=|t-esc=|t-raw=|t-field=|t-call=)',child_text) or e.tag == "t":
if re.search('(data-oe-model=|t-esc=|t-raw=|t-field=|t-call=)',child_text) or e.tag == "t" or 't-raw' in e.attrib:
for i in branding_copy:
if e.attrib.get(i):
branding_dist[i] = e.attrib.get(i)
e.attrib.pop(i)
if not has_qweb_attr(e):
if 't-raw' not in e.attrib:
count = {}
for child in e:
count[child.tag] = count.get(child.tag, 0) + 1