Remove relation_field from the dialog view of the one2many
This commit is contained in:
1 parent
b8fd0f8ba8
commit
828e9209ce
2 files changed
+9
-1
No files matched your search
@@ -219,7 +219,8 @@ class Screen(SignalEvent):
|
||||
def add_view_custom(self, arch, fields, display=False, toolbar=None):
|
||||
return self.add_view(arch, fields, display, True, toolbar=toolbar)
|
||||
|
||||
def add_view_id(self, view_id, view_type, display=False, context=None):
|
||||
def add_view_id(self, view_id, view_type, display=False,
|
||||
exclude_field=None, context=None):
|
||||
if view_type in self.views_preload:
|
||||
return self.add_view(self.views_preload[view_type]['arch'],
|
||||
self.views_preload[view_type]['fields'], display,
|
||||
@@ -232,6 +233,9 @@ class Screen(SignalEvent):
|
||||
except Exception, exception:
|
||||
rpc.process_exception(exception, self.window)
|
||||
raise
|
||||
if exclude_field:
|
||||
if exclude_field in view['fields']:
|
||||
del view['fields'][exclude_field]
|
||||
return self.add_view(view['arch'], view['fields'], display,
|
||||
toolbar=view.get('toolbar', False), context=context)
|
||||
|
||||
|
||||
@@ -67,10 +67,14 @@ class Dialog(object):
|
||||
if ('views' in attrs) and ('form' in attrs['views']):
|
||||
arch = attrs['views']['form']['arch']
|
||||
fields = attrs['views']['form']['fields']
|
||||
if attrs.get('relation_field', False) \
|
||||
and attrs['relation_field'] in fields:
|
||||
del fields[attrs['relation_field']]
|
||||
self.screen.add_view(arch, fields, display=True,
|
||||
context=default_get_ctx)
|
||||
else:
|
||||
self.screen.add_view_id(False, 'form', display=True,
|
||||
exclude_field=attrs.get('relation_field', None),
|
||||
context=default_get_ctx)
|
||||
viewport.add(self.screen.widget)
|
||||
width, height = self.screen.screen_container.size_get()
|
||||
|
||||
Reference in new issue
Block a user