[FIX] base: fix dev mode for get_view_arch_from_file and inherits
Before this commits, dev mode crash in some case (see below) when you declare
a website_page without field name='arch'.
After this commit, we follow the view_id (limit: only into the same file)
Contactus works luckily before this commit, because compute field xml_id on
View return the first ir_model_data (order by name asc by default).
website.contactus
is BEFORE
website.contactus_page_ir_ui_view
-- while --
website.bs_debug_page_view
is AFTER
website.contactus_page_ir_ui_view
closes odoo/odoo#27234
This commit is contained in:
@@ -127,6 +127,13 @@ def get_view_arch_from_file(filename, xmlid):
|
||||
if node.tag in ('template', 'record'):
|
||||
if node.tag == 'record':
|
||||
field = node.find('field[@name="arch"]')
|
||||
if field is None:
|
||||
if node.find('field[@name="view_id"]') is not None:
|
||||
view_id = node.find('field[@name="view_id"]').attrib.get('ref')
|
||||
ref_id = '%s%s' % ('.' not in view_id and xmlid.split('.')[0] + '.' or '', view_id)
|
||||
return get_view_arch_from_file(filename, ref_id)
|
||||
else:
|
||||
return None
|
||||
_fix_multiple_roots(field)
|
||||
inner = u''.join([etree.tostring(child, encoding='unicode') for child in field.iterchildren()])
|
||||
return field.text + inner
|
||||
|
||||
Reference in New Issue
Block a user