Update attachment count when switching tabs for issue1317
(transplanted from dd5fc5447dc8351b228cbbec4b613d33cc1e3c19)
This commit is contained in:
1 parent
a470b0f425
commit
56e386a577
2 files changed
+13
-4
No files matched your search
+4
-1
@@ -1352,7 +1352,10 @@ class Main(object):
|
||||
if self.buttons[i]:
|
||||
self.buttons[i].set_sensitive(
|
||||
bool(view and (i in view.handlers)))
|
||||
self.buttons['but_attach'].set_stock_id('tryton-attachment')
|
||||
if hasattr(view, 'update_attachment_count'):
|
||||
view.update_attachment_count()
|
||||
else:
|
||||
self._attachment_count(view, 0)
|
||||
|
||||
def _attachment_count(self, widget, signal_data):
|
||||
label = _('Attachment(%d)') % signal_data
|
||||
|
||||
@@ -222,13 +222,19 @@ class Form(SignalEvent):
|
||||
if obj_id >= 0:
|
||||
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_info(_('No record selected!'))
|
||||
self.update_attachment_count(reload=True)
|
||||
return True
|
||||
|
||||
def update_attachment_count(self, reload=False):
|
||||
value = self.screen.current_model
|
||||
if value:
|
||||
attachment_count = value.get_attachment_count(reload=reload)
|
||||
else:
|
||||
attachment_count = 0
|
||||
self.signal('attachment-count', attachment_count)
|
||||
|
||||
def sig_switch(self, widget=None):
|
||||
if not self.modified_save():
|
||||
return
|
||||
|
||||
Reference in new issue
Block a user