diff --git a/tryton/gui/window/form.py b/tryton/gui/window/form.py index a517895c3e..9e3db06049 100644 --- a/tryton/gui/window/form.py +++ b/tryton/gui/window/form.py @@ -317,7 +317,7 @@ class Form(SignalEvent, TabContent): _('Records not removed.'), Gtk.MessageType.ERROR) else: self.message_info(_('Records removed.'), Gtk.MessageType.INFO) - self.screen.count_tab_domain() + self.screen.count_tab_domain(True) def sig_import(self, widget=None): WinImport(self.title.get_text(), self.model, self.screen.context) @@ -375,7 +375,7 @@ class Form(SignalEvent, TabContent): if self.screen.copy(): self.message_info(_('Working now on the duplicated record(s).'), Gtk.MessageType.INFO) - self.screen.count_tab_domain() + self.screen.count_tab_domain(True) def sig_save(self, widget=None): if widget: @@ -387,7 +387,7 @@ class Form(SignalEvent, TabContent): return if self.screen.save_current(): self.message_info(_('Record saved.'), Gtk.MessageType.INFO) - self.screen.count_tab_domain() + self.screen.count_tab_domain(True) return True else: self.message_info( diff --git a/tryton/gui/window/view_form/screen/screen.py b/tryton/gui/window/view_form/screen/screen.py index d08a7e5082..a2fe46133f 100644 --- a/tryton/gui/window/view_form/screen/screen.py +++ b/tryton/gui/window/view_form/screen/screen.py @@ -358,7 +358,7 @@ class Screen(SignalEvent): domain = ['AND', domain, tab_domain] return domain - def count_tab_domain(self): + def count_tab_domain(self, current=False): def set_tab_counter(count, idx): try: count = count() @@ -367,9 +367,10 @@ class Screen(SignalEvent): self.screen_container.set_tab_counter(count, idx) screen_domain = self.search_domain( self.screen_container.get_text(), with_tab=False) + index = self.screen_container.get_tab_index() for idx, (name, domain, count) in enumerate( self.screen_container.tab_domain): - if not count: + if not count or (current and idx != index): continue domain = ['AND', domain, screen_domain] set_tab_counter(lambda: None, idx) diff --git a/tryton/gui/window/view_form/view/screen_container.py b/tryton/gui/window/view_form/view/screen_container.py index 2ba59f85b2..e0293bcd9e 100644 --- a/tryton/gui/window/view_form/view/screen_container.py +++ b/tryton/gui/window/view_form/view/screen_container.py @@ -481,12 +481,15 @@ class ScreenContainer(object): def switch_page_after(self, notebook, page, page_num): self.do_search() notebook.grab_focus() - self.screen.count_tab_domain() + self.screen.count_tab_domain(True) + + def get_tab_index(self): + if not self.notebook: + return -1 + return self.notebook.get_current_page() def get_tab_domain(self): - if not self.notebook: - return [] - idx = self.notebook.get_current_page() + idx = self.get_tab_index() if idx < 0: return [] return self.tab_domain[idx][1]