diff --git a/sao/src/tab.js b/sao/src/tab.js index 48930b129d..678fb4322f 100644 --- a/sao/src/tab.js +++ b/sao/src/tab.js @@ -1419,10 +1419,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 e7e80cf6fd..32cae865f2 100644 --- a/tryton/tryton/gui/window/form.py +++ b/tryton/tryton/gui/window/form.py @@ -248,9 +248,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'),