Add inherited name or type to the view record name

This reduces the ambiguity of using only the model.

issue9424
review299961012
This commit is contained in:
Cédric Krier committed 2020-06-24 23:02:24 +02:00
1 parent 066b8f8491
commit bca6813e64
1 file changed
+6
+6
View File
@@ -52,6 +52,7 @@ class View(ModelSQL, ModelView):
('type', '!=', None)),
],
depends=['inherit'])
type_string = type.translated('type')
data = fields.Text('Data')
name = fields.Char('Name', states={
'invisible': ~(Eval('module') & Eval('name')),
@@ -91,6 +92,11 @@ class View(ModelSQL, ModelView):
def default_module():
return Transaction().context.get('module') or ''
def get_rec_name(self, name):
return '%s (%s)' % (
self.model,
self.inherit.rec_name if self.inherit else self.type_string)
@classmethod
@ModelView.button_action('ir.act_view_show')
def show(cls, views):