def sig_reload(self, test_modified=True): if not hasattr(self, 'screen'): return False if test_modified and self.screen.is_modified(): res = common.sur_3b(_('This record has been modified\n' \ 'do you want to save it ?')) if res == 'ok': self.sig_save() elif res == 'ko': pass else: return False if self.screen.current_view.view_type == 'form': self.screen.cancel_current() self.screen.display() else: id = self.screen.id_get() self.screen.search_filter() for model in self.screen.models: if model.id == id: self.screen.current_model = model self.screen.display() break self.message_state('') return True
def modified_save(self, reload=True): if self.screen.is_modified(): value = common.sur_3b(_('This record has been modified\ndo you want to save it ?')) if value == 'ok': return self.sig_save() elif value == 'ko': if reload: self.sig_reload(test_modified=False) return True else: return False return True