diff --git a/sao/src/screen.js b/sao/src/screen.js index f85f3bea68..0e0dbfa9de 100644 --- a/sao/src/screen.js +++ b/sao/src/screen.js @@ -925,6 +925,9 @@ get number_of_views() { return this.views.length + this.view_to_load.length; }, + get view_index() { + return this.views.indexOf(this.current_view); + }, switch_view: function( view_type=null, view_id=null, creatable=null, display=true) { if (view_id !== null) { @@ -1001,9 +1004,8 @@ return this.add_view_id(view_id, view_type) .then(set_current_view); } else { - var i = this.views.indexOf(this.current_view); this.current_view = this.views[ - (i + 1) % this.views.length]; + (this.view_index + 1) % this.views.length]; } if (found()) { break; diff --git a/sao/src/tab.js b/sao/src/tab.js index 13c2cfc844..639dfaeec9 100644 --- a/sao/src/tab.js +++ b/sao/src/tab.js @@ -784,7 +784,9 @@ return false; } var compare = Sao.common.compare; - return ((this.screen.model_name === attributes.model) && + return ( + (this.screen.view_index === 0) && + (this.screen.model_name === attributes.model) && (this.attributes.res_id === attributes.res_id) && (compare( this.attributes.domain || [], attributes.domain || [])) && diff --git a/tryton/tryton/gui/window/form.py b/tryton/tryton/gui/window/form.py index 8ae27a00dc..b1e53aa0b2 100644 --- a/tryton/tryton/gui/window/form.py +++ b/tryton/tryton/gui/window/form.py @@ -105,7 +105,9 @@ class Form(TabContent): def compare(self, model, attributes): if not attributes: return False - return (self.model == model + return ( + self.screen.view_index == 0 + and self.model == model and self.res_id == attributes.get('res_id') and self.attributes.get('domain') == attributes.get('domain') and self.attributes.get('view_ids') == attributes.get('view_ids') diff --git a/tryton/tryton/gui/window/view_form/screen/screen.py b/tryton/tryton/gui/window/view_form/screen/screen.py index 72fb8665b4..40d76c630a 100644 --- a/tryton/tryton/gui/window/view_form/screen/screen.py +++ b/tryton/tryton/gui/window/view_form/screen/screen.py @@ -538,6 +538,10 @@ class Screen: def number_of_views(self): return len(self.views) + len(self.view_to_load) + @property + def view_index(self): + return self.__current_view + def switch_view( self, view_type=None, view_id=None, creatable=None, display=True): if view_id is not None: