From 24ef842a26a5eef975ceeb60d6b1a24b805b0b56 Mon Sep 17 00:00:00 2001 From: Diego Abad Date: Tue, 9 Jan 2018 18:52:00 +0100 Subject: [PATCH] TimeDelta converter take group as parameter instead record issue6946 review35831002 --- src/model.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/model.js b/src/model.js index ef27e76ba3..b9fe1d4955 100644 --- a/src/model.js +++ b/src/model.js @@ -1642,13 +1642,15 @@ Sao.field.TimeDelta = Sao.class_(Sao.field.Field, { _default: null, - converter: function(record) { - // TODO allow local context converter - return record.model.session.context[this.description.converter]; + converter: function(group) { + var ctx = jQuery.extend( + group.model.session.context, group.context()); + return ctx[this.description.converter]; }, set_client: function(record, value, force_change) { if (typeof(value) == 'string') { - value = Sao.common.timedelta.parse(value, this.converter(record)); + value = Sao.common.timedelta.parse( + value, this.converter(record.group)); } Sao.field.TimeDelta._super.set_client.call( this, record, value, force_change); @@ -1656,7 +1658,8 @@ get_client: function(record) { var value = Sao.field.TimeDelta._super.get_client.call( this, record); - return Sao.common.timedelta.format(value, this.converter(record)); + return Sao.common.timedelta.format( + value, this.converter(record.group)); } });