diff --git a/sao/src/tab.js b/sao/src/tab.js index 386eb6cc79..e36c08a206 100644 --- a/sao/src/tab.js +++ b/sao/src/tab.js @@ -1324,10 +1324,9 @@ return; } var record = this.screen.current_record; - if (!record) { - return; - } - var resource = record.model.name + ',' + record.id; + var resource = ( + record ? record.model.name + ',' + record.id : + this.screen.model_name + ',-1'); var domain = [ ['resource', '=', resource], ['type', '=', 'data'], diff --git a/tryton/tryton/gui/window/form.py b/tryton/tryton/gui/window/form.py index 77f2afdf53..5ed7254f71 100644 --- a/tryton/tryton/gui/window/form.py +++ b/tryton/tryton/gui/window/form.py @@ -233,9 +233,9 @@ class Form(TabContent): if not self.attachment_screen: return record = self.screen.current_record - if not record: - return - resource = '%s,%s' % (record.model_name, record.id) + resource = '%s,%s' % ( + (record.model_name, record.id) if record + else (self.screen.model_name, -1)) domain = [ ('resource', '=', resource), ('type', '=', 'data'),