diff --git a/tryton/action/main.py b/tryton/action/main.py index 34b99d40d5..16c6d252d1 100644 --- a/tryton/action/main.py +++ b/tryton/action/main.py @@ -84,6 +84,11 @@ 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: @@ -114,9 +119,6 @@ class Action(object): ctx.update(action_ctx) ctx.update(context) action_ctx.update(context) - if 'date_format' not in action_ctx: - action_ctx['date_format'] = rpc.CONTEXT.get( - 'locale', {}).get('date', '%x') ctx['context'] = ctx decoder = PYSONDecoder(ctx) 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 70f15b7327..19a0398b17 100644 --- a/tryton/gui/window/view_form/view/form_gtk/calendar.py +++ b/tryton/gui/window/view_form/view/form_gtk/calendar.py @@ -59,7 +59,7 @@ class Date(Widget): if field and record: format_ = field.date_format(record) else: - format_ = '%x' + format_ = self.view.screen.context.get('date_format', '%x') self.entry.props.format = format_ def display(self, record, field): @@ -126,7 +126,7 @@ class DateTime(Date): date_format = field.date_format(record) time_format = field.time_format(record) else: - date_format = '%x' + date_format = self.view.screen.context.get('date_format', '%x') time_format = '%X' self.entry.props.date_format = date_format self.entry.props.time_format = time_format