Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions tryton/tryton/common/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
1 change: 0 additions & 1 deletion tryton/tryton/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 4 additions & 6 deletions tryton/tryton/gui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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()
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
13 changes: 0 additions & 13 deletions tryton/tryton/gui/window/dblogin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions tryton/tryton/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
_USERNAME = ''
_HOST = ''
_PORT = None
_CLIENT_DATE = None
_DATABASE = ''
CONTEXT = {}
_VIEW_CACHE = {}
Expand Down Expand Up @@ -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)
Expand All @@ -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()')
Expand All @@ -152,7 +147,6 @@ def logout():
pass
CONNECTION.close()
CONNECTION = None
_CLIENT_DATE = None
_USER = None
_VIEW_CACHE.clear()
_TOOLBAR_CACHE.clear()
Expand Down