diff --git a/tryton/tryton/common/common.py b/tryton/tryton/common/common.py index e7464f31e25..9b0c3ca0123 100644 --- a/tryton/tryton/common/common.py +++ b/tryton/tryton/common/common.py @@ -1307,25 +1307,25 @@ def clean(context): return { k: v for k, v in context.items() if k != 'locale' and not k.endswith('.rec_name')} + from tryton.gui.main import Main def update(context): rpc.context_reset() try: rpc.CONTEXT.update(clean(context())) + Main().set_title(context.get('status_bar', '')) except RPCException: pass - if rpc._CLIENT_DATE: - rpc.CONTEXT['client_defined_date'] = rpc._CLIENT_DATE if callback: callback() context = RPCExecute( 'model', 'res.user', 'get_preferences', True, callback=update if callback else None) + if not callback: rpc.context_reset() rpc.CONTEXT.update(clean(context)) - if rpc._CLIENT_DATE: - rpc.CONTEXT['client_defined_date'] = rpc._CLIENT_DATE + Main().set_title(context.get('status_bar', '')) class Tooltips(object): diff --git a/tryton/tryton/config.py b/tryton/tryton/config.py index 078c1602191..188392b8bd7 100644 --- a/tryton/tryton/config.py +++ b/tryton/tryton/config.py @@ -88,7 +88,6 @@ def __init__(self): 'login.host': demo_server, 'login.db': demo_database, 'login.expanded': False, - 'login.date': False, 'tip.autostart': False, 'tip.position': 0, 'form.toolbar': True, diff --git a/tryton/tryton/gui/main.py b/tryton/tryton/gui/main.py index c32163fdde2..25ed045393c 100644 --- a/tryton/tryton/gui/main.py +++ b/tryton/tryton/gui/main.py @@ -450,8 +450,7 @@ def message(): self.global_search_entry.connect('changed', changed) self.global_search_entry.connect('activate', activate) - # ABD: Add possibility to choose the business date - def set_title(self, value='', date=''): + def set_title(self, value=''): if CONFIG['login.profile']: login_info = CONFIG['login.profile'] else: @@ -463,7 +462,7 @@ def set_title(self, value='', date=''): if value: titles.append(value) titles.append(CONFIG['client.title']) - self.header.set_title(' - '.join(titles) + ' (' + date + ')') + self.header.set_title(' - '.join(titles)) self.header.set_subtitle(login_info) try: style_context = self.header.get_style_context() @@ -548,7 +547,7 @@ def win_prev(self): page = self.notebook.get_current_page() self.notebook.set_current_page(page - 1) - def get_preferences(self, date=''): + def get_preferences(self): RPCContextReload() try: prefs = RPCExecute('model', 'res.user', 'get_preferences', False) @@ -581,8 +580,7 @@ def get_preferences(self, date=''): self.sig_win_menu(prefs=prefs) for action_id in prefs.get('actions', []): Action.execute(action_id, {}) - connexion_date = date.strftime('%d/%m/%Y') if date else '' - self.set_title(prefs.get('status_bar', ''), connexion_date) + self.set_title(prefs.get('status_bar', '')) # AKE: change bg color based on preferences color_bg = prefs.get('color_bg', None ) or os.environ.get('TRYTON_CLIENT_BG_COLOR', None) diff --git a/tryton/tryton/gui/window/dblogin.py b/tryton/tryton/gui/window/dblogin.py index ccdfe45d487..d2f02474148 100644 --- a/tryton/tryton/gui/window/dblogin.py +++ b/tryton/tryton/gui/window/dblogin.py @@ -496,17 +496,6 @@ def __init__(self): label_username.set_mnemonic_widget(self.entry_login) grid.attach(label_username, 0, 5, 1, 1) - # Date stuff - if CONFIG['login.date']: - self.label_date = Gtk.Label( - label=set_underline(_("Date:")), - use_underline=True, halign=Gtk.Align.END) - grid.attach(self.label_date, 0, 6, 1, 1) - self.entry_date = Date() - self.entry_date.props.format = '%d/%m/%Y' - self.entry_date.props.value = datetime.date.today() - grid.attach(self.entry_date, 1, 6, 2, 1) - # Profile information config_dir = get_config_dir() self.profile_cfg = os.path.join(config_dir, 'profiles.cfg') @@ -727,8 +716,6 @@ def run(self): CONFIG['login.service'] = authentication result = (hostname, port, database, authentication) - if CONFIG['login.date']: - CONFIG['login.date'] = self.entry_date.props.value self.dialog.destroy() self._window.destroy() return response == Gtk.ResponseType.OK or response > 0 diff --git a/tryton/tryton/rpc.py b/tryton/tryton/rpc.py index b6cb0dde412..cbf5667df20 100644 --- a/tryton/tryton/rpc.py +++ b/tryton/tryton/rpc.py @@ -23,7 +23,6 @@ _USERNAME = '' _HOST = '' _PORT = None -_CLIENT_DATE = None _DATABASE = '' CONTEXT = {} _VIEW_CACHE = {} @@ -116,14 +115,12 @@ def set_service_session(parameters): def login(parameters): from tryton import common global CONNECTION, _USER - global _CLIENT_DATE host = CONFIG['login.host'] hostname = common.get_hostname(host) port = common.get_port(host) database = CONFIG['login.db'] username = CONFIG['login.login'] language = CONFIG['client.lang'] - date = CONFIG['login.date'] parameters['device_cookie'] = device_cookie.get() connection = ServerProxy(hostname, port, database) logger.info('common.db.login(%s, %s, %s)', username, 'x' * 10, language) @@ -135,14 +132,12 @@ def login(parameters): CONNECTION.close() CONNECTION = ServerPool( hostname, port, database, session=session, cache=not CONFIG['dev']) - _CLIENT_DATE = date device_cookie.renew() bus.listen(CONNECTION) def logout(): global CONNECTION, _USER - global _CLIENT_DATE if CONNECTION is not None: try: logger.info('common.db.logout()') @@ -152,7 +147,6 @@ def logout(): pass CONNECTION.close() CONNECTION = None - _CLIENT_DATE = None _USER = None _VIEW_CACHE.clear() _TOOLBAR_CACHE.clear()