summaryrefslogtreecommitdiff
path: root/addons/web/static/src/xml
diff options
context:
space:
mode:
authorCedric Snauwaert <csn@openerp.com>2015-01-14 09:47:15 +0100
committerOlivier Dony <odo@openerp.com>2015-04-09 19:05:44 +0200
commit9d87d15db6dd40a5a0162fb126c725a2f0a40414 (patch)
tree304ee05b40ea8fa4d3c0c6ba962534c479320d41 /addons/web/static/src/xml
parent1ebd67355ae981d391fb4c2869027214554df136 (diff)
[ADD] new fields.Monetary + updated widgets
Enhance current widget="monetary" client-side feature and convert it to a first-class type of field, allowing proper server-side behavior. - fields: add field.Monetary, similar to fields.Float but supporting a `currency_field` attribute instead of the decimal_precision attribute. `currency_field` indicates the field holding the related currency on the same record. The symbol of that currency is used when displaying the field, and the rounding of the currency is applied instead of the usual decimal precision. - avoids application of a second decimal precision rounding, as was the case when the model field was a `fields.float`. - removes the need for adding explicit boilerplate to each view containing a monetary field, i.e.: widget="monetary" options="{'currency_field': 'currency_id'}" - res.currency: add new field decimal_places needed to round value at the correct decimal places - web: cache all currencies, rounding and symbols at webclient startup to speedup monetary fields - new widget monetary for list view + adapt widget monetary on form view Limitations: - if the currency_field is a related field, the server-side application of currency rounding will only work when the record already exists, not during creation (to be fixed) - this field is only supported in the new API
Diffstat (limited to 'addons/web/static/src/xml')
-rw-r--r--addons/web/static/src/xml/base.xml4
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml
index 4338624a67b..c3316d0b413 100644
--- a/addons/web/static/src/xml/base.xml
+++ b/addons/web/static/src/xml/base.xml
@@ -676,7 +676,7 @@
t-if="!field.attrs.modifiers.tree_invisible"
t-att-data-id="record.id"
t-att-style="color_for(record) + style "
- t-attf-class="#{class} #{rank} #{(fields[field.attrs.name].type === 'float') or (fields[field.attrs.name].type === 'integer') ? 'oe_number' : ''}">
+ t-attf-class="#{class} #{rank} #{(fields[field.attrs.name].type === 'float') or (fields[field.attrs.name].type === 'integer') or (fields[field.attrs.name].type === 'monetary')? 'oe_number' : ''}">
<span t-if="!field.attrs.modifiers.invisible" >
<t t-esc="render(record[field.attrs.name], fields[field.attrs.name])" />
@@ -756,7 +756,7 @@
<input t-if="!options.radio" type="checkbox" name="radiogroup" t-att-checked="checked"/>
</th>
<t t-foreach="columns" t-as="column">
- <t t-set="number" t-value="column.type === 'integer' or column.type == 'float'"/>
+ <t t-set="number" t-value="column.type === 'integer' or column.type == 'float' or column.type == 'monetary'"/>
<t t-set="modifiers" t-value="column.modifiers_for(asData)"/>
<td t-if="!column.meta and column.invisible !== '1'" t-att-title="column.help"
t-attf-class="oe_list_field_cell oe_list_field_#{column.widget or column.type} #{number ? 'oe_number' : ''} #{column.tag === 'button' ? 'oe-button' : ''} #{modifiers.readonly ? 'oe_readonly' : ''} #{modifiers.required ? 'oe_required' : ''}"