diff --git a/tryton/gui/window/form.py b/tryton/gui/window/form.py index f20c307de4..528148e0d8 100644 --- a/tryton/gui/window/form.py +++ b/tryton/gui/window/form.py @@ -171,6 +171,9 @@ class Form(SignalEvent): if obj_id: win = Attachment(self.model, obj_id, self.window) win.run() + value = self.screen.current_model + attachment_count = value.get_attachment_count(reload=True) + self.signal('attachment-count', attachment_count) else: self.message_state(_('No resource selected!')) return True diff --git a/tryton/gui/window/view_form/model/record.py b/tryton/gui/window/view_form/model/record.py index a42c22972b..356bb838f5 100644 --- a/tryton/gui/window/view_form/model/record.py +++ b/tryton/gui/window/view_form/model/record.py @@ -239,10 +239,10 @@ class ModelRecord(SignalEvent): self.set_default(ir_default.get_default(self.resource, field_name + '=' + str(value), ctx)) - def get_attachment_count(self): + def get_attachment_count(self, reload=False): if not self.id: return 0 - if self.attachment_count < 0: + if self.attachment_count < 0 or reload: ir_attachment = RPCProxy('ir.attachment') self.attachment_count = ir_attachment.search_count([ ('res_model', '=', self.resource),