[MERGE] forward port branch 9.0 up to af64780a2d
This commit is contained in:
@@ -611,8 +611,8 @@ var CalendarView = View.extend({
|
||||
date_stop = m_start.toDate();
|
||||
}
|
||||
var r = {
|
||||
'start': moment(date_start).format('YYYY-MM-DD HH:mm:ss'),
|
||||
'end': moment(date_stop).format('YYYY-MM-DD HH:mm:ss'),
|
||||
'start': moment(date_start).toISOString(),
|
||||
'end': moment(date_stop).toISOString(),
|
||||
'title': the_title,
|
||||
'allDay': (this.fields[this.date_start].type == 'date' || (this.all_day && evt[this.all_day]) || false),
|
||||
'id': evt.id,
|
||||
|
||||
@@ -99,20 +99,28 @@ var getMatchedCSSRules = function (a) {
|
||||
if (style.display === 'block') {
|
||||
delete style.display;
|
||||
}
|
||||
if (style['margin-top']) {
|
||||
style.margin = (style['margin-top'] || 0) + ' ' + (style['margin-right'] || 0) + ' ' + (style['margin-bottom'] || 0) + ' ' + (style['margin-left'] || 0);
|
||||
delete style['margin-top'];
|
||||
delete style['margin-right'];
|
||||
delete style['margin-bottom'];
|
||||
delete style['margin-left'];
|
||||
}
|
||||
if (style['padding-top']) {
|
||||
style.padding = (style['padding-top'] || 0) + ' ' + (style['padding-right'] || 0) + ' ' + (style['padding-bottom'] || 0) + ' ' + (style['padding-left'] || 0);
|
||||
delete style['padding-top'];
|
||||
delete style['padding-right'];
|
||||
delete style['padding-bottom'];
|
||||
delete style['padding-left'];
|
||||
}
|
||||
|
||||
_.each(['margin', 'padding'], function(p) {
|
||||
if (style[p+'-top'] || style[p+'-right'] || style[p+'-bottom'] || style[p+'-left']) {
|
||||
if (style[p+'-top'] === style[p+'-right'] && style[p+'-top'] === style[p+'-bottom'] && style[p+'-top'] === style[p+'-left']) {
|
||||
// keep => property: [top/right/bottom/left value];
|
||||
style[p] = style[p+'-top'];
|
||||
}
|
||||
else {
|
||||
// keep => property: [top value] [right value] [bottom value] [left value];
|
||||
style[p] = (style[p+'-top'] || 0) + ' ' + (style[p+'-right'] || 0) + ' ' + (style[p+'-bottom'] || 0) + ' ' + (style[p+'-left'] || 0);
|
||||
if (style[p].indexOf('inherit') !== -1 || style[p].indexOf('initial') !== -1) {
|
||||
// keep => property-top: [top value]; property-right: [right value]; property-bottom: [bottom value]; property-left: [left value];
|
||||
delete style[p];
|
||||
return;
|
||||
}
|
||||
}
|
||||
delete style[p+'-top'];
|
||||
delete style[p+'-right'];
|
||||
delete style[p+'-bottom'];
|
||||
delete style[p+'-left'];
|
||||
}
|
||||
});
|
||||
|
||||
return a.className ? cache[a.tagName + "." +a.className] = style : style;
|
||||
};
|
||||
|
||||
@@ -38,11 +38,11 @@
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
background: white;">
|
||||
<option value="en_US" t-att-selected="'en_US' == widget.lang ? 'selected' : null">
|
||||
<t t-if="!widget.get('effective_readonly')">English (edit mode)</t>
|
||||
<t t-if="widget.get('effective_readonly')">English</t>
|
||||
</option>
|
||||
<t t-foreach="widget.languages" t-as="lang">
|
||||
<option value="en_US" t-att-selected="'en_US' == widget.lang ? 'selected' : null">
|
||||
<t t-if="!widget.get('effective_readonly')">English (edit mode)</t>
|
||||
<t t-if="widget.get('effective_readonly')">English</t>
|
||||
</option>
|
||||
<option t-att-value="lang.code" t-att-selected="lang.code == widget.lang ? 'selected' : null"><t t-esc="lang.name"/></option>
|
||||
</t>
|
||||
</select>
|
||||
|
||||
@@ -671,7 +671,7 @@ class IntegerConverter(models.AbstractModel):
|
||||
|
||||
@api.model
|
||||
def value_to_html(self, value, field, options=None):
|
||||
return self.user_lang().format('%d', value, grouping=True)
|
||||
return self.user_lang().format('%d', value, grouping=True).replace(r'-', u'\u2011')
|
||||
|
||||
|
||||
class FloatConverter(models.AbstractModel):
|
||||
@@ -688,7 +688,7 @@ class FloatConverter(models.AbstractModel):
|
||||
precision = self.precision(field, options=options)
|
||||
fmt = '%f' if precision is None else '%.{precision}f'
|
||||
lang = self.user_lang()
|
||||
formatted = lang.format(fmt.format(precision=precision), value, grouping=True)
|
||||
formatted = lang.format(fmt.format(precision=precision), value, grouping=True).replace(r'-', u'\u2011')
|
||||
|
||||
# %f does not strip trailing zeroes. %g does but its precision causes
|
||||
# it to switch to scientific notation starting at a million *and* to
|
||||
@@ -877,7 +877,7 @@ class MonetaryConverter(models.AbstractModel):
|
||||
|
||||
lang = self.user_lang()
|
||||
formatted_amount = lang.format(fmt, display_currency.round(from_amount),
|
||||
grouping=True, monetary=True).replace(r' ', u'\N{NO-BREAK SPACE}')
|
||||
grouping=True, monetary=True).replace(r' ', u'\N{NO-BREAK SPACE}').replace(r'-', u'\u2011')
|
||||
|
||||
pre = post = u''
|
||||
if display_currency.position == 'before':
|
||||
@@ -1047,7 +1047,7 @@ class QwebWidgetMonetary(models.AbstractModel):
|
||||
fmt = "%.{0}f".format(-precision if precision < 0 else 0)
|
||||
lang_code = qwebcontext.context.get('lang') or 'en_US'
|
||||
lang = qwebcontext.env['res.lang']._lang_get(lang_code)
|
||||
formatted_amount = lang.format(fmt, inner, grouping=True, monetary=True).replace(r' ', u'\N{NO-BREAK SPACE}')
|
||||
formatted_amount = lang.format(fmt, inner, grouping=True, monetary=True).replace(r' ', u'\N{NO-BREAK SPACE}').replace(r'-', u'\u2011')
|
||||
pre = post = u''
|
||||
if display.position == 'before':
|
||||
pre = u'{symbol}\N{NO-BREAK SPACE}'
|
||||
|
||||
@@ -67,8 +67,8 @@ class TestFloatExport(TestBasicExport):
|
||||
def test_float(self):
|
||||
converter = self.get_converter('float')
|
||||
|
||||
value = converter(42.0)
|
||||
self.assertEqual(value, "42.0")
|
||||
value = converter(-42.0)
|
||||
self.assertEqual(value, u"\u201142.0")
|
||||
|
||||
value = converter(42.0100)
|
||||
self.assertEqual(value, "42.01")
|
||||
@@ -120,7 +120,7 @@ class TestCurrencyExport(TestExport):
|
||||
|
||||
def test_currency_post(self):
|
||||
currency = self.create(self.Currency, name="Test", symbol=u"test")
|
||||
obj = self.create(self.Model, value=0.12)
|
||||
obj = self.create(self.Model, value=-0.12)
|
||||
|
||||
converted = self.convert(obj, dest=currency)
|
||||
|
||||
@@ -129,7 +129,7 @@ class TestCurrencyExport(TestExport):
|
||||
'<span data-oe-model="{obj._model._name}" data-oe-id="{obj.id}" '
|
||||
'data-oe-field="value" data-oe-type="monetary" '
|
||||
'data-oe-expression="obj.value">'
|
||||
'<span class="oe_currency_value">0.12</span>'
|
||||
u'<span class="oe_currency_value">\u20110.12</span>'
|
||||
u'\N{NO-BREAK SPACE}{symbol}</span>'.format(
|
||||
obj=obj,
|
||||
symbol=currency.symbol.encode('utf-8')
|
||||
|
||||
Reference in New Issue
Block a user