diff --git a/tryton/action/main.py b/tryton/action/main.py index 7159c0f3c2..c5eb1715df 100644 --- a/tryton/action/main.py +++ b/tryton/action/main.py @@ -69,11 +69,6 @@ class Action(object): def _exec_action(action, data=None, context=None): if context is None: context = {} - else: - context = context.copy() - if 'date_format' not in context: - context['date_format'] = rpc.CONTEXT.get( - 'locale', {}).get('date', '%x') if data is None: data = {} else: diff --git a/tryton/gui/window/view_form/screen/screen.py b/tryton/gui/window/view_form/screen/screen.py index f7f7492f42..549de46f28 100644 --- a/tryton/gui/window/view_form/screen/screen.py +++ b/tryton/gui/window/view_form/screen/screen.py @@ -137,6 +137,8 @@ class Screen(SignalEvent): self.search_value = search_value self.fields_view_tree = {} self.order = self.default_order = order + self.__date_format = context.get( + 'date_format', rpc.CONTEXT.get('locale', {}).get('date', '%x')) self.view_to_load = [] self._domain_parser = {} self.pre_validate = False @@ -328,6 +330,10 @@ class Screen(SignalEvent): def context(self): return self.group.context + @property + def date_format(self): + return self.__date_format + def __get_group(self): return self.__group diff --git a/tryton/gui/window/view_form/view/form_gtk/calendar.py b/tryton/gui/window/view_form/view/form_gtk/calendar.py index 7c6af7be85..505522dea7 100644 --- a/tryton/gui/window/view_form/view/form_gtk/calendar.py +++ b/tryton/gui/window/view_form/view/form_gtk/calendar.py @@ -64,7 +64,7 @@ class Date(Widget): if field and record: format_ = field.date_format(record) else: - format_ = self.view.screen.context.get('date_format', '%x') + format_ = self.view.screen.date_format self.entry.props.format = format_ def display(self, record, field): @@ -142,7 +142,7 @@ class DateTime(Date): date_format = field.date_format(record) time_format = field.time_format(record) else: - date_format = self.view.screen.context.get('date_format', '%x') + date_format = self.view.screen.date_format time_format = '%X' self.entry.props.date_format = date_format self.entry.props.time_format = time_format