Fix fall-back date format
The date_format must come from screen context as fall-back. The date_format must be set on all actions context issue4892 review19351002
This commit is contained in:
1 parent
f95677d1ad
commit
ba39e36699
2 files changed
+7
-5
No files matched your search
@@ -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)
|
||||
|
||||
@@ -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
|
||||
Reference in new issue
Block a user