diff options
| author | Christophe Matthieu <chm@odoo.com> | 2016-07-05 19:12:01 +0200 |
|---|---|---|
| committer | Christophe Matthieu <chm@odoo.com> | 2016-07-05 19:12:01 +0200 |
| commit | 8517eb3d7b7b29f650a91a05ba91b0eb93f03fcf (patch) | |
| tree | 2580c502d1a2fef8ce11fd259e8c0588c6db4f2f | |
| parent | efed10bd9aadf487f9f1317abc6b89063758477d (diff) | |
| parent | 253a0f63110e91f7b690dc3b0111309001ffa051 (diff) | |
[IMP] qweb: t-esc, t-raw and t-field 'ir.qweb.field' models with t-options
Remove 'field' from 'value_to_html' method attributes
't-esc' escape the result of the widget.
(Added 'remove_span' as option for monetary widget)
E.g.: <t t-esc="32" t-options='t-options='{"widget": "monetary", "display_currency": website.currency_id, "remove_span": True}'>
result: $ 365.00
Use t-options instead of t-field-options
Add backward compatibility
Remove 'values' attribute from record_to_html
Remove 'field' attribute from value_to_html
+ few fix for 'ir.qweb.field' and cache
68 files changed, 765 insertions, 683 deletions
diff --git a/addons/account/views/report_agedpartnerbalance.xml b/addons/account/views/report_agedpartnerbalance.xml index 560c711be9b..8681931febb 100644 --- a/addons/account/views/report_agedpartnerbalance.xml +++ b/addons/account/views/report_agedpartnerbalance.xml @@ -50,13 +50,13 @@ </tr> <tr t-if="get_partner_lines"> <th>Account Total</th> - <th class="text-right"><span t-esc="format(get_direction[6], 'monetary', res_company.currency_id)"/></th> - <th class="text-right"><span t-esc="format(get_direction[4], 'monetary', res_company.currency_id)"/></th> - <th class="text-right"><span t-esc="format(get_direction[3], 'monetary', res_company.currency_id)"/></th> - <th class="text-right"><span t-esc="format(get_direction[2], 'monetary', res_company.currency_id)"/></th> - <th class="text-right"><span t-esc="format(get_direction[1], 'monetary', res_company.currency_id)"/></th> - <th class="text-right"><span t-esc="format(get_direction[0], 'monetary', res_company.currency_id)"/></th> - <th class="text-right"><span t-esc="format(get_direction[5], 'monetary', res_company.currency_id)"/></th> + <th class="text-right"><span t-esc="get_direction[6]" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></th> + <th class="text-right"><span t-esc="get_direction[4]" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></th> + <th class="text-right"><span t-esc="get_direction[3]" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></th> + <th class="text-right"><span t-esc="get_direction[2]" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></th> + <th class="text-right"><span t-esc="get_direction[1]" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></th> + <th class="text-right"><span t-esc="get_direction[0]" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></th> + <th class="text-right"><span t-esc="get_direction[5]" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></th> </tr> </thead> <tbody> @@ -65,25 +65,25 @@ <span t-esc="partner['name']"/> </td> <td class="text-right"> - <span t-esc="format(partner['direction'], 'monetary', res_company.currency_id)"/> + <span t-esc="partner['direction']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(partner['4'], 'monetary', res_company.currency_id)"/> + <span t-esc="partner['4']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(partner['3'], 'monetary', res_company.currency_id)"/> + <span t-esc="partner['3']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(partner['2'], 'monetary', res_company.currency_id)"/> + <span t-esc="partner['2']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(partner['1'], 'monetary', res_company.currency_id)"/> + <span t-esc="partner['1']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(partner['0'], 'monetary', res_company.currency_id)"/> + <span t-esc="partner['0']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(partner['total'], 'monetary', res_company.currency_id)"/> + <span t-esc="partner['total']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> </tbody> diff --git a/addons/account/views/report_financial.xml b/addons/account/views/report_financial.xml index 692e0bc2676..8b968fda675 100644 --- a/addons/account/views/report_financial.xml +++ b/addons/account/views/report_financial.xml @@ -43,13 +43,13 @@ <span t-att-style="style" t-esc="a.get('name')"/> </td> <td class="text-right" style="white-space: text-nowrap;"> - <span t-att-style="style" t-esc="format(a.get('debit'), 'monetary', res_company.currency_id)"/> + <span t-att-style="style" t-esc="a.get('debit')" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right" style="white-space: text-nowrap;"> - <span t-att-style="style" t-esc="format(a.get('credit'), 'monetary', res_company.currency_id)"/> + <span t-att-style="style" t-esc="a.get('credit')" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right" style="white-space: text-nowrap;"> - <span t-att-style="style" t-esc="format(a.get('balance'), 'monetary', res_company.currency_id)"/> + <span t-att-style="style" t-esc="a.get('balance')" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </t> </tr> @@ -73,7 +73,7 @@ <span style="color: white;" t-esc="'..' * a.get('level', 0)"/> <span t-att-style="style" t-esc="a.get('name')"/> </td> - <td class="text-right"><span t-att-style="style" t-esc="format(a.get('balance'), 'monetary', res_company.currency_id)"/></td> + <td class="text-right"><span t-att-style="style" t-esc="a.get('balance')" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> </t> </tr> </tbody> @@ -96,7 +96,7 @@ <span style="color: white;" t-esc="'..'"/> <span t-att-style="style" t-esc="a.get('name')"/> </td> - <td class="text-right"><span t-att-style="style" t-esc="format(a.get('balance'), 'monetary', res_company.currency_id)"/></td> + <td class="text-right"><span t-att-style="style" t-esc="a.get('balance')" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> <td class="text-right"><span t-att-style="style" t-esc="a.get('balance_cmp')"/></td> </t> </tr> diff --git a/addons/account/views/report_generalledger.xml b/addons/account/views/report_generalledger.xml index 7ef9fef28dc..e06e8ddda59 100644 --- a/addons/account/views/report_generalledger.xml +++ b/addons/account/views/report_generalledger.xml @@ -66,13 +66,13 @@ <span t-esc="account['name']"/> </td> <td class="text-right"> - <span t-esc="format(account['debit'], 'monetary', res_company.currency_id)"/> + <span t-esc="account['debit']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(account['credit'], 'monetary', res_company.currency_id)"/> + <span t-esc="account['credit']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(account['balance'], 'monetary', res_company.currency_id)"/> + <span t-esc="account['balance']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td groups="base.group_multi_currency"/> </tr> @@ -84,13 +84,13 @@ <td><span t-esc="line['move_name']"/></td> <td><span t-esc="line['lname']"/></td> <td class="text-right"> - <span t-esc="format(line['debit'], 'monetary', res_company.currency_id)"/> + <span t-esc="line['debit']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(line['credit'], 'monetary', res_company.currency_id)"/> + <span t-esc="line['credit']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(line['balance'], 'monetary', res_company.currency_id)"/> + <span t-esc="line['balance']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right" groups="base.group_multi_currency"> <span t-esc="line['amount_currency'] if line['amount_currency'] > 0.00 else ''"/> diff --git a/addons/account/views/report_invoice.xml b/addons/account/views/report_invoice.xml index 9c7365738cb..30ed8c32853 100644 --- a/addons/account/views/report_invoice.xml +++ b/addons/account/views/report_invoice.xml @@ -8,7 +8,7 @@ <div class="row"> <div name="invoice_address" class="col-xs-5 col-xs-offset-7"> <address t-field="o.partner_id" - t-field-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' /> + t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' /> <span t-if="o.partner_id.vat">TIN: <span t-field="o.partner_id.vat"/></span> </div> </div> @@ -85,7 +85,7 @@ </td> <td class="text-right"> <span t-field="l.price_subtotal" - t-field-options='{"widget": "monetary", "display_currency": o.currency_id}'/> + t-options='{"widget": "monetary", "display_currency": o.currency_id}'/> </td> </tr> </tbody> @@ -97,7 +97,7 @@ <tr class="border-black"> <td><strong>Subtotal</strong></td> <td class="text-right"> - <span t-field="o.amount_untaxed" t-field-options='{"widget": "monetary", "display_currency": o.currency_id}'/> + <span t-field="o.amount_untaxed" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/> </td> </tr> <t t-foreach="o._get_tax_amount_by_group()" t-as="amount_by_group"> @@ -111,7 +111,7 @@ <tr class="border-black"> <td><strong>Total</strong></td> <td class="text-right"> - <span t-field="o.amount_total" t-field-options='{"widget": "monetary", "display_currency": o.currency_id}'/> + <span t-field="o.amount_total" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/> </td> </tr> </table> diff --git a/addons/account/views/report_journal.xml b/addons/account/views/report_journal.xml index 396c43b8474..f94e20fa3b0 100644 --- a/addons/account/views/report_journal.xml +++ b/addons/account/views/report_journal.xml @@ -51,10 +51,10 @@ <td><span t-field="aml.account_id.code"/></td> <td><span t-esc="aml.sudo().partner_id and aml.sudo().partner_id.name[:23] or ''"/></td> <td><span t-esc="aml.name[:35]"/></td> - <td><span t-esc="format(aml.debit, 'monetary', res_company.currency_id)"/></td> - <td><span t-esc="format(aml.credit, 'monetary', res_company.currency_id)"/></td> + <td><span t-esc="aml.debit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> + <td><span t-esc="aml.credit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> <td t-if="data['form']['amount_currency'] and aml.amount_currency"> - <span t-esc="format(aml.amount_currency, 'monetary', aml.currency_id)"/> + <span t-esc="aml.amount_currency" t-options="{'widget': 'monetary', 'display_currency': aml.currency_id}"/> </td> </tr> </tbody> @@ -65,8 +65,8 @@ <table class="table table-condensed"> <tr> <td><strong>Total</strong></td> - <td><span t-esc="format(sum_debit(data, o), 'monetary', res_company.currency_id)"/></td> - <td><span t-esc="format(sum_credit(data, o), 'monetary', res_company.currency_id)"/></td> + <td><span t-esc="sum_debit(data, o)" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> + <td><span t-esc="sum_credit(data, o)" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> </tr> </table> </div> @@ -87,8 +87,8 @@ <t t-set="taxes" t-value="get_taxes(data, o)"/> <tr t-foreach="taxes" t-as="tax"> <td><span t-esc="tax.name"/></td> - <td><span t-esc="format(taxes[tax]['base_amount'], 'monetary', res_company.currency_id)"/></td> - <td><span t-esc="format(taxes[tax]['tax_amount'], 'monetary', res_company.currency_id)"/></td> + <td><span t-esc="taxes[tax]['base_amount']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> + <td><span t-esc="taxes[tax]['tax_amount']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> </tr> </tbody> </table> diff --git a/addons/account/views/report_overdue.xml b/addons/account/views/report_overdue.xml index 79e0e3cf025..3b7d3808100 100644 --- a/addons/account/views/report_overdue.xml +++ b/addons/account/views/report_overdue.xml @@ -44,10 +44,10 @@ <span t-esc="line['ref']"/> </td> <td class="text-right"> - <span t-esc="format(line['debit'], 'monetary', currency)"/> + <span t-esc="line['debit']" t-options="{'widget': 'monetary', 'display_currency': currency}"/> </td> <td class="text-right"> - <span t-esc="format(line['credit'], 'monetary', currency)"/> + <span t-esc="line['credit']" t-options="{'widget': 'monetary', 'display_currency': currency}"/> </td> <td class="text-center"> <span t-if="line['blocked']">x</span> @@ -56,16 +56,16 @@ <tr> <td colspan="3"></td> <td><strong>Subtotal :</strong></td> - <td class="text-right"><span t-esc="format(Totals[o.id][currency]['due'], 'monetary', currency)"/></td> - <td class="text-right"><span t-esc="format(Totals[o.id][currency]['paid'], 'monetary', currency)"/></td> - <td class="text-right"><span t-esc="format(Totals[o.id][currency]['mat'], 'monetary', currency)"/></td> + <td class="text-right"><span t-esc="Totals[o.id][currency]['due']" t-options="{'widget': 'monetary', 'display_currency': currency}"/></td> + <td class="text-right"><span t-esc="Totals[o.id][currency]['paid']" t-options="{'widget': 'monetary', 'display_currency': currency}"/></td> + <td class="text-right"><span t-esc="Totals[o.id][currency]['mat']" t-options="{'widget': 'monetary', 'display_currency': currency}"/></td> <td></td> </tr> <tr> <td colspan="3"></td> <td><strong>Balance :</strong></td> <td class="text-right"> - <span t-esc="format(Totals[o.id][currency]['due'] - Totals[o.id][currency]['paid'], 'monetary', currency)"/> + <span t-esc="Totals[o.id][currency]['due'] - Totals[o.id][currency]['paid']" t-options="{'widget': 'monetary', 'display_currency': currency}"/> </td> </tr> </table> diff --git a/addons/account/views/report_partnerledger.xml b/addons/account/views/report_partnerledger.xml index 94ac9b0d4b6..0259e5167e8 100644 --- a/addons/account/views/report_partnerledger.xml +++ b/addons/account/views/report_partnerledger.xml @@ -46,13 +46,13 @@ - <strong t-esc="o.name"/> </td> <td class="text-right"> - <strong t-esc="format(sum_partner(data, o, 'debit'), 'monetary', res_company.currency_id)"/> + <strong t-esc="sum_partner(data, o, 'debit')" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <strong t-esc="format(sum_partner(data, o, 'credit'), 'monetary', res_company.currency_id)"/> + <strong t-esc="sum_partner(data, o, 'credit')" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <strong t-esc="format(sum_partner(data, o, 'debit - credit'), 'monetary', res_company.currency_id)"/> + <strong t-esc="sum_partner(data, o, 'debit - credit')" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr t-foreach="lines(data, o)" t-as="line"> @@ -69,16 +69,16 @@ <span t-esc="line['displayed_name']"/> </td> <td class="text-right"> - <span t-esc="format(line['debit'], 'monetary', res_company.currency_id)"/> + <span t-esc="line['debit']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(line['credit'], 'monetary', res_company.currency_id)"/> + <span t-esc="line['credit']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(line['progress'], 'monetary', res_company.currency_id)"/> + <span t-esc="line['progress']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td t-if="amount_currency"> - <span t-esc="format(line['amount_currency'], 'monetary', line['currency_id'])"/> + <span t-esc="line['amount_currency']" t-options="{'widget': 'monetary', 'display_currency': line['currency_id']}"/> </td> </tr> </tbody> diff --git a/addons/account/views/report_trialbalance.xml b/addons/account/views/report_trialbalance.xml index 7ada5bc393b..750c9f93698 100644 --- a/addons/account/views/report_trialbalance.xml +++ b/addons/account/views/report_trialbalance.xml @@ -50,13 +50,13 @@ <span t-att-style="style" t-esc="account['name']"/> </td> <td class="text-right"> - <span t-att-style="style" t-esc="format(account['debit'], 'monetary', res_company.currency_id)"/> + <span t-att-style="style" t-esc="account['debit']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-att-style="style" t-esc="format(account['credit'], 'monetary', res_company.currency_id)"/> + <span t-att-style="style" t-esc="account['credit']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-att-style="style" t-esc="format(account['balance'], 'monetary', res_company.currency_id)"/> + <span t-att-style="style" t-esc="account['balance']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> </tbody> diff --git a/addons/account/views/web_planner_data.xml b/addons/account/views/web_planner_data.xml index 8a7fec1d501..7f0af5daa35 100644 --- a/addons/account/views/web_planner_data.xml +++ b/addons/account/views/web_planner_data.xml @@ -59,7 +59,7 @@ <th>Address</th> <td t-att-class="(not company_id.partner_id.street or not company_id.partner_id.zip) and 'danger'"> <span t-field="company_id.partner_id" - t-field-options='{"widget": "contact", "fields": ["address"], "no_marker": True}'/> + t-options='{"widget": "contact", "fields": ["address"], "no_marker": True}'/> </td> <td> <a class="fa fa-arrow-right" t-attf-href="#{prepare_backend_url('base.action_res_company_form', 'form')}&id=#{company_id.id}"> diff --git a/addons/decimal_precision/tests/test_qweb_float.py b/addons/decimal_precision/tests/test_qweb_float.py index c481dba2fd9..7011b0f9e75 100644 --- a/addons/decimal_precision/tests/test_qweb_float.py +++ b/addons/decimal_precision/tests/test_qweb_float.py @@ -7,11 +7,14 @@ class TestFloatExport(common.TransactionCase): self.Model = self.registry('decimal.precision.test') def get_converter(self, name): - converter = self.registry('ir.qweb.field.float') - field = self.Model._fields[name] + float_obj = self.registry('ir.qweb.field.float') + _, precision = self.Model._fields[name].digits or (None, None) - return lambda value, options=None: converter.value_to_html( - self.cr, self.uid, value, field, options=options, context=None) + def converter(value, options=None): + record = self.Model.new(self.cr, self.uid, {name: value}, context=None) + return float_obj.record_to_html( + self.cr, self.uid, record, name, options or {}, context=None) + return converter def test_basic_float(self): converter = self.get_converter('float') @@ -30,13 +33,13 @@ class TestFloatExport(common.TransactionCase): converter(42.12345), "42.12") - converter = self.get_converter('float_4') + converter = self.get_converter('float') # don't use float_4 because the field value 42.12345 is already orm converted to 42.1235 self.assertEqual( - converter(42.0), + converter(42.0, {'precision': 4}), '42.0000') self.assertEqual( - converter(42.12345), - '42.1234') + converter(42.12345, {'precision': 4}), + '42.1235') def test_precision_domain(self): DP = self.registry('decimal.precision') @@ -57,7 +60,7 @@ class TestFloatExport(common.TransactionCase): converter(42.0, {'decimal_precision': 'B'}), '42.000000') - converter = self.get_converter('float_4') + converter = self.get_converter('float') # don't use float_4 because the field value 42.12345 is orm converted to 42.1235 self.assertEqual( converter(42.12345, {'decimal_precision': 'A'}), '42.12') diff --git a/addons/event/report/event_event_templates.xml b/addons/event/report/event_event_templates.xml index efb46e5ce6f..3720744ce48 100644 --- a/addons/event/report/event_event_templates.xml +++ b/addons/event/report/event_event_templates.xml @@ -18,7 +18,7 @@ <img t-att-src="'data:image/png;base64,%s' % o.event_id.organizer_id.company_id.logo_web" style="max-height:1cm; max-width:4cm;"/> </span> <h5 t-field="o.event_id.name"/> - <h5>( <i class="fa fa-clock-o"></i> <span itemprop="startDate" t-field="o.event_id.date_begin" t-field-options='{"hide_seconds": True}'> </span> <i>to</i> <span itemprop="endDate" t-field="o.event_id.date_end" t-field-options='{"hide_seconds": True}'> </span> )</h5> + <h5>( <i class="fa fa-clock-o"></i> <span itemprop="startDate" t-field="o.event_id.date_begin" t-options='{"hide_seconds": True}'> </span> <i>to</i> <span itemprop="endDate" t-field="o.event_id.date_end" t-options='{"hide_seconds": True}'> </span> )</h5> </div> <div class="row"> <div class="col-xs-12 text-center" id="o_event_name"> @@ -69,7 +69,7 @@ </div> </span> <h4 t-field="event.name"/> - <h5>( <i class="fa fa-clock-o"></i> <span itemprop="startDate" t-field="event.date_begin" t-field-options='{"hide_seconds": True}'> </span> <i>to</i> <span itemprop="endDate" t-field="event.date_end" t-field-options='{"hide_seconds": True}'> </span> )</h5> + <h5>( <i class="fa fa-clock-o"></i> <span itemprop="startDate" t-field="event.date_begin" t-options='{"hide_seconds": True}'> </span> <i>to</i> <span itemprop="endDate" t-field="event.date_end" t-options='{"hide_seconds": True}'> </span> )</h5> </div> </div> <div class="row" t-ignore="true"> diff --git a/addons/hr_expense/report/report_expense_sheet.xml b/addons/hr_expense/report/report_expense_sheet.xml index c00f70c23fc..da7e81ad537 100644 --- a/addons/hr_expense/report/report_expense_sheet.xml +++ b/addons/hr_expense/report/report_expense_sheet.xml @@ -64,7 +64,7 @@ </td> <td class="text-right"> <span t-field="line.total_amount" - t-field-options='{"widget": "monetary", "display_currency": o.currency_id}'/> + t-options='{"widget": "monetary", "display_currency": o.currency_id}'/> </td> </tr> </tbody> @@ -77,7 +77,7 @@ <td><strong>Total</strong></td> <td class="text-right"> <span t-field="o.total_amount" - t-field-options='{"widget": "monetary", "display_currency": o.currency_id}'/> + t-options='{"widget": "monetary", "display_currency": o.currency_id}'/> </td> </tr> </table> diff --git a/addons/hr_expense/views/report_expense.xml b/addons/hr_expense/views/report_expense.xml index 90c92c05792..f64e5b23714 100644 --- a/addons/hr_expense/views/report_expense.xml +++ b/addons/hr_expense/views/report_expense.xml @@ -55,7 +55,7 @@ </td> <td> <span t-field="line.unit_amount" - t-field-options='{"widget": "monetary", "display_currency": line.currency_id}'/> + t-options='{"widget": "monetary", "display_currency": line.currency_id}'/> </td> <td class="text-center"> <span t-field="line.quantity"/> @@ -75,7 +75,7 @@ </td> <td class="text-right"> <span t-field="line.total_amount" - t-field-options='{"widget": "monetary", "display_currency": line.currency_id}'/> + t-options='{"widget": "monetary", "display_currency": line.currency_id}'/> </td> </tr> </t> diff --git a/addons/hr_payroll/views/report_payslip.xml b/addons/hr_payroll/views/report_payslip.xml index 43b329f4107..b0809a6716f 100644 --- a/addons/hr_payroll/views/report_payslip.xml +++ b/addons/hr_payroll/views/report_payslip.xml @@ -20,7 +20,7 @@ <td><strong>Address</strong></td> <td colspan="3"> <div t-field="o.employee_id.address_home_id" - t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": True, "phone_icons": True}'/> + t-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": True, "phone_icons": True}'/> </td> </tr> <tr> diff --git a/addons/hr_payroll/views/report_payslipdetails.xml b/addons/hr_payroll/views/report_payslipdetails.xml index e72e2bfa620..356b43df714 100644 --- a/addons/hr_payroll/views/report_payslipdetails.xml +++ b/addons/hr_payroll/views/report_payslipdetails.xml @@ -20,7 +20,7 @@ <td><strong>Address</strong></td> <td colspan="3"> <div t-field="o.employee_id.address_home_id" - t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": True, "phone_icons": True}'/> + t-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": True, "phone_icons": True}'/> </td> </tr> <tr> diff --git a/addons/im_livechat/controllers/main.py b/addons/im_livechat/controllers/main.py index d2183ef2afa..c80630deff3 100644 --- a/addons/im_livechat/controllers/main.py +++ b/addons/im_livechat/controllers/main.py @@ -12,7 +12,7 @@ class LivechatController(http.Controller): def livechat_lib(self, ext, **kwargs): # _get_asset return the bundle html code (script and link list) but we want to use the attachment content xmlid = 'im_livechat.external_lib' - files, remains = request.registry["ir.qweb"]._get_asset_content(request.cr, request.uid, xmlid, request.context) + files, remains = request.env["ir.qweb"]._get_asset_content(xmlid, options=request.context) asset = AssetsBundle(xmlid, files, remains) mock_attachment = getattr(asset, ext)() diff --git a/addons/l10n_fr/views/report_l10nfrbilan.xml b/addons/l10n_fr/views/report_l10nfrbilan.xml index 5923e6a763f..e35a1ecbf50 100644 --- a/addons/l10n_fr/views/report_l10nfrbilan.xml +++ b/addons/l10n_fr/views/report_l10nfrbilan.xml @@ -33,11 +33,11 @@ <tr> <td>Capital souscrit - non appelé</td> <td class="text-right"> - <span t-esc="format(bavar1, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar1" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td></td> <td class="text-right"> - <span t-esc="format(bavar1, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar1" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> @@ -59,83 +59,83 @@ <tr> <td>Frais d'établissement</td> <td class="text-right"> - <span t-esc="format(bavar2, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar2" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(-bavar2b, 'monetary', res_company.currency_id)"/> + <span t-esc="-bavar2b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(bavar2+bavar2b, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar2+bavar2b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Frais de recherche et de développement</td> <td class="text-right"> - <span t-esc="format(bavar3, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar3" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(-bavar3b, 'monetary', res_company.currency_id)"/> + <span t-esc="-bavar3b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(bavar3+bavar3b, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar3+bavar3b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Concessions, brevets, licences,..., droits et valeurs similaires</td> <td class="text-right"> - <span t-esc="format(bavar4, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar4" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(-bavar4b, 'monetary', res_company.currency_id)"/> + <span t-esc="-bavar4b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(bavar4+bavar4b, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar4+bavar4b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Fonds commercial</td> <td class="text-right"> - <span t-esc="format(bavar5, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar5" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(-bavar5b, 'monetary', res_company.currency_id)"/> + <span t-esc="-bavar5b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(bavar5+bavar5b, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar5+bavar5b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Autres</td> <td class="text-right"> - <span t-esc="format(bavar6, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar6" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(-bavar6b, 'monetary', res_company.currency_id)"/> + <span t-esc="-bavar6b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(bavar6+bavar6b, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar6+bavar6b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Immobilisations incorporelles en cours</td> <td class="text-right"> - <span t-esc="format(bavar7, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar7" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(-bavar7b, 'monetary', res_company.currency_id)"/> + <span t-esc="-bavar7b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(bavar7+bavar7b, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar7+bavar7b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Avances et acomptes</td> <td class="text-right"> - <span t-esc="format(bavar8, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar8" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td></td> <td class="text-right"> - <span t-esc="format(bavar8, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar8" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> @@ -149,71 +149,71 @@ <tr> <td>Terrains</td> <td class="text-right"> - <span t-esc="format(bavar9, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar9" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(-bavar9b, 'monetary', res_company.currency_id)"/> + <span t-esc="-bavar9b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(bavar9+bavar9b, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar9+bavar9b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Constructions</td> <td class="text-right"> - <span t-esc="format(bavar10, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar10" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(-bavar10b, 'monetary', res_company.currency_id)"/> + <span t-esc="-bavar10b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(bavar10+bavar10b, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar10+bavar10b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Installations techniques,matériel et outillage</td> <td class="text-right"> - <span t-esc="format(bavar11, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar11" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(-bavar11b, 'monetary', res_company.currency_id)"/> + <span t-esc="-bavar11b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(bavar11+bavar11b, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar11+bavar11b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Autres</td> <td class="text-right"> - <span t-esc="format(bavar12, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar12" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(-bavar12b, 'monetary', res_company.currency_id)"/> + <span t-esc="-bavar12b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(bavar12+bavar12b, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar12+bavar12b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Immobilisations corporelles en cours</td> <td class="text-right"> - <span t-esc="format(bavar13, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar13" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(-bavar13b, 'monetary', res_company.currency_id)"/> + <span t-esc="-bavar13b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(bavar13+bavar13b, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar13+bavar13b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Avances et acomptes</td> <td class="text-right"> - <span t-esc="format(bavar14, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar14" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td></td> <td class="text-right"> - <span t-esc="format(bavar14, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar14" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> @@ -227,73 +227,73 @@ <tr> <td>Participations</td> <td class="text-right"> - <span t-esc="format(bavar15, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar15" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(-bavar15b, 'monetary', res_company.currency_id)"/> + <span t-esc="-bavar15b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(bavar15+bavar15b, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar15+bavar15b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Créances rattachées à des participations</td> <td class="text-right"> - <span t-esc="format(bavar16, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar16" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(-bavar16b, 'monetary', res_company.currency_id)"/> + <span t-esc="-bavar16b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(bavar16+bavar16b, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar16+bavar16b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Titres immobilisés de l'activité de portefeuille</td> <td class="text-right"> - <span t-esc="format(bavar17, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar17" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(-bavar17b, 'monetary', res_company.currency_id)"/> + <span t-esc="-bavar17b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(bavar17+bavar17b, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar17+bavar17b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Autres titres immobilisés</td> <td class="text-right"> - <span t-esc="format(bavar18, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar18" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(-bavar18b, 'monetary', res_company.currency_id)"/> + <span t-esc="-bavar18b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(bavar18+bavar18b, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar18+bavar18b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Prêts</td> <td class="text-right"> - <span t-esc="format(bavar19, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar19" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(-bavar19b, 'monetary', res_company.currency_id)"/> + <span t-esc="-bavar19b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(bavar19+bavar19b, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar19+bavar19b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Autres</td> <td class="text-right"> - <span t-esc="format(bavar20, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar20" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(-bavar20b, 'monetary', res_company.currency_id)"/> + <span t-esc="-bavar20b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(bavar20+bavar20b, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar20+bavar20b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> @@ -301,13 +301,13 @@ <strong>TOTAL I</strong> </td> <td class="text-right"> - <span t-esc="format(at1a, 'monetary', res_company.currency_id)"/> + <span t-esc="at1a" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(-at1b, 'monetary', res_company.currency_id)"/> + <span t-esc="-at1b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(at1, 'monetary', res_company.currency_id)"/> + <span t-esc="at1" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> @@ -325,59 +325,59 @@ <tr> <td>Matières premières et autres approvisionnements</td> <td class="text-right"> - <span t-esc="format(bavar21, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar21" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(-bavar21b, 'monetary', res_company.currency_id)"/> + <span t-esc="-bavar21b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(bavar21+bavar21b, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar21+bavar21b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>En-cours de production [biens et services]</td> <td class="text-right"> - <span t-esc="format(bavar22, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar22" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(-bavar22b, 'monetary', res_company.currency_id)"/> + <span t-esc="-bavar22b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(bavar22+bavar22b, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar22+bavar22b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Produits intermédiaires et finis</td> <td class="text-right"> - <span t-esc="format(bavar23, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar23" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(-bavar23b, 'monetary', res_company.currency_id)"/> + <span t-esc="-bavar23b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(bavar23+bavar23b, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar23+bavar23b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Marchandises</td> <td class="text-right"> - <span t-esc="format(bavar24, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar24" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(-bavar24b, 'monetary', res_company.currency_id)"/> + <span t-esc="-bavar24b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(bavar24+bavar24b, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar24+bavar24b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Avances et acomptes versés sur commandes</td> <td class="text-right"> - <span t-esc="format(bavar25, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar25" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td></td> <td class="text-right"> - <span t-esc="format(bavar25, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar25" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> @@ -389,35 +389,35 @@ <tr> <td>Créances clients et comptes rattachés</td> <td class="text-right"> - <span t-esc="format(bavar26, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar26" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(-bavar26b, 'monetary', res_company.currency_id)"/> + <span t-esc="-bavar26b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(bavar26+bavar26b, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar26+bavar26b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Autres</td> <td class="text-right"> - <span t-esc="format(bavar27, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar27" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(-bavar27b, 'monetary', res_company.currency_id)"/> + <span t-esc="-bavar27b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(bavar27+bavar27b, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar27+bavar27b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Capital souscrit - appelé , non versé</td> <td class="text-right"> - <span t-esc="format(bavar28, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar28" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td></td> <td class="text-right"> - <span t-esc="format(bavar28, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar28" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> @@ -429,55 +429,55 @@ <tr> <td>Actions propres</td> <td class="text-right"> - <span t-esc="format(bavar29, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar29" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(-bavar29b, 'monetary', res_company.currency_id)"/> + <span t-esc="-bavar29b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(bavar29+bavar29b, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar29+bavar29b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Autres titres</td> <td class="text-right"> - <span t-esc="format(bavar30, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar30" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(-bavar30b, 'monetary', res_company.currency_id)"/> + <span t-esc="-bavar30b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(bavar30+bavar30b, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar30+bavar30b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Instruments de trésorerie</td> <td class="text-right"> - <span t-esc="format(bavar31, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar31" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td></td> <td class="text-right"> - <span t-esc="format(bavar31, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar31" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Disponibilités</td> <td class="text-right"> - <span t-esc="format(bavar32, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar32" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td></td> <td class="text-right"> - <span t-esc="format(bavar32, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar32" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Charges constatés d'avance</td> <td class="text-right"> - <span t-esc="format(bavar33, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar33" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td></td> <td class="text-right"> - <span t-esc="format(bavar33, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar33" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> @@ -485,43 +485,43 @@ <strong>TOTAL II</strong> </td> <td class="text-right"> - <span t-esc="format(at2a, 'monetary', res_company.currency_id)"/> + <span t-esc="at2a" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(-at2b, 'monetary', res_company.currency_id)"/> + <span t-esc="-at2b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(at2, 'monetary', res_company.currency_id)"/> + <span t-esc="at2" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Charges à répartir sur plusieurs exercices ( III )</td> <td class="text-right"> - <span t-esc="format(bavar34, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar34" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td></td> <td class="text-right"> - <span t-esc="format(bavar34, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar34" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Primes de remboursement des emprunts ( IV )</td> <td class="text-right"> - <span t-esc="format(bavar35, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar35" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td></td> <td class="text-right"> - <span t-esc="format(bavar35, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar35" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Écarts de conversion actif ( V )</td> <td class="text-right"> - <span t-esc="format(bavar36, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar36" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td></td> <td class="text-right"> - <span t-esc="format(bavar36, 'monetary', res_company.currency_id)"/> + <span t-esc="bavar36" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> @@ -529,13 +529,13 @@ <strong>TOTAL ACTIF ( I + II + III + IV + V )</strong> </td> <td class="text-right"> - <span t-esc="format(at1a+at2a, 'monetary', res_company.currency_id)"/> + <span t-esc="at1a+at2a" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(-at1b-at2b, 'monetary', res_company.currency_id)"/> + <span t-esc="-at1b-at2b" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> <td class="text-right"> - <span t-esc="format(actif, 'monetary', res_company.currency_id)"/> + <span t-esc="actif" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> </table> @@ -549,19 +549,19 @@ </tr> <tr> <td>Capital [dont versé...]</td> - <td><span t-esc="format(bpvar1, 'monetary', res_company.currency_id)"/></td> + <td><span t-esc="bpvar1" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> </tr> <tr> <td>Primes d'émission, de fusion, d'apport</td> - <td><span t-esc="format(bpvar2, 'monetary', res_company.currency_id)"/></td> + <td><span t-esc="bpvar2" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> </tr> <tr> <td>Écarts de réévaluation</td> - <td><span t-esc="format(bpvar3, 'monetary', res_company.currency_id)"/></td> + <td><span t-esc="bpvar3" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> </tr> <tr> <td>Écart d'équivalence</td> - <td><span t-esc="format(bpvar4, 'monetary', res_company.currency_id)"/></td> + <td><span t-esc="bpvar4" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> </tr> <tr> <td><strong>RÉSERVES</strong></td> @@ -569,37 +569,37 @@ </tr> <tr> <td>Réserve légale</td> - <td><span t-esc="format(bpvar5, 'monetary', res_company.currency_id)"/></td> + <td><span t-esc="bpvar5" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> </tr> <tr> <td>Réserves statutaires ou contractuelles</td> - <td><span t-esc="format(bpvar6, 'monetary', res_company.currency_id)"/></td> + <td><span t-esc="bpvar6" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> </tr> <tr> - <td>Réserves réglementées</td><td><span t-esc="format(bpvar7, 'monetary', res_company.currency_id)"/></td></tr> + <td>Réserves réglementées</td><td><span t-esc="bpvar7" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td></tr> <tr> <td>Autres réserves</td> - <td><span t-esc="format(bpvar8, 'monetary', res_company.currency_id)"/></td> + <td><span t-esc="bpvar8" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> </tr> <tr> <td>Report à nouveau</td> - <td><span t-esc="format(bpvar9, 'monetary', res_company.currency_id)"/></td> + <td><span t-esc="bpvar9" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> </tr> <tr> <td><strong>RÉSULTAT DE L'EXERCICE [bénéfice ou perte]</strong></td> - <td><span t-esc="format(bpvar10, 'monetary', res_company.currency_id)"/></td> + <td><span t-esc="bpvar10" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> </tr> <tr> <td>Subventions d'investissement</td> - <td><span t-esc="format(bpvar11, 'monetary', res_company.currency_id)"/></td> + <td><span t-esc="bpvar11" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> </tr> <tr> <td>Provisions réglementées</td> - <td><span t-esc="format(bpvar12, 'monetary', res_company.currency_id)"/></td> + <td><span t-esc="bpvar12" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> </tr> <tr> <td class="text-right"><strong>TOTAL I</strong></td> - <td><span t-esc="format(pt1, 'monetary', res_company.currency_id)"/></td> + <td><span t-esc="pt1" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> </tr> <tr> <td><strong>PROVISIONS</strong></td> @@ -607,15 +607,15 @@ </tr> <tr> <td>Provisions pour risques</td> - <td><span t-esc="format(bpvar13, 'monetary', res_company.currency_id)"/></td> + <td><span t-esc="bpvar13" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> </tr> <tr> <td>Provisions pour charges</td> - <td><span t-esc="format(bpvar14, 'monetary', res_company.currency_id)"/></td> + <td><span t-esc="bpvar14" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> </tr> <tr> <td class="text-right"><strong>TOTAL II</strong></td> - <td><span t-esc="format(pt2, 'monetary', res_company.currency_id)"/></td> + <td><span t-esc="pt2" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> </tr> <tr> <td><strong>DETTES</strong></td> @@ -623,59 +623,59 @@ </tr> <tr> <td>Emprunts obligataires convertibles</td> - <td><span t-esc="format(bpvar15, 'monetary', res_company.currency_id)"/></td> + <td><span t-esc="bpvar15" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> </tr> <tr> <td>Autres emprunts obligataires</td> - <td><span t-esc="format(bpvar16, 'monetary', res_company.currency_id)"/></td> + <td><span t-esc="bpvar16" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> </tr> <tr> <td>Emprunts et dettes auprès des établissements de crédit</td> - <td><span t-esc="format(bpvar17, 'monetary', res_company.currency_id)"/></td> + <td><span t-esc="bpvar17" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> </tr> <tr> <td>Emprunts et dettes financières diverses</td> - <td><span t-esc="format(bpvar18, 'monetary', res_company.currency_id)"/></td> + <td><span t-esc="bpvar18" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> </tr> <tr> <td>Avances et acomptes reçus sur commandes en cours</td> - <td><span t-esc="format(bpvar19, 'monetary', res_company.currency_id)"/></td> + <td><span t-esc="bpvar19" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> </tr> <tr> <td>Dettes fournisseurs et comptes rattachés </td> - <td><span t-esc="format(bpvar20, 'monetary', res_company.currency_id)"/></td> + <td><span t-esc="bpvar20" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> </tr> <tr> <td>Dettes fiscales et sociales</td> - <td><span t-esc="format(bpvar21, 'monetary', res_company.currency_id)"/></td> + <td><span t-esc="bpvar21" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> </tr> <tr> <td>Dettes sur immobilisations et comptes rattachés</td> - <td><span t-esc="format(bpvar22, 'monetary', res_company.currency_id)"/></td> + <td><span t-esc="bpvar22" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> </tr> <tr> <td>Autres dettes</td> - <td><span t-esc="format(bpvar23, 'monetary', res_company.currency_id)"/></td> + <td><span t-esc="bpvar23" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> </tr> <tr> <td>Instruments de trésorerie</td> - <td><span t-esc="format(bpvar24, 'monetary', res_company.currency_id)"/></td> + <td><span t-esc="bpvar24" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> </tr> <tr> <td>Produits constatés d'avance</td> - <td><span t-esc="format(bpvar25, 'monetary', res_company.currency_id)"/></td> + <td><span t-esc="bpvar25" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> </tr> <tr> <td class="text-right"><strong>TOTAL III</strong></td> - <td><span t-esc="format(pt3, 'monetary', res_company.currency_id)"/></td> + <td><span t-esc="pt3" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> </tr> <tr> <td>Écarts de conversion passif <font face="Times-Roman">( IV )</font></td> - <td><span t-esc="format(bpvar26, 'monetary', res_company.currency_id)"/></td> + <td><span t-esc="bpvar26" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> </tr> <tr> <td><strong>TOTAL GÉNÉRAL (I + II + III + IV)</strong></td> - <td><span t-esc="format(passif, 'monetary', res_company.currency_id)"/></td> + <td><span t-esc="passif" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> </tr> <tr> <td>&nbsp;</td> @@ -683,7 +683,7 @@ </tr> <tr> <td><strong>ACTIF - PASSIF</strong></td> - <td><span t-esc="format(round(actif-passif,2), 'monetary', res_company.currency_id)"/></td> + <td><span t-esc="round(actif-passif,2)" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> </tr> </tbody> </table> diff --git a/addons/l10n_fr/views/report_l10nfrresultat.xml b/addons/l10n_fr/views/report_l10nfrresultat.xml index 0516dd58199..16dbfb81bdf 100644 --- a/addons/l10n_fr/views/report_l10nfrresultat.xml +++ b/addons/l10n_fr/views/report_l10nfrresultat.xml @@ -35,61 +35,61 @@ <tr> <td>Achat de marchandises</td> <td> - <span class="text-right" t-esc="format(cdrc1, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrc1" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Variation des stocks</td> <td> - <span class="text-right" t-esc="format(cdrc2, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrc2" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Achats de matières premières et autres approvisionnements</td> <td> - <span class="text-right" t-esc="format(cdrc3, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrc3" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Variation des stocks</td> <td> - <span class="text-right" t-esc="format(cdrc4, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrc4" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Autres achats et charges externes</td> <td> - <span class="text-right" t-esc="format(cdrc5, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrc5" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Redevances de crédit-bail mobilier</td> <td> - <span class="text-right" t-esc="format(cdrc6, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrc6" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Redevances de crédit-bail immobilier</td> <td> - <span class="text-right" t-esc="format(cdrc7, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrc7" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Impôts, taxes et versements assimilés</td> <td> - <span class="text-right" t-esc="format(cdrc8, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrc8" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Salaires et traitements</td> <td> - <span class="text-right" t-esc="format(cdrc9, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrc9" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Charges sociales</td> <td> - <span class="text-right" t-esc="format(cdrc10, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrc10" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> @@ -99,43 +99,43 @@ <tr> <td>Sur immobilisations : dotations aux amortissements</td> <td> - <span class="text-right" t-esc="format(cdrc11, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrc11" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Sur immobilisations : dotations aux dépréciations</td> <td> - <span class="text-right" t-esc="format(cdrc12, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrc12" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Sur actif circulant : dotations aux dépréciations</td> <td> - <span class="text-right" t-esc="format(cdrc13, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrc13" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Dotations aux provisions</td> <td> - <span class="text-right" t-esc="format(cdrc14, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrc14" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Autres charges</td> <td> - <span class="text-right" t-esc="format(cdrc15, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrc15" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td class="text-right"><strong>TOTAL I</strong></td> <td> - <span class="text-right" t-esc="format(ct1, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="ct1" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td><strong>Quotes-parts de résultat sur opérations faites en commun ( II )</strong></td> <td> - <span class="text-right" t-esc="format(cdrc16, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrc16" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> @@ -145,31 +145,31 @@ <tr> <td>Dotations aux amortissements, aux dépréciations et aux provisions</td> <td> - <span class="text-right" t-esc="format(cdrc17, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrc17" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Intérêts et charges assimilées</td> <td> - <span class="text-right" t-esc="format(cdrc18, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrc18" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Différences négatives de change</td> <td> - <span class="text-right" t-esc="format(cdrc19, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrc19" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Charges nettes sur cessions de valeurs mobilières de placement</td> <td> - <span class="text-right" t-esc="format(cdrc20, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrc20" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td class="text-right"><strong>TOTAL III</strong></td> <td> - <span class="text-right" t-esc="format(ct3, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="ct3" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> @@ -179,43 +179,43 @@ <tr> <td>Sur opérations de gestion</td> <td> - <span class="text-right" t-esc="format(cdrc21, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrc21" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Sur opérations en capital</td> <td> - <span class="text-right" t-esc="format(cdrc22, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrc22" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Dotations aux amortissements, aux dépréciations et aux provisions</td> <td> - <span class="text-right" t-esc="format(cdrc23, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrc23" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td class="text-right"><strong>TOTAL IV</strong></td> <td> - <span class="text-right" t-esc="format(ct4, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="ct4" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td><strong>Participation des salariĂ©s aux rĂ©sultats ( V )</strong></td> <td> - <span class="text-right" t-esc="format(cdrc24, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrc24" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td><strong>ImpĂ´ts sur les bĂ©nĂ©fices ( VI )</strong></td> <td> - <span class="text-right" t-esc="format(cdrc25, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrc25" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td class="text-right"><strong>TOTAL CHARGES ( I + II + III + IV+ V+ VI )</strong></td> <td> - <span class="text-right" t-esc="format(charges, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="charges" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> @@ -236,67 +236,67 @@ <tr> <td>Vente de marchandises</td> <td> - <span class="text-right" t-esc="format(cdrp1, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrp1" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Production vendue [biens et services]</td> <td> - <span class="text-right" t-esc="format(cdrp2, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrp2" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td><strong>Sous-total A - Montant net du chiffre d'affaires</strong></td> <td> - <span class="text-right" t-esc="format(pta, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="pta" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Production stockée</td> <td> - <span class="text-right" t-esc="format(cdrp3, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrp3" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Production immobilisée</td> <td> - <span class="text-right" t-esc="format(cdrp4, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrp4" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Subventions d'exploitation</td> <td> - <span class="text-right" t-esc="format(cdrp5, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrp5" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Reprises sur provisions, dépréciations (et amortissements) et transferts de charges</td> <td> - <span class="text-right" t-esc="format(cdrp6, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrp6" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Autres produits</td> <td> - <span class="text-right" t-esc="format(cdrp7, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrp7" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td><strong>Sous-total B</strong></td> <td> - <span class="text-right" t-esc="format(ptb, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="ptb" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td class="text-right"><strong>TOTAL I ( A + B )</strong></td> <td> - <span class="text-right" t-esc="format(pt1, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="pt1" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td><strong>Quotes-parts de résultat sur opérations faites en commun (II)</strong></td> <td> - <span class="text-right" t-esc="format(cdrp8, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrp8" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> @@ -306,43 +306,43 @@ <tr> <td>De participation</td> <td> - <span class="text-right" t-esc="format(cdrp9, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrp9" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>D'autres valeurs mobilières et créances de l'actif immobilisé</td> <td> - <span class="text-right" t-esc="format(cdrp10, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrp10" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Autres intérêts et produits assimilés</td> <td> - <span class="text-right" t-esc="format(cdrp11, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrp11" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Reprises sur provisions, dépréciations et transferts de charges</td> <td> - <span class="text-right" t-esc="format(cdrp12, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrp12" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Différences positives de change</td> <td> - <span class="text-right" t-esc="format(cdrp13, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrp13" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Produits nets sur cessions de valeurs mobilières de placement</td> <td> - <span class="text-right" t-esc="format(cdrp14, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrp14" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td class="text-right"><strong>TOTAL III</strong></td> <td> - <span class="text-right" t-esc="format(pt3, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="pt3" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> @@ -352,37 +352,37 @@ <tr> <td>Sur opérations de gestion</td> <td> - <span class="text-right" t-esc="format(cdrp15, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrp15" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Sur opérations en capital</td> <td> - <span class="text-right" t-esc="format(cdrp16, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrp16" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td>Reprises sur provisions, dépréciations et transferts de charges</td> <td> - <span class="text-right" t-esc="format(cdrp17, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="cdrp17" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td class="text-right"><strong>TOTAL IV</strong></td> <td> - <span class="text-right" t-esc="format(pt4, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="pt4" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td class="text-right"><strong>TOTAL DES PRODUITS ( I + II + III + IV )</strong></td> <td> - <span class="text-right" t-esc="format(produits, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="produits" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> <tr> <td class="text-right"><strong>PRODUITS - CHARGES</strong></td> <td> - <span class="text-right" t-esc="format(produits-charges, 'monetary', res_company.currency_id)"/> + <span class="text-right" t-esc="produits-charges" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> </td> </tr> </tbody> diff --git a/addons/l10n_fr_hr_payroll/views/report_l10nfrfichepaye.xml b/addons/l10n_fr_hr_payroll/views/report_l10nfrfichepaye.xml index 3970f0cc290..e4c0b06ba87 100644 --- a/addons/l10n_fr_hr_payroll/views/report_l10nfrfichepaye.xml +++ b/addons/l10n_fr_hr_payroll/views/report_l10nfrfichepaye.xml @@ -17,7 +17,7 @@ <tr> <td> <div t-field="o.employee_id.company_id.partner_id" - t-field-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' />SIRET: + t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' />SIRET: <span t-esc="o.employee_id.company_id.siret or '_'"/> APE: <span t-esc="o.employee_id.company_id.ape or '_'"/> </td> @@ -25,7 +25,7 @@ <tr> <td> <div t-field="o.employee_id.address_home_id" - t-field-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}'/> + t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}'/> </td> </tr> </table> diff --git a/addons/l10n_in_hr_payroll/views/report_payslipdetails.xml b/addons/l10n_in_hr_payroll/views/report_payslipdetails.xml index b35cd67b67b..4356519c564 100644 --- a/addons/l10n_in_hr_payroll/views/report_payslipdetails.xml +++ b/addons/l10n_in_hr_payroll/views/report_payslipdetails.xml @@ -20,7 +20,7 @@ <td><strong>Address</strong></td> <td colspan="3"> <div t-field="o.employee_id.address_home_id" - t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": True, "phone_icons": True}'/> + t-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": True, "phone_icons": True}'/> </td> </tr> <tr> diff --git a/addons/lunch/report/lunch_order_templates.xml b/addons/lunch/report/lunch_order_templates.xml index 1b22bb3dd99..8ff36c6920f 100644 --- a/addons/lunch/report/lunch_order_templates.xml +++ b/addons/lunch/report/lunch_order_templates.xml @@ -9,7 +9,7 @@ <div class="row"> <div class="col-xs-5 col-xs-offset-7"> <div t-field="user.partner_id" - t-field-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' /> + t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' /> </div> </div> @@ -51,7 +51,7 @@ </td> <td class="text-right"> <span t-field="line.price" - t-field-options='{"widget": "monetary", "display_currency": user.company_id.currency_id}'/> + t-options='{"widget": "monetary", "display_currency": user.company_id.currency_id}'/> </td> </tr> </t> diff --git a/addons/mrp_repair/report/mrp_repair_templates_repair_order.xml b/addons/mrp_repair/report/mrp_repair_templates_repair_order.xml index 3a12c225066..00e32ef9345 100644 --- a/addons/mrp_repair/report/mrp_repair_templates_repair_order.xml +++ b/addons/mrp_repair/report/mrp_repair_templates_repair_order.xml @@ -14,19 +14,19 @@ <div t-if="o.partner_invoice_id"> <strong t-if="o.address_id != o.partner_invoice_id">Invoice address: </strong> <div t-field="o.partner_invoice_id" - t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": True, "phone_icons": True}'/> + t-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": True, "phone_icons": True}'/> <p t-if="o.partner_id.vat">VAT: <span t-field="o.partner_id.vat"/></p> </div> <div t-if="o.address_id != o.partner_invoice_id"> <strong>Shipping address :</strong> <div t-field="o.address_id" - t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": True, "phone_icons": True}'/> + t-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": True, "phone_icons": True}'/> <p t-if="o.partner_id.vat">VAT: <span t-field="o.partner_id.vat"/></p> </div> </div> <div class="col-xs-5 col-xs-offset-1"> <div t-field="o.partner_id" - t-field-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' /> + t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' /> </div> </div> @@ -88,7 +88,7 @@ </td> <td class="text-right"> <span t-field="line.price_subtotal" - t-field-options='{"widget": "monetary", "display_currency": o.pricelist_id.currency_id}'/> + t-options='{"widget": "monetary", "display_currency": o.pricelist_id.currency_id}'/> </td> </t> </tr> @@ -112,7 +112,7 @@ </td> <td class="text-right"> <span t-field="fees.price_subtotal" - t-field-options='{"widget": "monetary", "display_currency": o.pricelist_id.currency_id}'/> + t-options='{"widget": "monetary", "display_currency": o.pricelist_id.currency_id}'/> </td> </t> </tr> @@ -127,21 +127,21 @@ <td><strong>Total Without Taxes</strong></td> <td class="text-right"> <span t-field="o.amount_untaxed" - t-field-options='{"widget": "monetary", "display_currency": o.pricelist_id.currency_id}'/> + t-options='{"widget": "monetary", "display_currency": o.pricelist_id.currency_id}'/> </td> </tr> <tr> <td>Taxes</td> <td class="text-right"> <span t-field="o.amount_tax" - t-field-options='{"widget": "monetary", "display_currency": o.pricelist_id.currency_id}'/> + t-options='{"widget": "monetary", "display_currency": o.pricelist_id.currency_id}'/> </td> </tr> <tr class="border-black"> <td><strong>Total</strong></td> <td class="text-right"> <span t-field="o.amount_total" - t-field-options='{"widget": "monetary", "display_currency": o.pricelist_id.currency_id}'/> + t-options='{"widget": "monetary", "display_currency": o.pricelist_id.currency_id}'/> </td> </tr> </table> diff --git a/addons/point_of_sale/views/report_statement.xml b/addons/point_of_sale/views/report_statement.xml index cedd7f55309..82fe782d189 100644 --- a/addons/point_of_sale/views/report_statement.xml +++ b/addons/point_of_sale/views/report_statement.xml @@ -34,11 +34,11 @@ </div> <div class="col-xs-3"> <strong>Starting Balance</strong>:<br/> - <span t-field="o.balance_start" t-field-options='{"widget": "monetary", "display_currency": res_company.currency_id}'/> + <span t-field="o.balance_start" t-options='{"widget": "monetary", "display_currency": res_company.currency_id}'/> </div> <div class="col-xs-3"> <strong>Ending Balance</strong>:<br/> - <span t-field="o.balance_end_real" t-field-options='{"widget": "monetary", "display_currency": res_company.currency_id}'/> + <span t-field="o.balance_end_real" t-options='{"widget": "monetary", "display_currency": res_company.currency_id}'/> </div> </div> @@ -56,7 +56,7 @@ <td><span t-esc="line.partner_id.name"/></td> <td class="text-right"> <span t-field="line.amount" - t-field-options='{"widget": "monetary", "display_currency": res_company.currency_id}'/> + t-options='{"widget": "monetary", "display_currency": res_company.currency_id}'/> </td> </tr> </tbody> @@ -67,7 +67,7 @@ <table class="table table-condensed"> <tr class="border-black"> <td><strong>Total</strong></td> - <td class="text-right"><span t-esc="format(sum([line.amount for line in o.line_ids]), 'monetary', res_company.currency_id)"/></td> + <td class="text-right"><span t-esc="sum([line.amount for line in o.line_ids])" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> </tr> </table> </div> diff --git a/addons/purchase/views/report_purchaseorder.xml b/addons/purchase/views/report_purchaseorder.xml index 158c411de1e..ad3896dd19d 100644 --- a/addons/purchase/views/report_purchaseorder.xml +++ b/addons/purchase/views/report_purchaseorder.xml @@ -11,18 +11,18 @@ <strong>Shipping address:</strong> <div t-if="o.dest_address_id"> <div t-field="o.dest_address_id" - t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": True, "phone_icons": True}'/> + t-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": True, "phone_icons": True}'/> </div> <div t-if="not o.dest_address_id and o.picking_type_id and o.picking_type_id.warehouse_id"> <span t-field="o.picking_type_id.warehouse_id.name"/> <div t-field="o.picking_type_id.warehouse_id.partner_id" - t-field-options='{"widget": "contact", "fields": ["address", "phone", "fax"], "no_marker": True, "phone_icons": True}'/> + t-options='{"widget": "contact", "fields": ["address", "phone", "fax"], "no_marker": True, "phone_icons": True}'/> </div> </div> <div class="col-xs-5 col-xs-offset-1"> <div t-field="o.partner_id" - t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": True, "phone_icons": True}'/> + t-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": True, "phone_icons": True}'/> <p t-if="o.partner_id.vat">VAT: <span t-field="o.partner_id.vat"/></p> </div> </div> @@ -76,7 +76,7 @@ </td> <td class="text-right"> <span t-field="line.price_subtotal" - t-field-options='{"widget": "monetary", "display_currency": o.currency_id}'/> + t-options='{"widget": "monetary", "display_currency": o.currency_id}'/> </td> </tr> </tbody> @@ -89,21 +89,21 @@ <td><strong>Total Without Taxes</strong></td> <td class="text-right"> <span t-field="o.amount_untaxed" - t-field-options='{"widget": "monetary", "display_currency": o.currency_id}'/> + t-options='{"widget": "monetary", "display_currency": o.currency_id}'/> </td> </tr> <tr> <td>Taxes</td> <td class="text-right"> <span t-field="o.amount_tax" - t-field-options='{"widget": "monetary", "display_currency": o.currency_id}'/> + t-options='{"widget": "monetary", "display_currency": o.currency_id}'/> </td> </tr> <tr class="border-black"> <td><strong>Total</strong></td> <td class="text-right"> <span t-field="o.amount_total" - t-field-options='{"widget": "monetary", "display_currency": o.currency_id}'/> + t-options='{"widget": "monetary", "display_currency": o.currency_id}'/> </td> </tr> </table> diff --git a/addons/purchase/views/report_purchasequotation.xml b/addons/purchase/views/report_purchasequotation.xml index 104f34527e4..765a108f306 100644 --- a/addons/purchase/views/report_purchasequotation.xml +++ b/addons/purchase/views/report_purchasequotation.xml @@ -12,17 +12,17 @@ <strong>Shipping address:</strong> <div t-if="o.dest_address_id"> <div t-field="o.dest_address_id" - t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": True, "phone_icons": True}'/> + t-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": True, "phone_icons": True}'/> </div> <div t-if="not o.dest_address_id and o.picking_type_id.warehouse_id"> <span t-field="o.picking_type_id.warehouse_id.name"/> <div t-field="o.picking_type_id.warehouse_id.partner_id" - t-field-options='{"widget": "contact", "fields": ["address", "phone", "fax"], "no_marker": True, "phone_icons": True}'/> + t-options='{"widget": "contact", "fields": ["address", "phone", "fax"], "no_marker": True, "phone_icons": True}'/> </div> </div> <div class="col-xs-5 col-xs-offset-1"> <div t-field="o.partner_id" - t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": True, "phone_icons": True}'/> + t-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": True, "phone_icons": True}'/> <p t-if="o.partner_id.vat">VAT: <span t-field="o.partner_id.vat"/></p> </div> </div> diff --git a/addons/report/models/ir_qweb.py b/addons/report/models/ir_qweb.py index 68e9673d902..3e8dc558c08 100644 --- a/addons/report/models/ir_qweb.py +++ b/addons/report/models/ir_qweb.py @@ -12,7 +12,7 @@ class BarcodeConverter(osv.AbstractModel): _name = 'ir.qweb.field.barcode' _inherit = 'ir.qweb.field' - def value_to_html(self, cr, uid, value, field, options=None, context=None): + def value_to_html(self, cr, uid, value, options, context=None): options = options or {} barcode_type = options.get('type', 'Code128') barcode = self.pool['report'].barcode( diff --git a/addons/report/views/layouts.xml b/addons/report/views/layouts.xml index 39494368b46..f4bebe09cd2 100644 --- a/addons/report/views/layouts.xml +++ b/addons/report/views/layouts.xml @@ -108,7 +108,7 @@ <div class="row"> <div class="col-xs-3" name="company_address"> <div t-field="company.partner_id" - t-field-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' + t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' style="border-bottom: 1px solid black;"/> </div> </div> diff --git a/addons/report_intrastat/report/report_intrastat_invoice_template.xml b/addons/report_intrastat/report/report_intrastat_invoice_template.xml index c40c3b8661f..5660ad8f816 100644 --- a/addons/report_intrastat/report/report_intrastat_invoice_template.xml +++ b/addons/report_intrastat/report/report_intrastat_invoice_template.xml @@ -7,7 +7,7 @@ <div class="row"> <div class="col-xs-5 col-xs-offset-7"> <address t-field="o.partner_id" - t-field-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' /> + t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' /> <span t-field="o.partner_id.vat"/> </div> </div> @@ -67,7 +67,7 @@ <td t-if="display_discount" groups="sale.group_discount_per_so_line"><span t-field="l.discount"/></td> <td class="text-right"> <span t-field="l.price_subtotal" - t-field-options='{"widget": "monetary", "display_currency": o.currency_id}'/> + t-options='{"widget": "monetary", "display_currency": o.currency_id}'/> </td> </tr> </tbody> @@ -79,19 +79,19 @@ <tr class="border-black"> <td><strong>Total Without Taxes</strong></td> <td class="text-right"> - <span t-field="o.amount_untaxed" t-field-options='{"widget": "monetary", "display_currency": o.currency_id}'/> + <span t-field="o.amount_untaxed" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/> </td> </tr> <tr> <td>Taxes</td> <td class="text-right"> - <span t-field="o.amount_tax" t-field-options='{"widget": "monetary", "display_currency": o.currency_id}'/> + <span t-field="o.amount_tax" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/> </td> </tr> <tr class="border-black"> <td><strong>Total</strong></td> <td class="text-right"> - <span t-field="o.amount_total" t-field-options='{"widget": "monetary", "display_currency": o.currency_id}'/> + <span t-field="o.amount_total" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/> </td> </tr> </table> @@ -112,7 +112,7 @@ <td><span t-field="t.name"/></td> <td class="text-right"> <span t-field="t.amount" - t-field-options='{"widget": "monetary", "display_currency": o.currency_id}'/> + t-options='{"widget": "monetary", "display_currency": o.currency_id}'/> </td> </tr> </tbody> diff --git a/addons/sale/views/report_invoice_layouted.xml b/addons/sale/views/report_invoice_layouted.xml index 3f492f8de8e..48094594501 100644 --- a/addons/sale/views/report_invoice_layouted.xml +++ b/addons/sale/views/report_invoice_layouted.xml @@ -49,11 +49,11 @@ </td> <td class="text-right" groups="sale.group_show_price_subtotal"> <span t-field="l.price_subtotal" - t-field-options='{"widget": "monetary", "display_currency": o.currency_id}'/> + t-options='{"widget": "monetary", "display_currency": o.currency_id}'/> </td> <td class="text-right" groups="sale.group_show_price_total"> <span t-field="l.price_total" - t-field-options='{"widget": "monetary", "display_currency": o.currency_id}'/> + t-options='{"widget": "monetary", "display_currency": o.currency_id}'/> </td> </tr> </t> @@ -63,7 +63,7 @@ <td colspan="6"> <strong>Subtotal: </strong> <t t-set="subtotal" t-value="sum(line.price_subtotal for line in layout_category['lines'])"/> - <span t-esc="format(subtotal, 'monetary', o.currency_id)"/> + <span t-esc="subtotal" t-options="{'widget': 'monetary', 'display_currency': o.currency_id}"/> </td> </tr> </t> @@ -87,12 +87,12 @@ <strong t-if="o.partner_shipping_id == o.partner_id">Invoicing and shipping address:</strong> <strong t-if="o.partner_shipping_id != o.partner_id">Invoicing address:</strong> <div t-field="o.partner_id" - t-field-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}'/> + t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}'/> <span t-if="o.partner_id.vat">TIN: <span t-field="o.partner_id.vat"/></span> <div t-if="o.partner_shipping_id != o.partner_id" class="mt8"> <strong>Shipping address:</strong> <div t-field="o.partner_shipping_id" - t-field-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}'/> + t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}'/> <span t-if="o.partner_id.vat">TIN: <span t-field="o.partner_id.vat"/></span> </div> </div> diff --git a/addons/sale/views/report_saleorder.xml b/addons/sale/views/report_saleorder.xml index 5ee5f52117c..1e45bb32385 100644 --- a/addons/sale/views/report_saleorder.xml +++ b/addons/sale/views/report_saleorder.xml @@ -11,18 +11,18 @@ <strong t-if="doc.partner_shipping_id == doc.partner_invoice_id">Invoicing and shipping address:</strong> <strong t-if="doc.partner_shipping_id != doc.partner_invoice_id">Invoicing address:</strong> <div t-field="doc.partner_invoice_id" - t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": True, "phone_icons": True}'/> + t-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": True, "phone_icons": True}'/> <p t-if="doc.partner_id.vat">VAT: <span t-field="doc.partner_id.vat"/></p> <div t-if="doc.partner_shipping_id != doc.partner_invoice_id" class="mt8"> <strong>Shipping address:</strong> <div t-field="doc.partner_shipping_id" - t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": True, "phone_icons": True}'/> + t-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": True, "phone_icons": True}'/> <p t-if="doc.partner_id.vat">VAT: <span t-field="doc.partner_id.vat"/></p> </div> </div> <div class="col-xs-5 col-xs-offset-1"> <div t-field="doc.partner_id" - t-field-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' /> + t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' /> </div> </div> @@ -98,11 +98,11 @@ </td> <td class="text-right" groups="sale.group_show_price_subtotal"> <span t-field="l.price_subtotal" - t-field-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/> + t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/> </td> <td class="text-right" groups="sale.group_show_price_total"> <span t-field="l.price_total" - t-field-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/> + t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/> </td> </tr> </t> @@ -112,7 +112,7 @@ <td colspan="6"> <strong>Subtotal: </strong> <t t-set="subtotal" t-value="sum(line.price_subtotal for line in layout_category['lines'])"/> - <span t-esc="format(subtotal, 'monetary', doc.pricelist_id.currency_id)"/> + <span t-esc="subtotal" t-options="{'widget': 'monetary', 'display_currency': doc.pricelist_id.currency_id}"/> </td> </tr> </t> @@ -133,7 +133,7 @@ <td><strong>Total Without Taxes</strong></td> <td class="text-right"> <span t-field="doc.amount_untaxed" - t-field-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/> + t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/> </td> </tr> <t t-foreach="doc._get_tax_amount_by_group()" t-as="amount_by_group"> @@ -148,7 +148,7 @@ <td><strong>Total</strong></td> <td class="text-right"> <span t-field="doc.amount_total" - t-field-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/> + t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/> </td> </tr> </table> diff --git a/addons/stock/report/report_deliveryslip.xml b/addons/stock/report/report_deliveryslip.xml index fec4e8973af..fe91111ed0d 100644 --- a/addons/stock/report/report_deliveryslip.xml +++ b/addons/stock/report/report_deliveryslip.xml @@ -13,7 +13,7 @@ </div> <div t-if="o.partner_id" name="partner_header"> <div t-field="o.partner_id" - t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": True}'/> + t-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": True}'/> </div> </div> </div> diff --git a/addons/stock/report/report_stockpicking_operations.xml b/addons/stock/report/report_stockpicking_operations.xml index bcec910e5f4..bd77df3eaf4 100644 --- a/addons/stock/report/report_stockpicking_operations.xml +++ b/addons/stock/report/report_stockpicking_operations.xml @@ -24,12 +24,12 @@ <div t-if="o.move_lines and o.move_lines[0].partner_id and o.move_lines[0].partner_id.id != o.partner_id.id"> <span><strong>Delivery Address:</strong></span> <div t-field="o.move_lines[0].partner_id" - t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": True, "phone_icons": True}'/> + t-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": True, "phone_icons": True}'/> </div> <div t-if="o.picking_type_id.code != 'internal' and (not o.move_lines or not o.move_lines[0].partner_id) and o.picking_type_id.warehouse_id.partner_id"> <span><strong>Warehouse Address:</strong></span> <div t-field="o.picking_type_id.warehouse_id.partner_id" - t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": True, "phone_icons": True}'/> + t-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": True, "phone_icons": True}'/> </div> </div> <div class="col-xs-5 col-xs-offset-1"> @@ -44,7 +44,7 @@ </div> <div t-if="o.partner_id" name="partner_header"> <div t-field="o.partner_id" - t-field-options='{"widget": "contact", "fields": ["name", "phone"], "no_marker": True, "phone_icons": True}'/> + t-options='{"widget": "contact", "fields": ["name", "phone"], "no_marker": True, "phone_icons": True}'/> <p t-if="o.sudo().partner_id.vat">VAT: <span t-field="o.sudo().partner_id.vat"/></p> </div> </div> diff --git a/addons/web_editor/models/ir_qweb.py b/addons/web_editor/models/ir_qweb.py index 362cdcd8a0b..b1c0a165e44 100644 --- a/addons/web_editor/models/ir_qweb.py +++ b/addons/web_editor/models/ir_qweb.py @@ -31,7 +31,6 @@ from openerp.osv import orm, fields from openerp.tools import ustr, DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT from openerp.tools import html_escape as escape from openerp.addons.base.ir import ir_qweb -from openerp.tools.translate import translate REMOTE_CONNECTION_TIMEOUT = 2.5 @@ -296,7 +295,7 @@ class Image(orm.AbstractModel): _inherit = 'ir.qweb.field.image' @api.model - def record_to_html(self, record, field_name, options, values=None): + def record_to_html(self, record, field_name, options): assert options['tagName'] != 'img',\ "Oddly enough, the root tag of an image field can not be img. " \ "That is because the image goes into the tag, or it gets the " \ diff --git a/addons/website/controllers/main.py b/addons/website/controllers/main.py index fe1439f7dfa..0b1d9bd78af 100644 --- a/addons/website/controllers/main.py +++ b/addons/website/controllers/main.py @@ -344,7 +344,6 @@ class Website(openerp.addons.web.controllers.main.Home): """ cr, uid, context, pool = request.cr, request.uid, request.context, request.registry view = pool["ir.ui.view"] - qweb = pool["ir.qweb"] context = dict(request.context or {}, active_test=True) @@ -356,7 +355,7 @@ class Website(openerp.addons.web.controllers.main.Home): set_active(enable, True) if get_bundle: - return qweb._get_asset(cr, uid, 'web.assets_frontend', context) + return request.env["ir.qweb"]._get_asset('web.assets_frontend', options=context) return True diff --git a/addons/website/views/website_templates.xml b/addons/website/views/website_templates.xml index 4091d4cc4d1..fbcbe77aa67 100644 --- a/addons/website/views/website_templates.xml +++ b/addons/website/views/website_templates.xml @@ -904,7 +904,7 @@ Sitemap: <t t-esc="url_root"/>sitemap.xml <template id="company_description" name="Company Description"> <address itemscope="itemscope" itemtype="http://schema.org/Organization"> <!-- TODO widget contact must add itemprop attributes --> - <div t-field="res_company.partner_id" t-field-options='{ + <div t-field="res_company.partner_id" t-options='{ "widget": "contact", "fields": ["name", "address", "phone", "mobile", "fax", "email"]}'/> </address> diff --git a/addons/website_blog/views/website_blog_templates.xml b/addons/website_blog/views/website_blog_templates.xml index 2fa39cef5da..2b93c8280af 100644 --- a/addons/website_blog/views/website_blog_templates.xml +++ b/addons/website_blog/views/website_blog_templates.xml @@ -136,7 +136,7 @@ <div t-foreach="blog_posts" t-as="blog_post" class="mb32"> <t t-if="blog_post.author_avatar"> - <span t-field="blog_post.author_avatar" class="o_not_editable" t-field-options='{"widget": "image", "class": "img-circle pull-right mt16 media-object"}' /> + <span t-field="blog_post.author_avatar" class="o_not_editable" t-options='{"widget": "image", "class": "img-circle pull-right mt16 media-object"}' /> </t> <a t-attf-href="/blog/#{ slug(blog_post.blog_id) }/post/#{ slug(blog_post) }"> <h2 t-field="blog_post.name" class="mb4">Untitled Post</h2> @@ -144,12 +144,12 @@ <div class="text-muted"> <h4 t-field="blog_post.subtitle" class="mb4 mt4"></h4> <div name='blog_post_data' class='mb0'> - <span t-field="blog_post.author_id" style="display: inline-block;" t-field-options='{ + <span t-field="blog_post.author_id" style="display: inline-block;" t-options='{ "widget": "contact", "fields": ["name"] }'/> -   <t t-if="blog_post.published_date"><span t-field="blog_post.published_date" t-field-options='{"format": "MMMM yyyy"}'/></t> - <t t-if="not blog_post.published_date"><span t-field="blog_post.create_date" t-field-options='{"format": "MMMM yyyy"}'/></t> +   <t t-if="blog_post.published_date"><span t-field="blog_post.published_date" t-options='{"format": "MMMM yyyy"}'/></t> + <t t-if="not blog_post.published_date"><span t-field="blog_post.create_date" t-options='{"format": "MMMM yyyy"}'/></t> <span t-if="len(blog_post.message_ids) > 0">   <t t-esc="len(blog_post.message_ids)"/> <t t-if="len(blog_post.message_ids) <= 1" >comment</t> @@ -211,9 +211,9 @@ <p class="post-meta text-muted text-center" name="blog_post_data"/> <div> <t t-if="blog_post.author_avatar"> - <span t-field="blog_post.author_avatar" class="o_not_editable" t-field-options='{"widget": "image", "class": "img-circle", "style":"width: 30px; margin-right: 10px; display:inline"}' /> + <span t-field="blog_post.author_avatar" class="o_not_editable" t-options='{"widget": "image", "class": "img-circle", "style":"width: 30px; margin-right: 10px; display:inline"}' /> </t> - <span t-field="blog_post.author_id" style="display: inline-block;" t-field-options='{ + <span t-field="blog_post.author_id" style="display: inline-block;" t-options='{ "widget": "contact", "fields": ["name"] }'/> @@ -236,9 +236,9 @@ <h2 t-field="next_post.subtitle" placeholder="Subtitle"/> <div> <t t-if="next_post.author_avatar"> - <span t-field="next_post.author_avatar" t-field-options='{"widget": "image", "class": "img-circle", "style":"width: 30px; margin-right: 10px; display:inline"}' /> + <span t-field="next_post.author_avatar" t-options='{"widget": "image", "class": "img-circle", "style":"width: 30px; margin-right: 10px; display:inline"}' /> </t> - <span t-field="next_post.author_id" style="display: inline-block;" t-field-options='{ + <span t-field="next_post.author_id" style="display: inline-block;" t-options='{ "widget": "contact", "fields": ["name"] }'/> diff --git a/addons/website_crm_partner_assign/views/website_crm_partner_assign_templates.xml b/addons/website_crm_partner_assign/views/website_crm_partner_assign_templates.xml index 30bb61b5fb0..86a03328b30 100644 --- a/addons/website_crm_partner_assign/views/website_crm_partner_assign_templates.xml +++ b/addons/website_crm_partner_assign/views/website_crm_partner_assign_templates.xml @@ -90,7 +90,7 @@ <div class="media"> <a class="pull-left" t-attf-href="/partners/#{slug(partner)}?#{current_grade and 'grade_id=%s&' % current_grade.id}#{current_country and 'country_id=%s' % current_country.id}" t-field="partner.image" - t-field-options='{"widget": "image", "class": "media-object", "max_width": 128}' + t-options='{"widget": "image", "class": "media-object", "max_width": 128}' ></a> <div class="media-body o_partner_body" style="min-height: 64px;"> <a class="media-heading" t-attf-href="/partners/#{slug(partner)}?#{current_grade and 'grade_id=%s&' % current_grade.id}#{current_country and 'country_id=%s' % current_country.id}"> @@ -171,7 +171,7 @@ <div t-foreach="partner.implemented_partner_ids" t-as="reference" class="media"> <t t-if="reference.website_published"> <a class="pull-left" t-attf-href="/customers/#{slug(reference)}"> - <span t-field="reference.image_small" t-field-options='{"widget": "image", "class": "center-block"}'/> + <span t-field="reference.image_small" t-options='{"widget": "image", "class": "center-block"}'/> </a> <div class="media-body" style="min-height: 64px;"> <a class="media-heading" t-attf-href="/customers/#{slug(reference)}"> @@ -329,7 +329,7 @@ <a t-attf-href="/my/opportunity/#{opp.id}"><span t-field="opp.name"/></a> </td> <td> - <span class="text-nowrap" t-esc="format(opp.planned_revenue, 'monetary', opp.company_currency)"/> at <span t-field="opp.probability" />% + <span class="text-nowrap" t-esc="opp.planned_revenue" t-options="{'widget': 'monetary', 'display_currency': opp.company_currency}"/> at <span t-field="opp.probability" />% </td> <td><span t-field="opp.contact_name" /></td> <td> @@ -433,7 +433,7 @@ </div> <div class="row mt16" t-if="lead.partner_assigned_id"> <label class="col-xs-4">Assigned Partner</label> - <address class="col-xs-8" t-field="lead.partner_assigned_id" t-field-options='{"widget": "contact", "fields": ["name", "email", "phone"], "no_marker": True}'/> + <address class="col-xs-8" t-field="lead.partner_assigned_id" t-options='{"widget": "contact", "fields": ["name", "email", "phone"], "no_marker": True}'/> </div> <div class="row mt16" t-if="lead.campaign_id"> <label class="col-xs-4">Campaign</label> @@ -559,7 +559,7 @@ </div> <div class="row"> <div class="col-md-4"> - <strong><span class="text-nowrap" t-esc="format(opportunity.planned_revenue, 'monetary', opportunity.company_currency)"/> at <span t-field="opportunity.probability"/>%</strong> + <strong><span class="text-nowrap" t-esc="opportunity.planned_revenue" t-options="{'widget': 'monetary', 'display_currency': opportunity.company_currency}"/> at <span t-field="opportunity.probability"/>%</strong> </div> <div class="col-md-4"> <strong>Expected Closing: <span t-field="opportunity.date_deadline" /></strong> diff --git a/addons/website_customer/views/website_customer.xml b/addons/website_customer/views/website_customer.xml index 9feaaa515a7..1a00d4b96b6 100644 --- a/addons/website_customer/views/website_customer.xml +++ b/addons/website_customer/views/website_customer.xml @@ -45,7 +45,7 @@ <div class="media"> <a class="pull-left" t-attf-href="/customers/#{slug(partner)}" t-field="partner.image_small" - t-field-options='{"widget": "image", "class": "media-object"}' + t-options='{"widget": "image", "class": "media-object"}' ></a> <div class="media-body" style="min-height: 64px;"> <a class="media-heading" t-attf-href="/customers/#{slug(partner)}"> @@ -174,11 +174,11 @@ </h4> <div><a t-attf-href="/partners/#{slug(partner.assigned_partner_id)}" t-field="partner.assigned_partner_id.image_medium" - t-field-options='{"widget": "image", "class": "center-block"}' + t-options='{"widget": "image", "class": "center-block"}' /> </div> <address class="well text-left"> - <div t-field="partner.assigned_partner_id" t-field-options='{ + <div t-field="partner.assigned_partner_id" t-options='{ "widget": "contact", "fields": ["address", "website", "phone", "fax", "email"] }'/> @@ -194,7 +194,7 @@ <div t-foreach="partner.implemented_partner_ids" t-as="reference" class="media"> <t t-if="reference.website_published"> <a class="pull-left" t-attf-href="/customers/#{slug(reference)}"> - <span t-field="reference.image_small" t-field-options='{"widget": "image", "class": "center-block"}'/> + <span t-field="reference.image_small" t-options='{"widget": "image", "class": "center-block"}'/> </a> <div class="media-body" style="min-height: 64px;"> <a class="media-heading" t-attf-href="/customers/#{slug(reference)}"> diff --git a/addons/website_event/views/website_event_templates.xml b/addons/website_event/views/website_event_templates.xml index 4cee5fec02c..92e855004fc 100644 --- a/addons/website_event/views/website_event_templates.xml +++ b/addons/website_event/views/website_event_templates.xml @@ -67,9 +67,9 @@ </t> </div> <div> - <i class="fa fa-clock-o"></i> <span itemprop="startDate" t-field="event.with_context(tz=event.date_tz).date_begin" t-field-options='{"hide_seconds":"True"}'> </span> <i>to</i> <span itemprop="endDate" t-field="event.with_context(tz=event.date_tz).date_end" t-field-options='{"hide_seconds":"True"}'> </span> + <i class="fa fa-clock-o"></i> <span itemprop="startDate" t-field="event.with_context(tz=event.date_tz).date_begin" t-options='{"hide_seconds":"True"}'> </span> <i>to</i> <span itemprop="endDate" t-field="event.with_context(tz=event.date_tz).date_end" t-options='{"hide_seconds":"True"}'> </span> </div> - <div itemprop="location" t-field="event.address_id" t-field-options='{ + <div itemprop="location" t-field="event.address_id" t-options='{ "widget": "contact", "fields": ["city"] }'/> @@ -241,7 +241,7 @@ <h1 class="text-center">Event Location</h1> </section> <h4 class="text-center text-muted" - t-field="event.address_id" t-field-options='{ + t-field="event.address_id" t-options='{ "widget": "contact", "fields": ["address", "phone", "mobile", "fax"] }'/> @@ -272,12 +272,12 @@ <small t-if="event.is_participating" class="label label-info">Participating</small> </div> <h4 class="text-center text-muted"> - <i class="fa fa-clock-o"></i> <span itemprop="startDate" t-field="event.with_context(tz=event.date_tz).date_begin" t-field-options='{"hide_seconds":"True"}'/> to - <span itemprop="endDate" t-field="event.with_context(tz=event.date_tz).date_end" t-field-options='{"hide_seconds":"True"}'/> + <i class="fa fa-clock-o"></i> <span itemprop="startDate" t-field="event.with_context(tz=event.date_tz).date_begin" t-options='{"hide_seconds":"True"}'/> to + <span itemprop="endDate" t-field="event.with_context(tz=event.date_tz).date_end" t-options='{"hide_seconds":"True"}'/> <t t-if="event.date_tz">(<span t-field="event.date_tz"/>)</t> </h4> <h4 class="text-center text-muted" - t-field="event.address_id" t-field-options='{ + t-field="event.address_id" t-options='{ "widget": "contact", "fields": ["city"] }'/> @@ -320,7 +320,7 @@ <t t-raw="comment.body"/> <small class="pull-right muted text-right"> <div t-field="comment.author_id"/> - <div t-field="comment.date" t-field-options='{"hide_seconds":"True"}'/> + <div t-field="comment.date" t-options='{"hide_seconds":"True"}'/> </small> </div> </li> @@ -337,7 +337,7 @@ <a t-att-href="event.google_map_link()" target="_BLANK"> <img t-att-src="event.google_map_img()" width="100%%"/> </a> - <div itemprop="location" class="mt16 mb8" t-field="event.address_id" t-field-options='{ + <div itemprop="location" class="mt16 mb8" t-field="event.address_id" t-options='{ "widget": "contact", "fields": ["address", "phone", "mobile", "fax", "email"] }'/> @@ -349,8 +349,8 @@ <h4>When</h4> </div> <div class="panel-body"> - <i class="fa fa-clock-o"></i> From <span t-field="event.with_context(tz=event.date_tz).date_begin" t-field-options='{"hide_seconds":"True"}'> </span><br/> - <i class="fa fa-clock-o"></i> To <span t-field="event.with_context(tz=event.date_tz).date_end" t-field-options='{"hide_seconds":"True"}'> </span> + <i class="fa fa-clock-o"></i> From <span t-field="event.with_context(tz=event.date_tz).date_begin" t-options='{"hide_seconds":"True"}'> </span><br/> + <i class="fa fa-clock-o"></i> To <span t-field="event.with_context(tz=event.date_tz).date_end" t-options='{"hide_seconds":"True"}'> </span> </div> </div> @@ -358,7 +358,7 @@ <div class="panel-heading"> <h4>Organizer</h4> </div> - <div class="panel-body" t-field="event.organizer_id" t-field-options='{ + <div class="panel-body" t-field="event.organizer_id" t-options='{ "widget": "contact", "fields": ["name", "phone", "mobile", "fax", "email"] }'/> @@ -507,7 +507,7 @@ <div class="col-md-9 mt16"> <h4><a t-attf-href="/event/#{slug(event)}"><t t-esc="event.name"/></a></h4> <i class="fa fa-clock-o"/> <span itemprop="startDate" t-esc="event.date_begin_located[:-3]"> </span> <i>to</i> <span itemprop="endDate" t-esc="event.date_end_located[:-3]"> </span> - <div itemprop="location" class="mt16 mb8" t-field="event.address_id" t-field-options='{ + <div itemprop="location" class="mt16 mb8" t-field="event.address_id" t-options='{ "widget": "contact", "fields": ["address", "phone", "mobile", "fax", "email"] }'/> diff --git a/addons/website_event_sale/views/website_event_sale_templates.xml b/addons/website_event_sale/views/website_event_sale_templates.xml index f4f628bd501..42dcba2a5cf 100644 --- a/addons/website_event_sale/views/website_event_sale_templates.xml +++ b/addons/website_event_sale/views/website_event_sale_templates.xml @@ -38,13 +38,13 @@ <td> <t t-if="ticket.price or editable"> <t t-if="(ticket.price-ticket.price_reduce) > 1"> - <del class="text-danger mr4" style="white-space: nowrap;" t-field="ticket.price" t-field-options='{ + <del class="text-danger mr4" style="white-space: nowrap;" t-field="ticket.price" t-options='{ "widget": "monetary", "from_currency": website.currency_id, "display_currency": user_id.partner_id.property_product_pricelist.currency_id }'/> </t> - <span t-field="ticket.price_reduce" t-field-options='{ + <span t-field="ticket.price_reduce" t-options='{ "widget": "monetary", "display_currency": website.pricelist_id.currency_id }'/> diff --git a/addons/website_event_track/views/website_event_track_templates.xml b/addons/website_event_track/views/website_event_track_templates.xml index cb90dfb474c..6c29823959d 100644 --- a/addons/website_event_track/views/website_event_track_templates.xml +++ b/addons/website_event_track/views/website_event_track_templates.xml @@ -19,7 +19,7 @@ <t t-if="sponsor.url"> <a t-att-href="sponsor.url" style="position: relative; display: inline-block;"> <span t-field="sponsor.image_medium" - t-field-options='{"widget": "image", "class": "shadow"}'/> + t-options='{"widget": "image", "class": "shadow"}'/> <div class="ribbon-wrapper"> <div t-field="sponsor.sponsor_type_id" t-attf-class="ribbon ribbon_#{sponsor.sponsor_type_id.name}"/> </div> @@ -28,7 +28,7 @@ <t t-if="not sponsor.url"> <span style="position: relative; display: inline-block;"> <span t-field="sponsor.image_medium" - t-field-options='{"widget": "image", "class": "shadow"}'/> + t-options='{"widget": "image", "class": "shadow"}'/> <div class="ribbon-wrapper"> <div t-field="sponsor.sponsor_type_id" t-attf-class="ribbon ribbon_#{sponsor.sponsor_type_id.name}"/> </div> @@ -120,7 +120,7 @@ <div class="col-sm-2"> <t t-if="track.image"> <span t-field="track.image" - t-field-options='{"widget": "image", "class": "img-circle"}'/> + t-options='{"widget": "image", "class": "img-circle"}'/> </t> </div> <div class="col-sm-10"> @@ -132,7 +132,7 @@ <li t-if="track.speaker_ids" class="text-muted fa fa-user"> <t t-esc="', '.join([speaker.name for speaker in track.speaker_ids])"></t> </li> - <li t-if="track.date" class="text-muted fa fa-calendar"> <span t-field="track.date" t-field-options='{"hide_seconds":"True"}'/></li> + <li t-if="track.date" class="text-muted fa fa-calendar"> <span t-field="track.date" t-options='{"hide_seconds":"True"}'/></li> <li class="text-muted fa fa-map-marker" t-if="track.location_id"> <span t-field="track.location_id"/> </li> @@ -228,7 +228,7 @@ <div class="row"> <div class="col-sm-2"> <span t-field="speaker.sudo().image_medium" - t-field-options='{"widget": "image", "class": "img-circle"}'/> + t-options='{"widget": "image", "class": "img-circle"}'/> </div><div class="col-sm-10"> <h4 t-field="speaker.name" class="mb4"/> <div class="fa fa-home mb16" t-if="speaker.website"> @@ -246,9 +246,9 @@ </div> <div class="panel-body"> <b>Date</b><br/> - <span t-field="track.date" t-field-options='{"hide_seconds":"True"}'/><br/> + <span t-field="track.date" t-options='{"hide_seconds":"True"}'/><br/> <b>Duration</b><br/> - <span t-field="track.duration" t-field-options='{"widget": "duration", "unit": "hour"}'/><br/> + <span t-field="track.duration" t-options='{"widget": "duration", "unit": "hour"}'/><br/> <b>Location</b><br/> <span t-field="track.location_id"/><br/> </div> diff --git a/addons/website_forum/views/website_forum.xml b/addons/website_forum/views/website_forum.xml index 8319bc60c39..0b82bb9019c 100644 --- a/addons/website_forum/views/website_forum.xml +++ b/addons/website_forum/views/website_forum.xml @@ -201,12 +201,12 @@ </div> <div class="panel-body"> <table class="table"> - <thead><tr><td> Asked: <strong><span t-field="question.create_date" t-field-options='{"format":"short"}'/></strong></td></tr></thead> + <thead><tr><td> Asked: <strong><span t-field="question.create_date" t-options='{"format":"short"}'/></strong></td></tr></thead> <tr><td> Seen: <strong><t t-raw="question.views"/></strong> <span t-if="question.views>1"> times</span> <span t-if="question.views<=1"> time</span> </td></tr> - <tr><td> Last updated: <strong><span t-field="question.write_date" t-field-options='{"format":"short"}'/></strong></td></tr> + <tr><td> Last updated: <strong><span t-field="question.write_date" t-options='{"format":"short"}'/></strong></td></tr> </table> </div> </div> @@ -252,8 +252,8 @@ <i t-if="question.post_type == 'question'" t-attf-class="fa fa-question-circle" t-att-title="question.post_type.capitalize()" /> <i t-if="question.post_type == 'discussion'" t-attf-class="fa fa-comments-o" t-att-title="question.post_type.capitalize()" /> <i t-if="question.post_type == 'link'" t-attf-class="fa fa-link" t-att-title="question.post_type.capitalize()" /> - <span>By </span><span t-field="question.create_uid" t-field-options='{"widget": "contact", "country_image": True, "fields": ["name", "country_id"]}' style="display: inline-block;"/> - <span> • </span><span t-field="question.write_date" t-field-options='{"format":"short"}'/> + <span>By </span><span t-field="question.create_uid" t-options='{"widget": "contact", "country_image": True, "fields": ["name", "country_id"]}' style="display: inline-block;"/> + <span> • </span><span t-field="question.write_date" t-options='{"format":"short"}'/> <span> • </span><span t-field="question.views" /> View<t t-if="question.views>1">s</t> <span> • </span><a t-attf-href="/forum/#{ slug(forum) }/question/#{ slug(question) }"> @@ -782,9 +782,9 @@ <span>By </span> <a t-att-href="(question.create_uid.id == request.session.uid or question.create_uid.sudo().website_published) and '/forum/%s/user/%s' % (slug(forum), question.create_uid.id) or None" t-field="question.create_uid" - t-field-options='{"widget": "contact", "country_image": True, "fields": ["name", "country_id"]}' + t-options='{"widget": "contact", "country_image": True, "fields": ["name", "country_id"]}' style="display: inline-block;"/> - <span> on </span><span t-field="question.create_date" t-field-options='{"format":"short"}'/> + <span> on </span><span t-field="question.create_date" t-options='{"format":"short"}'/> <span> • </span><span t-field="question.views"/> views </div> @@ -795,7 +795,7 @@ <t t-if="question.closed_uid"> <b> by <a t-attf-href="/forum/#{ slug(forum) }/user/#{ question.closed_uid.id }" t-field="question.closed_uid" - t-field-options='{"widget": "contact", "fields": ["name"]}' + t-options='{"widget": "contact", "fields": ["name"]}' style="display: inline-block;"/></b> </t> <b> on <span t-field="question.closed_date"/></b> @@ -940,11 +940,11 @@ </a> <a t-att-href="user_profile_url" t-field="answer.create_uid" - t-field-options='{"widget": "contact", "country_image": True, "fields": ["name", "country_id"]}' + t-options='{"widget": "contact", "country_image": True, "fields": ["name", "country_id"]}' style="display: inline-block;"/> <div class="text-muted"> <a t-attf-href="/forum/#{slug(question.forum_id)}/question/#{slug(question)}#answer_#{answer.id}">On</a> - <span t-field="answer.create_date" t-field-options='{"format":"short"}'/> + <span t-field="answer.create_date" t-options='{"format":"short"}'/> </div> </div> <div class="clearfix"><span t-field="answer.content" class="oe_no_empty"/></div> @@ -1028,12 +1028,12 @@ <div class="o_forum_tooltip_header"> <h4 class="o_forum_tooltip_heading"><a t-att-href="user_profile_url" t-field="answer.create_uid" - t-field-options='{"widget": "contact", "country_image": True, "fields": ["name", "country_id"]}' + t-options='{"widget": "contact", "country_image": True, "fields": ["name", "country_id"]}' style="display: inline-block;"/> </h4> - <span t-field="answer.create_uid" t-field-options='{"widget": "contact", "UserBio": True, "badges": True, "fields": ["karma"]}'/> + <span t-field="answer.create_uid" t-options='{"widget": "contact", "UserBio": True, "badges": True, "fields": ["karma"]}'/> </div> - <div t-field="answer.create_uid" t-field-options='{"widget": "contact", "website_description": True, "fields": ["partner_id"]}'/> + <div t-field="answer.create_uid" t-options='{"widget": "contact", "website_description": True, "fields": ["partner_id"]}'/> </div> </template> @@ -1065,9 +1065,9 @@ </t> </t> <a t-attf-href="/forum/#{slug(forum)}/partner/#{message.author_id.id}" - t-field="message.author_id" t-field-options='{"widget": "contact", "country_image": True, "fields": ["name", "country_id"]}' + t-field="message.author_id" t-options='{"widget": "contact", "country_image": True, "fields": ["name", "country_id"]}' style="display: inline-block;"/> - on <span t-field="message.date" t-field-options='{"format":"short"}'/> + on <span t-field="message.date" t-options='{"format":"short"}'/> </small> </div> <div class="css_editable_mode_hidden"> @@ -1214,7 +1214,7 @@ <div> <a t-attf-href="/forum/#{slug(forum)}/user/#{user.id}" t-field="user.name"/> <t t-if="user.country_id"> - <span t-field="user.country_id.image" t-field-options='{"widget": "image", "class": "country_flag"}' class='ml4'/> + <span t-field="user.country_id.image" t-options='{"widget": "image", "class": "country_flag"}' class='ml4'/> </t> <b class='ml8'><t t-esc="user.karma"/></b> <t t-raw="separator"/> @@ -1355,10 +1355,10 @@ </tr> <tr> <td>member since</td> - <td><span t-field="user.create_date" t-field-options='{"format": "short"}'/></td> + <td><span t-field="user.create_date" t-options='{"format": "short"}'/></td> </tr><tr> <td>last connection</td> - <td><span t-field="user.login_date" t-field-options='{"format": "short"}'/></td> + <td><span t-field="user.login_date" t-options='{"format": "short"}'/></td> </tr> <tr> <td rowspan="2" valign="top"><span class="text-muted">bio</span></td> @@ -1374,7 +1374,7 @@ <span t-field="user.city"/> <span t-if="user.city and user.country_id">, </span> <span t-field="user.country_id"/> - <t t-if="user.country_id"> <span t-field="user.country_id.image" t-field-options='{"widget": "image", "class": "country_flag"}'/></t> + <t t-if="user.country_id"> <span t-field="user.country_id.image" t-options='{"widget": "image", "class": "country_flag"}'/></t> </td> </tr> @@ -1443,7 +1443,7 @@ <div class="tab-pane" id="activity" t-if="uid == user.id"> <ul class="list-unstyled"> <li t-foreach="activities" t-as="activity"> - <span t-field="activity.date" t-field-options='{"format": "short"}'/> + <span t-field="activity.date" t-options='{"format": "short"}'/> <span t-esc="activity.subtype_id.name" class="label label-info"/> <t t-set="post" t-value="posts[activity.res_id]"/> <span t-if="post[1]"> diff --git a/addons/website_hr_recruitment/views/templates.xml b/addons/website_hr_recruitment/views/templates.xml index 5adf0751c79..09ac1c2f3ad 100644 --- a/addons/website_hr_recruitment/views/templates.xml +++ b/addons/website_hr_recruitment/views/templates.xml @@ -67,7 +67,7 @@ </small> </h3> - <span t-field="job.address_id" t-field-options='{ + <span t-field="job.address_id" t-options='{ "widget": "contact", "fields": ["address"], "no_tag_br": True @@ -110,7 +110,7 @@ <div class="oe_structure" style="clear:both;"> <h1 class="text-center" t-field="job.name"/> - <h5 class="text-center" t-field="job.address_id" t-field-options='{ + <h5 class="text-center" t-field="job.address_id" t-options='{ "widget": "contact", "fields": ["address"], "no_tag_br": True diff --git a/addons/website_mail_channel/views/website_mail_channel_templates.xml b/addons/website_mail_channel/views/website_mail_channel_templates.xml index dfbebe1f4fe..f773dfe3623 100644 --- a/addons/website_mail_channel/views/website_mail_channel_templates.xml +++ b/addons/website_mail_channel/views/website_mail_channel_templates.xml @@ -209,7 +209,7 @@ <small> by <t t-if="message.author_id"> - <span t-field="message.author_id" style="display: inline-block;" t-field-options='{ + <span t-field="message.author_id" style="display: inline-block;" t-options='{ "widget": "contact", "fields": ["name"] }'/> @@ -272,7 +272,7 @@ <small> by <t t-if="thread.author_id"> - <span t-field="thread.author_id" style="display: inline-block;" t-field-options='{ + <span t-field="thread.author_id" style="display: inline-block;" t-options='{ "widget": "contact", "fields": ["name"] }'/> diff --git a/addons/website_membership/views/website_membership.xml b/addons/website_membership/views/website_membership.xml index cd34d1214bf..40e84628b2f 100644 --- a/addons/website_membership/views/website_membership.xml +++ b/addons/website_membership/views/website_membership.xml @@ -62,7 +62,7 @@ <div class="media"> <a class="pull-left" t-attf-href="/members/#{slug(partner)}" t-field="partner.image_small" - t-field-options='{"widget": "image", "class": "media-object"}' + t-options='{"widget": "image", "class": "media-object"}' ></a> <div class="media-body" style="min-height: 64px;"> <a class="media-heading" t-attf-href="/members/#{slug(partner)}"> diff --git a/addons/website_partner/views/website_partner_templates.xml b/addons/website_partner/views/website_partner_templates.xml index 0bcdc93396d..2d975074dff 100644 --- a/addons/website_partner/views/website_partner_templates.xml +++ b/addons/website_partner/views/website_partner_templates.xml @@ -21,9 +21,9 @@ </t> <h1 class="col-md-12 text-center" id="partner_name" t-field="partner.display_name"/> <div class="col-md-4"> - <div t-field="partner.image" t-field-options='{"widget": "image", "class": "center-block mb16"}'/> + <div t-field="partner.image" t-options='{"widget": "image", "class": "center-block mb16"}'/> <address class="well"> - <div t-field="partner.self" t-field-options='{ + <div t-field="partner.self" t-options='{ "widget": "contact", "fields": ["address", "website", "phone", "fax", "email"] }'/> diff --git a/addons/website_payment/views/website_payment_templates.xml b/addons/website_payment/views/website_payment_templates.xml index ec22377e7e1..282ac70c3f8 100644 --- a/addons/website_payment/views/website_payment_templates.xml +++ b/addons/website_payment/views/website_payment_templates.xml @@ -104,7 +104,7 @@ <div class="form-group"> <label for="form_amount" class="col-sm-3 control-label">Amount</label> <div class="col-sm-9"> - <span name="form_amount" class="form-control" t-esc="format(amount, 'monetary', currency)"/> + <span name="form_amount" class="form-control" t-esc="amount" t-options="{'widget': 'monetary', 'display_currency': currency}"/> </div> </div> <div class="col-sm-9 col-sm-offset-3 text-muted mt16" t-raw="acquirer.pre_msg"/> @@ -148,7 +148,7 @@ <div class="form-group"> <label for="form_amount" class="col-sm-3 control-label">Amount</label> <div class="col-sm-9"> - <span name="form_amount" class="form-control" t-esc="format(tx.amount, 'monetary', tx.currency_id)"/> + <span name="form_amount" class="form-control" t-esc="tx.amount" t-options="{'widget': 'monetary', 'display_currency': tx.currency_id}"/> </div> </div> <div class="col-sm-12"> diff --git a/addons/website_portal/views/templates.xml b/addons/website_portal/views/templates.xml index 3c6e70b78aa..517a75d29e0 100644 --- a/addons/website_portal/views/templates.xml +++ b/addons/website_portal/views/templates.xml @@ -57,7 +57,7 @@ </div> <div class="o_my_details"> <h3 class="page-header">Your Details <a href="/my/account" class="btn btn-default btn-xs">Change</a></h3> - <div t-field="user.partner_id" t-field-options='{"widget": "contact", "fields": ["email", "phone", "address", "name"]}'/> + <div t-field="user.partner_id" t-options='{"widget": "contact", "fields": ["email", "phone", "address", "name"]}'/> </div> <div class="o_my_archives" t-if="archive_groups"> <t t-call="website_portal.portal_archive_groups"/> diff --git a/addons/website_portal_sale/views/templates.xml b/addons/website_portal_sale/views/templates.xml index 9ca9608d840..de449b76de8 100644 --- a/addons/website_portal_sale/views/templates.xml +++ b/addons/website_portal_sale/views/templates.xml @@ -91,7 +91,7 @@ <span class="label label-default"><i class="fa fa-fw fa-clock-o"/> Expired</span> </t> </td> - <td><span t-field="quotation.amount_total" t-field-options='{"widget": "monetary", "display_currency": quotation.pricelist_id.currency_id}'/> + <td><span t-field="quotation.amount_total" t-options='{"widget": "monetary", "display_currency": quotation.pricelist_id.currency_id}'/> </td> </tr> </t> @@ -136,7 +136,7 @@ <span class="label label-default"><i class="fa fa-fw fa-check"/> Done</span> </t> </td> - <td><span t-field="order.amount_total" t-field-options='{"widget": "monetary", "display_currency": order.pricelist_id.currency_id}'/></td> + <td><span t-field="order.amount_total" t-options='{"widget": "monetary", "display_currency": order.pricelist_id.currency_id}'/></td> </tr> </t> </table> @@ -186,7 +186,7 @@ <td> <a t-if="invoice.state == 'open'" t-attf-href="/website_payment/pay?reference=#{invoice.number}&amount=#{invoice.residual}&currency_id=#{invoice.currency_id.id}&country_id=#{invoice.partner_id.country_id.id}" alt="Pay Now" class="btn btn-xs btn-primary"><i class="fa fa-arrow-circle-right"/> Pay Now</a> </td> - <td><span t-field="invoice.residual" t-field-options='{"widget": "monetary", "display_currency": invoice.currency_id}'/></td> + <td><span t-field="invoice.residual" t-options='{"widget": "monetary", "display_currency": invoice.currency_id}'/></td> </tr> </t> </table> @@ -251,7 +251,7 @@ <div class="panel-body"> <!-- <hr/> --> <div class="mb8"> - <strong>Date:</strong> <span t-field="order.create_date" t-field-options='{"widget": "date"}'/> + <strong>Date:</strong> <span t-field="order.create_date" t-options='{"widget": "date"}'/> </div> <div class='row'> <div class="col-md-6"> @@ -259,7 +259,7 @@ <strong>Invoicing Address</strong> </div> <div> - <address t-field="order.partner_invoice_id" t-field-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}'/> + <address t-field="order.partner_invoice_id" t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}'/> </div> <t t-set="invoices" t-value="[i for i in order.invoice_ids if i.state not in ['draft', 'cancel']]"/> <t t-if="invoices"> @@ -289,7 +289,7 @@ <strong>Shipping Address</strong> </div> <div> - <address t-field="order.partner_shipping_id" t-field-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}'/> + <address t-field="order.partner_shipping_id" t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}'/> </div> </div> </div> @@ -319,7 +319,7 @@ <span t-esc="ol.product_id.name"/> </div> <div class="col-md-2 text-right"> - <span t-field="ol.price_unit" t-field-options='{"widget": "monetary", "display_currency": order.pricelist_id.currency_id}'/> + <span t-field="ol.price_unit" t-options='{"widget": "monetary", "display_currency": order.pricelist_id.currency_id}'/> </div> <div class="col-md-2 text-right"> <t t-if="ol._name == 'sale.order.line'"> @@ -330,7 +330,7 @@ </t> </div> <div class="col-md-2 text-right"> - <span t-field="ol.price_subtotal" t-field-options='{"widget": "monetary", "display_currency": order.pricelist_id.currency_id}'/> + <span t-field="ol.price_subtotal" t-options='{"widget": "monetary", "display_currency": order.pricelist_id.currency_id}'/> </div> </div> </t> @@ -342,7 +342,7 @@ <div> <strong>Contact</strong> </div> - <div t-field="order.user_id.partner_id" t-field-options='{"widget": "contact", "fields": ["email", "phone"]}'/> + <div t-field="order.user_id.partner_id" t-options='{"widget": "contact", "fields": ["email", "phone"]}'/> </div> <div class="col-md-6"> <div class="row"> @@ -350,7 +350,7 @@ Untaxed Amount: </div> <div class="col-md-2 text-right"> - <span t-field="order.amount_untaxed" t-field-options='{"widget": "monetary", "display_currency": order.pricelist_id.currency_id}'/> + <span t-field="order.amount_untaxed" t-options='{"widget": "monetary", "display_currency": order.pricelist_id.currency_id}'/> </div> </div> <div class="row"> @@ -358,7 +358,7 @@ Taxes: </div> <div class="col-md-2 text-right"> - <span t-field="order.amount_tax" t-field-options='{"widget": "monetary", "display_currency": order.pricelist_id.currency_id}'/> + <span t-field="order.amount_tax" t-options='{"widget": "monetary", "display_currency": order.pricelist_id.currency_id}'/> </div> </div> <div class="row"> @@ -366,7 +366,7 @@ <strong>Total:</strong> </div> <div class="col-md-2 text-right"> - <strong><span t-field="order.amount_total" t-field-options='{"widget": "monetary", "display_currency": order.pricelist_id.currency_id}'/></strong> + <strong><span t-field="order.amount_total" t-options='{"widget": "monetary", "display_currency": order.pricelist_id.currency_id}'/></strong> </div> </div> </div> diff --git a/addons/website_project_issue/views/project_issue_templates.xml b/addons/website_project_issue/views/project_issue_templates.xml index e7e88b05930..a0bdc8338a1 100644 --- a/addons/website_project_issue/views/project_issue_templates.xml +++ b/addons/website_project_issue/views/project_issue_templates.xml @@ -88,19 +88,19 @@ </div> <div class="panel-body"> <div class="mb8"> - <strong>Date:</strong> <span t-field="issue.create_date" t-field-options='{"widget": "date"}'/> + <strong>Date:</strong> <span t-field="issue.create_date" t-options='{"widget": "date"}'/> </div> <div class='row'> <div class="col-md-6" t-if="issue.user_id"> <strong>Assigned to</strong> <div> - <address t-field="issue.user_id" t-field-options='{"widget": "contact", "fields": ["name", "email", "phone"], "no_marker": True}'/> + <address t-field="issue.user_id" t-options='{"widget": "contact", "fields": ["name", "email", "phone"], "no_marker": True}'/> </div> </div> <div class="col-md-6"> <strong>Reported by</strong> <div t-if="issue.partner_id"> - <address t-field="issue.partner_id" t-field-options='{"widget": "contact", "fields": ["name", "email"], "no_marker": True}'/> + <address t-field="issue.partner_id" t-options='{"widget": "contact", "fields": ["name", "email"], "no_marker": True}'/> </div> </div> </div> diff --git a/addons/website_project_issue_sheet/views/project_issue_templates.xml b/addons/website_project_issue_sheet/views/project_issue_templates.xml index 4c27cd4b171..b3ff8ec7c4b 100644 --- a/addons/website_project_issue_sheet/views/project_issue_templates.xml +++ b/addons/website_project_issue_sheet/views/project_issue_templates.xml @@ -17,7 +17,7 @@ <td><span t-esc="timesheet.date"/></td> <td><span t-esc="timesheet.name"/></td> <td><span t-esc="timesheet.user_id.name"/></td> - <td><span t-field="timesheet.unit_amount" t-field-options='{"widget": "duration", "unit": "hour"}'/></td> + <td><span t-field="timesheet.unit_amount" t-options='{"widget": "duration", "unit": "hour"}'/></td> </tr> </table> </t> diff --git a/addons/website_quote/views/report_saleorder.xml b/addons/website_quote/views/report_saleorder.xml index 1a2ad2606b5..b0bfcbdb5a1 100644 --- a/addons/website_quote/views/report_saleorder.xml +++ b/addons/website_quote/views/report_saleorder.xml @@ -38,7 +38,7 @@ <td> <strong class="text-right"> <div t-field="option.price_unit" - t-field-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}' + t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}' t-att-style="option.discount and 'text-decoration: line-through' or None" t-att-class="option.discount and 'text-danger' or None"/> <div t-if="option.discount"> diff --git a/addons/website_quote/views/website_quotation.xml b/addons/website_quote/views/website_quotation.xml index 1e7cb4d1ec1..343e737a734 100644 --- a/addons/website_quote/views/website_quotation.xml +++ b/addons/website_quote/views/website_quotation.xml @@ -62,7 +62,7 @@ </td> <td class="text-right"> <div t-field="line.price_unit" - t-field-options='{"widget": "monetary", "display_currency": quotation.pricelist_id.currency_id}' + t-options='{"widget": "monetary", "display_currency": quotation.pricelist_id.currency_id}' t-att-style="line.discount and 'text-decoration: line-through' or None" t-att-class="(line.discount and 'text-danger' or '') + ' text-right'"/> <!-- TODO: apply monetary widget formating --> @@ -72,11 +72,11 @@ </td> <td class="text-right" groups="sale.group_show_price_subtotal"> <span t-field="line.price_subtotal" - t-field-options='{"widget": "monetary", "display_currency": quotation.pricelist_id.currency_id}'/> + t-options='{"widget": "monetary", "display_currency": quotation.pricelist_id.currency_id}'/> </td> <td class="text-right" groups="sale.group_show_price_total"> <span t-field="line.price_total" - t-field-options='{"widget": "monetary", "display_currency": quotation.pricelist_id.currency_id}'/> + t-options='{"widget": "monetary", "display_currency": quotation.pricelist_id.currency_id}'/> </td> <td class="text-center"> <a t-attf-href="./update_line/#{ line.id }/?order_id=#{ quotation.id }&unlink=True&token=#{ quotation.access_token }" class="mb8 js_update_line_json hidden-print" t-if="line.option_line_id"> @@ -92,7 +92,7 @@ <td class="text-right" style="padding-bottom: 32px"><strong>Subtotal:</strong></td> <td class="text-right" style="padding-bottom: 32px"> <t t-set="subtotal" t-value="sum(line.price_subtotal for line in layout_category['lines'])"/> - <strong data-id="total_amount" t-esc="format(subtotal, 'monetary', quotation.pricelist_id.currency_id)"/> + <strong data-id="total_amount" t-esc="subtotal" t-options="{'widget': 'monetary', 'display_currency': quotation.pricelist_id.currency_id}"/> </td> <td></td> </tr> @@ -103,7 +103,7 @@ <td></td><td></td><td></td><td></td> <td class="text-right"><strong>Subtotal:</strong></td> <td class="text-right"> - <strong data-id="total_amount" t-field="quotation.amount_untaxed" t-field-options='{"widget": "monetary","display_currency": quotation.pricelist_id.currency_id}'/> + <strong data-id="total_amount" t-field="quotation.amount_untaxed" t-options='{"widget": "monetary","display_currency": quotation.pricelist_id.currency_id}'/> </td> <td></td> </tr> @@ -112,7 +112,7 @@ <td></td><td></td><td></td><td></td> <td class="text-right">Taxes:</td> <td class="text-right"> - <span data-id="total_amount" t-field="quotation.amount_tax" t-field-options='{"widget": "monetary","display_currency": quotation.pricelist_id.currency_id}'/> + <span data-id="total_amount" t-field="quotation.amount_tax" t-options='{"widget": "monetary","display_currency": quotation.pricelist_id.currency_id}'/> </td> <td></td> </tr> @@ -120,7 +120,7 @@ <td></td><td></td><td></td><td></td> <td class="text-right"><strong>Total:</strong></td> <td class="text-right"> - <strong data-id="total_amount" t-field="quotation.amount_total" t-field-options='{"widget": "monetary","display_currency": quotation.pricelist_id.currency_id}'/> + <strong data-id="total_amount" t-field="quotation.amount_total" t-options='{"widget": "monetary","display_currency": quotation.pricelist_id.currency_id}'/> </td> <td></td> </tr> @@ -224,22 +224,22 @@ <p class="text-muted mb8">Your advantage:</p> <t t-if="quotation.amount_untaxed == quotation.amount_total"> <strong t-field="quotation.amount_total" - t-field-options='{"widget": "monetary", "display_currency": quotation.pricelist_id.currency_id}'/> + t-options='{"widget": "monetary", "display_currency": quotation.pricelist_id.currency_id}'/> <strong t-field="quotation.amount_undiscounted" - t-field-options='{"widget": "monetary", "display_currency": quotation.pricelist_id.currency_id}' + t-options='{"widget": "monetary", "display_currency": quotation.pricelist_id.currency_id}' style="text-decoration: line-through" class="text-danger"/> </t> <t t-if="quotation.amount_untaxed != quotation.amount_total"> <strong t-field="quotation.amount_untaxed" - t-field-options='{"widget": "monetary", "display_currency": quotation.pricelist_id.currency_id}'/> + t-options='{"widget": "monetary", "display_currency": quotation.pricelist_id.currency_id}'/> <strong t-field="quotation.amount_undiscounted" - t-field-options='{"widget": "monetary", "display_currency": quotation.pricelist_id.currency_id}' + t-options='{"widget": "monetary", "display_currency": quotation.pricelist_id.currency_id}' style="text-decoration: line-through" class="text-danger"/> <br /> (<span t-field="quotation.amount_total" - t-field-options='{"widget": "monetary", "display_currency": quotation.pricelist_id.currency_id}'/> Incl. tax) + t-options='{"widget": "monetary", "display_currency": quotation.pricelist_id.currency_id}'/> Incl. tax) </t> </div> </div> @@ -296,7 +296,7 @@ <span>I agree that by signing this proposal, I accept it on the behalf of </span><b t-field="quotation.company_id"/><span>, for an amount of </span> <b data-id="total_amount" t-field="quotation.amount_total" - t-field-options='{"widget": "monetary", "display_currency": quotation.pricelist_id.currency_id}'/> + t-options='{"widget": "monetary", "display_currency": quotation.pricelist_id.currency_id}'/> <span>with payment terms: </span><b t-field="quotation.payment_term_id"/>. </p> <div id="signer" class="form-group"> @@ -323,7 +323,7 @@ <span>I agree that by paying this proposal, I accept it on the behalf of </span><b t-field="quotation.company_id"/><span>, for an amount of </span> <b data-id="total_amount" t-field="quotation.amount_total" - t-field-options='{"widget": "monetary", "display_currency": quotation.pricelist_id.currency_id}'/> + t-options='{"widget": "monetary", "display_currency": quotation.pricelist_id.currency_id}'/> <span>with payment terms: </span><b t-field="quotation.payment_term_id"/>. </p> </div> @@ -474,7 +474,7 @@ <div class="row"> <label class="col-sm-4 col-xs-4 text-right">Bill To:</label> <div class="col-sm-8 col-xs-8"> - <div t-field="quotation.partner_invoice_id" t-field-options='{ + <div t-field="quotation.partner_invoice_id" t-options='{ "widget": "contact", "fields": ["address", "name", "phone", "email"] }'/> @@ -483,7 +483,7 @@ <div t-if="quotation.partner_shipping_id.id != quotation.partner_invoice_id.id" class="row"> <label class="col-sm-4 col-xs-4 text-right">Ship To:</label> <div class="col-sm-8 col-xs-8"> - <div t-field="quotation.partner_shipping_id" t-field-options='{ + <div t-field="quotation.partner_shipping_id" t-options='{ "widget": "contact", "fields": ["address", "name", "phone"] }'/> @@ -494,7 +494,7 @@ <div class="row"> <label class="col-sm-5 col-xs-5 text-right">Your Contact:</label> <div class="col-sm-7 col-xs-7"> - <div t-field="quotation.user_id" t-field-options='{ + <div t-field="quotation.user_id" t-options='{ "widget": "contact", "fields": ["name", "phone", "email"] }'/> @@ -591,7 +591,7 @@ <td> <strong class="text-right"> <div t-field="option.price_unit" - t-field-options='{"widget": "monetary", "display_currency": quotation.pricelist_id.currency_id}' + t-options='{"widget": "monetary", "display_currency": quotation.pricelist_id.currency_id}' t-att-style="option.discount and 'text-decoration: line-through' or None" t-att-class="option.discount and 'text-danger' or None"/> <div t-if="option.discount"> @@ -703,7 +703,7 @@ <span class="label label-default"><i class="fa fa-fw fa-clock-o"/> Expired</span> </t> </td> - <td><span t-field="quotation.amount_total" t-field-options='{"widget": "monetary", "display_currency": quotation.pricelist_id.currency_id}'/> + <td><span t-field="quotation.amount_total" t-options='{"widget": "monetary", "display_currency": quotation.pricelist_id.currency_id}'/> </td> </tr> </t> diff --git a/addons/website_sale/views/report_shop_saleorder.xml b/addons/website_sale/views/report_shop_saleorder.xml index 6c0954f6c20..e6ea9306f0d 100644 --- a/addons/website_sale/views/report_shop_saleorder.xml +++ b/addons/website_sale/views/report_shop_saleorder.xml @@ -35,7 +35,7 @@ </td> <td class="text-right"> <span t-field="doc.amount_total" - t-field-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/> + t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/> </td> </tr> </tbody> diff --git a/addons/website_sale/views/templates.xml b/addons/website_sale/views/templates.xml index 7234b30e927..ee64dadd3aa 100644 --- a/addons/website_sale/views/templates.xml +++ b/addons/website_sale/views/templates.xml @@ -76,7 +76,7 @@ </div> <div class="oe_product_image"> <a itemprop="url" t-att-href="keep('/shop/product/%s' % slug(product), page=(pager['page']['num'] if pager['page']['num']>1 else None))"> - <span itemprop="image" t-field="product.image" t-field-options="{'widget': 'image', 'resize': None if product_image_big else '300x300'}" t-att-alt="product.name" /> + <span itemprop="image" t-field="product.image" t-options="{'widget': 'image', 'resize': None if product_image_big else '300x300'}" t-att-alt="product.name" /> </a> </div> <t t-if="show_publish"> @@ -97,9 +97,9 @@ <div itemprop="offers" itemscope="itemscope" itemtype="http://schema.org/Offer" class="product_price" t-if="product.product_variant_ids"> <b> <t t-if="(compute_currency(product.lst_price) - product.price ) > 0.1"> - <del class="text-danger mr8" style="white-space: nowrap;" t-esc="format(compute_currency(request.website.get_product_price(product, public=True)), 'monetary', website.get_current_pricelist().currency_id, website.currency_id)" /> + <del class="text-danger mr8" style="white-space: nowrap;" t-esc="compute_currency(request.website.get_product_price(product, public=True))" t-options="{'widget': 'monetary', 'display_currency': website.get_current_pricelist().currency_id, 'from_currency': website.currency_id}" /> </t> - <span t-esc="format(request.website.get_product_price(product), 'monetary', website.currency_id)" /> + <span t-esc="request.website.get_product_price(product)" t-options="{'widget': 'monetary', 'display_currency': website.currency_id}" /> <span itemprop="price" style="display:none;" t-esc="product.price" /> <span itemprop="priceCurrency" style="display:none;" t-esc="website.currency_id.name" /> </b> @@ -366,7 +366,7 @@ </div> <div class="row"> <div class="col-sm-7 col-md-7 col-lg-7"> - <span itemprop="image" t-field="product.image" t-field-options="{'widget': 'image', 'class': 'product_detail_img', 'alt-field': 'name'}" /> + <span itemprop="image" t-field="product.image" t-options="{'widget': 'image', 'class': 'product_detail_img', 'alt-field': 'name'}" /> </div> <div class="col-sm-5 col-md-5 col-lg-4 col-lg-offset-1" id="product_details"> <h1 itemprop="name" t-field="product.name">Product Name</h1> @@ -420,7 +420,7 @@ <t t-foreach="product.alternative_product_ids" t-as="alt_product"> <div class="col-md-2 thumbnail" style="width: 170px; height:130px; float:left; display:inline; margin-right: 10px; overflow:hidden;"> <div class="mt16 text-center" style="height: 100%;"> - <div t-field="alt_product.image_small" t-field-options="{'widget': 'image', 'class': 'img-rounded shadow o_alternative_product' }" /> + <div t-field="alt_product.image_small" t-options="{'widget': 'image', 'class': 'img-rounded shadow o_alternative_product' }" /> <h5> <a t-attf-href="/shop/product/#{ slug(alt_product) }" style="display: block"> <span t-att-title="alt_product.name" t-field="alt_product.name" style="display: block;" /> @@ -495,16 +495,16 @@ <div itemprop="offers" itemscope="itemscope" itemtype="http://schema.org/Offer" class="product_price mt16"> <h4 class="oe_price_h4 css_editable_mode_hidden"> <span class="text-danger oe_default_price" style="text-decoration: line-through; white-space: nowrap;" - t-esc="format(compute_currency(request.website.get_product_price(product, public=True)), 'monetary', website.get_current_pricelist().currency_id, website.currency_id)" + t-esc="compute_currency(request.website.get_product_price(product, public=True))" t-options="{'widget': 'monetary', 'display_currency': website.get_current_pricelist().currency_id, 'from_currency': website.currency_id}" /> - <b class="oe_price" style="white-space: nowrap;" t-esc="format(request.website.get_product_price(product), 'monetary', website.currency_id)"/> + <b class="oe_price" style="white-space: nowrap;" t-esc="request.website.get_product_price(product)" t-options="{'widget': 'monetary', 'display_currency': website.currency_id}"/> <span itemprop="price" style="display:none;" t-esc="product.price"/> <span itemprop="priceCurrency" style="display:none;" t-esc="website.currency_id.name"/> </h4> <h4 class="css_non_editable_mode_hidden"> <!-- keep field for editor --> <span t-field="product.lst_price" - t-field-options='{ + t-options='{ "widget": "monetary", "display_currency": product.currency_id }'/> @@ -524,7 +524,7 @@ <input type="radio" name="product_id" class="js_product_change" t-att-checked="'checked' if variant_id_index == 0 else None" t-att-value="variant_id.id" t-att-data-lst_price="variant_id.lst_price" t-att-data-price="variant_id.price"/> <span t-esc="variant_id.name_get()[0][1]"/> <span class="badge" t-if="variant_id.price_extra"> - <t t-esc="variant_id.price_extra > 0 and '+' or ''"/><span t-field="variant_id.price_extra" style="white-space: nowrap;" t-field-options='{ + <t t-esc="variant_id.price_extra > 0 and '+' or ''"/><span t-field="variant_id.price_extra" style="white-space: nowrap;" t-options='{ "widget": "monetary", "from_currency": product.currency_id, "display_currency": website.currency_id @@ -549,7 +549,7 @@ <option t-att-value="value_id.id"> <span t-field="value_id.name"/> <span t-if="value_id.price_extra"> - <t t-esc="value_id.price_extra > 0 and '+' or ''"/><span t-field="value_id.price_extra" style="white-space: nowrap;" t-field-options='{ + <t t-esc="value_id.price_extra > 0 and '+' or ''"/><span t-field="value_id.price_extra" style="white-space: nowrap;" t-options='{ "widget": "monetary", "from_currency": product.currency_id, "display_currency": website.currency_id @@ -569,7 +569,7 @@ <input type="radio" class="js_variant_change" t-att-checked="'checked' if not inc else None" t-att-name="'attribute-%s-%s' % (product.id, variant_id.attribute_id.id)" t-att-value="value_id.id" style="vertical-align: top; margin-right: 10px;"/> <span t-field="value_id.name"/> <span class="badge" t-if="value_id.price_extra"> - <t t-esc="value_id.price_extra > 0 and '+' or ''"/><span t-field="value_id.price_extra" style="white-space: nowrap;" t-field-options='{ + <t t-esc="value_id.price_extra > 0 and '+' or ''"/><span t-field="value_id.price_extra" style="white-space: nowrap;" t-options='{ "widget": "monetary", "from_currency": product.currency_id, "display_currency": website.currency_id @@ -762,7 +762,7 @@ <tr> <td colspan="2" t-if="not line.product_id.product_tmpl_id"></td> <td align="center" t-if="line.product_id.product_tmpl_id"> - <span t-field="line.product_id.image_small" t-field-options="{'widget': 'image', 'class': 'img-rounded'}" /> + <span t-field="line.product_id.image_small" t-options="{'widget': 'image', 'class': 'img-rounded'}" /> </td> <td t-if="line.product_id.product_tmpl_id"> <div> @@ -786,10 +786,10 @@ </td> <td class="text-center" id="td-price" name="price"> <t t-if="(compute_currency(line.product_id.lst_price) - line.price_reduce ) > 0.1"> - <del class="text-danger mr8" style="white-space: nowrap;" t-esc="format(compute_currency(website.get_product_price(line.product_id, public=True)), 'monetary', website.get_current_pricelist().currency_id, website.currency_id)" /> + <del class="text-danger mr8" style="white-space: nowrap;" t-esc="compute_currency(website.get_product_price(line.product_id, public=True))" t-options="{'widget': 'monetary', 'display_currency': website.get_current_pricelist().currency_id, 'from_currency': website.currency_id}" /> </t> - <span t-field="line.price_reduce_taxexcl" style="white-space: nowrap;" t-field-options="{'widget': 'monetary', 'from_currency': line.company_id.currency_id, 'display_currency': website.currency_id}" groups="sale.group_show_price_subtotal" /> - <span t-field="line.price_reduce_taxinc" style="white-space: nowrap;" t-field-options="{'widget': 'monetary', 'from_currency': line.company_id.currency_id, 'display_currency': website.currency_id}" groups="sale.group_show_price_total" /> + <span t-field="line.price_reduce_taxexcl" style="white-space: nowrap;" t-options="{'widget': 'monetary', 'from_currency': line.company_id.currency_id, 'display_currency': website.currency_id}" groups="sale.group_show_price_subtotal" /> + <span t-field="line.price_reduce_taxinc" style="white-space: nowrap;" t-options="{'widget': 'monetary', 'from_currency': line.company_id.currency_id, 'display_currency': website.currency_id}" groups="sale.group_show_price_total" /> </td> </tr> </t> @@ -846,7 +846,7 @@ <t t-foreach="website_sale_order.website_order_line" t-as="line"> <div class="row mb8 cart_line"> <div class="col-xs-3"> - <span t-field="line.product_id.image_small" t-field-options="{'widget': 'image', 'class': 'img-rounded'}" /> + <span t-field="line.product_id.image_small" t-options="{'widget': 'image', 'class': 'img-rounded'}" /> </div> <div class="col-xs-9"> <a t-attf-href="/shop/product/#{ slug(line.product_id.product_tmpl_id) }"> @@ -886,7 +886,7 @@ <tr t-foreach="suggested_products" t-as="product"> <td> <a t-attf-href="/shop/product/#{ slug(product.product_tmpl_id) }"> - <span t-field="product.image_small" t-field-options="{'widget': 'image', 'class': 'img-rounded'}" /> + <span t-field="product.image_small" t-options="{'widget': 'image', 'class': 'img-rounded'}" /> </a> </td> <td> @@ -899,9 +899,9 @@ </td> <td> <t t-if="(compute_currency(product.lst_price) - product.price) > 0.1"> - <del class="text-danger mr8" style="white-space: nowrap;" t-field="product.lst_price" t-field-options="{'widget': 'monetary','from_currency': product.currency_id, 'display_currency': website.currency_id}" /> + <del class="text-danger mr8" style="white-space: nowrap;" t-field="product.lst_price" t-options="{'widget': 'monetary','from_currency': product.currency_id, 'display_currency': website.currency_id}" /> </t> - <span t-field="product.price" style="white-space: nowrap;" t-field-options="{'widget': 'monetary','display_currency': website.currency_id}" /> + <span t-field="product.price" style="white-space: nowrap;" t-options="{'widget': 'monetary','display_currency': website.currency_id}" /> </td> <td class="text-center"> <input class="js_quantity" name="product_id" t-att-data-product-id="product.id" type="hidden" /> @@ -1028,7 +1028,7 @@ <a class='btn btn-link pull-right fa fa-edit js_edit_address no-decoration' title="Edit this address"></a> <div t-att-class="'panel panel-default %s' % (selected and 'border_primary' or 'js_change_shipping')"> <div class='panel-body' style='min-height: 130px;'> - <t t-raw="format(contact, 'htmlcontact', dict(fields=['name', 'address'], no_marker=True))"/> + <t t-esc="contact" t-options="dict(widget='contact', fields=['name', 'address'], no_marker=True)"/> </div> <div class='panel-footer' t-if='not readonly'> <span class='btn-ship' t-att-style="'' if selected else 'display:none;'"> @@ -1199,7 +1199,7 @@ <td colspan="2" t-if="not line.product_id.product_tmpl_id"></td> <td t-if="line.product_id.product_tmpl_id"> <a t-attf-href="/shop/product/#{ slug(line.product_id.product_tmpl_id) }"> - <span t-field="line.product_id.image_small" t-field-options="{'widget': 'image', 'class': 'img-rounded'}" /> + <span t-field="line.product_id.image_small" t-options="{'widget': 'image', 'class': 'img-rounded'}" /> </a> </td> <td t-if="line.product_id.product_tmpl_id"> @@ -1209,7 +1209,7 @@ <div t-esc="line.product_uom_qty" /> </td> <td class="text-center"> - <span t-field="line.price_unit" style="white-space: nowrap;" t-field-options="{'widget': 'monetary','from_currency': website_sale_order.pricelist_id.currency_id,'display_currency': website.currency_id}" /> + <span t-field="line.price_unit" style="white-space: nowrap;" t-options="{'widget': 'monetary','from_currency': website_sale_order.pricelist_id.currency_id,'display_currency': website.currency_id}" /> </td> </tr> </tbody> @@ -1224,14 +1224,14 @@ <div class="panel panel-info"> <div class="panel-heading">Bill To:</div> <div class="panel-body"> - <div t-field="order.partner_invoice_id" t-field-options="{'widget': 'contact','fields': ['address', 'name', 'phone', 'email']}" /> + <div t-field="order.partner_invoice_id" t-options="{'widget': 'contact','fields': ['address', 'name', 'phone', 'email']}" /> </div> </div> <t t-if="website_sale_order and not website_sale_order.only_services"> <div class="panel panel-info"> <div class="panel-heading">Ship To:</div> <div class="panel-body"> - <div t-field="order.partner_shipping_id" t-field-options="{'widget': 'contact', 'fields': ['address', 'name', 'phone']}" /> + <div t-field="order.partner_shipping_id" t-options="{'widget': 'contact', 'fields': ['address', 'name', 'phone']}" /> </div> </div> @@ -1341,13 +1341,13 @@ <td> <span class="text-right"> <div t-field="line.price_unit" - t-field-options='{"widget": "monetary", "display_currency": order.pricelist_id.currency_id}'/> + t-options='{"widget": "monetary", "display_currency": order.pricelist_id.currency_id}'/> </span> </td> <td> <div class="text-right" t-field="line.price_subtotal" - t-field-options='{"widget": "monetary", "display_currency": order.pricelist_id.currency_id}'/> + t-options='{"widget": "monetary", "display_currency": order.pricelist_id.currency_id}'/> </td> </tr> </tbody> @@ -1356,14 +1356,14 @@ <td colspan="2"></td> <td class="text-right">Subtotal:</td> <td class="text-right"> - <span t-field="order.amount_untaxed" style="white-space: nowrap;" t-field-options="{'widget': 'monetary','from_currency': order.pricelist_id.currency_id,'display_currency': website.currency_id}" /> + <span t-field="order.amount_untaxed" style="white-space: nowrap;" t-options="{'widget': 'monetary','from_currency': order.pricelist_id.currency_id,'display_currency': website.currency_id}" /> </td> </tr> <tr> <td class='noborder' colspan="2"></td> <td class="text-right noborder">Taxes:</td> <td class="text-right noborder"> - <span t-field="order.amount_tax" style="white-space: nowrap;" t-field-options="{'widget': 'monetary', 'from_currency': order.pricelist_id.currency_id, 'display_currency': website.currency_id}" /> + <span t-field="order.amount_tax" style="white-space: nowrap;" t-options="{'widget': 'monetary', 'from_currency': order.pricelist_id.currency_id, 'display_currency': website.currency_id}" /> </td> </tr> <tr> @@ -1371,7 +1371,7 @@ <td class="text-right"><strong>Total:</strong></td> <td class="text-right"> <strong t-field="order.amount_total" - t-field-options='{"widget": "monetary", "display_currency": order.pricelist_id.currency_id}'/> + t-options='{"widget": "monetary", "display_currency": order.pricelist_id.currency_id}'/> </td> </tr> </tfooter> @@ -1392,7 +1392,7 @@ <strong>Total:</strong> </td> <td class="text-right" width="100"> - <strong t-field="order.amount_total" t-field-options="{'widget': 'monetary', 'display_currency': order.pricelist_id.currency_id}" /> + <strong t-field="order.amount_total" t-options="{'widget': 'monetary', 'display_currency': order.pricelist_id.currency_id}" /> </td> </tr> </tbody> @@ -1404,14 +1404,14 @@ <div class="panel panel-info"> <div class="panel-heading">Bill To:</div> <div class="panel-body"> - <div t-field="order.partner_invoice_id" t-field-options="{'widget': 'contact','fields': ['address', 'name', 'phone', 'email']}" /> + <div t-field="order.partner_invoice_id" t-options="{'widget': 'contact','fields': ['address', 'name', 'phone', 'email']}" /> </div> </div> <t t-if="not order.only_services"> <div class="panel panel-info"> <div class="panel-heading">Ship To:</div> <div class="panel-body"> - <div t-field="order.partner_shipping_id" t-field-options="{'widget': 'contact','fields': ['address', 'name', 'phone']}" /> + <div t-field="order.partner_shipping_id" t-options="{'widget': 'contact','fields': ['address', 'name', 'phone']}" /> </div> </div> </t> @@ -1459,19 +1459,19 @@ <div class="row" id="order_total_untaxed"> <span class="col-xs-6 text-right text-muted">Subtotal:</span> <span class="col-xs-6 text-left text-muted"> - <span t-field="website_sale_order.amount_untaxed" style="white-space: nowrap;" t-field-options="{'widget': 'monetary','from_currency': website_sale_order.pricelist_id.currency_id,'display_currency': website.currency_id}" /> + <span t-field="website_sale_order.amount_untaxed" style="white-space: nowrap;" t-options="{'widget': 'monetary','from_currency': website_sale_order.pricelist_id.currency_id,'display_currency': website.currency_id}" /> </span> </div> <div class="row" id="order_total_taxes"> <span class="col-xs-6 text-right text-muted" title="Taxes may be updated after providing shipping address"> Taxes:</span> <span class="col-xs-6 text-left text-muted"> - <span t-field="website_sale_order.amount_tax" style="white-space: nowrap;" t-field-options="{'widget': 'monetary', 'from_currency': website_sale_order.pricelist_id.currency_id, 'display_currency': website.currency_id}" /> + <span t-field="website_sale_order.amount_tax" style="white-space: nowrap;" t-options="{'widget': 'monetary', 'from_currency': website_sale_order.pricelist_id.currency_id, 'display_currency': website.currency_id}" /> </span> </div> <div class="row" id="order_total"> <span class="col-xs-6 text-right h4">Total:</span> <span class="col-xs-6 text-left h4" style="white-space: nowrap;"> - <span t-field="website_sale_order.amount_total" style="white-space: nowrap;" t-field-options="{'widget': 'monetary','from_currency': website_sale_order.pricelist_id.currency_id,'display_currency': website.currency_id}" /> + <span t-field="website_sale_order.amount_total" style="white-space: nowrap;" t-options="{'widget': 'monetary','from_currency': website_sale_order.pricelist_id.currency_id,'display_currency': website.currency_id}" /> </span> </div> </div> diff --git a/addons/website_sale_delivery/views/website_sale_delivery.xml b/addons/website_sale_delivery/views/website_sale_delivery.xml index 78443297289..ec89155d21d 100644 --- a/addons/website_sale_delivery/views/website_sale_delivery.xml +++ b/addons/website_sale_delivery/views/website_sale_delivery.xml @@ -7,7 +7,7 @@ <div class="row" id="order_delivery" t-if="website_sale_order and website_sale_order.has_delivery"> <span class="col-xs-6 text-right text-muted" title="Delivery will be updated after choosing a new delivery method"> Delivery:</span> <span class="col-xs-6 text-left text-muted"> - <span t-field="website_sale_order.amount_delivery" style="white-space: nowrap;" t-field-options='{ + <span t-field="website_sale_order.amount_delivery" style="white-space: nowrap;" t-options='{ "widget": "monetary", "from_currency": website_sale_order.currency_id, "display_currency": user_id.partner_id.property_product_pricelist.currency_id @@ -36,7 +36,7 @@ t-att-checked="order.carrier_id and order.carrier_id.id == delivery.id and 'checked' or False"/> <abbr t-att-title="delivery.website_description"><span t-field="delivery.name"/></abbr> <span class="badge" t-field="delivery.price" - t-field-options='{ + t-options='{ "widget": "monetary", "from_currency": delivery.product_id.company_id.currency_id, "display_currency": website_sale_order.currency_id diff --git a/addons/website_sale_options/views/templates.xml b/addons/website_sale_options/views/templates.xml index b36e1eb7cb9..7b15d4ba663 100644 --- a/addons/website_sale_options/views/templates.xml +++ b/addons/website_sale_options/views/templates.xml @@ -45,7 +45,7 @@ <tbody> <tr id="product_confirmation"> <td width="100"> - <span t-field="product.image_medium" t-field-options='{"widget": "image" }'/> + <span t-field="product.image_medium" t-options='{"widget": "image" }'/> </td> <td colspan="2"> <strong t-field="product.display_name"/> @@ -57,7 +57,7 @@ <td> <span t-attf-class="text-danger oe_default_price" t-att-style="'' if (compute_currency(product.lst_price) - product.price) > 0.1 else 'display: none;'" style="text-decoration: line-through; white-space: nowrap;" t-field="product.lst_price" - t-field-options='{ + t-options='{ "widget": "monetary", "from_currency": product.currency_id, "display_currency": website.currency_id @@ -65,7 +65,7 @@ <span class="oe_price" style="white-space: nowrap;" t-att-data-product-id="product.id" t-field="product.price" - t-field-options='{ + t-options='{ "widget": "monetary", "display_currency": website.currency_id }'/> @@ -88,7 +88,7 @@ <tr class="js_product" t-foreach="product.optional_product_ids" t-as="product"> <td width="100"> <input type="hidden" class="product_id" t-attf-name="optional-product-#{option_inc}" t-att-value="int(product.product_variant_ids[0]) if len(product.product_variant_ids) == 1 else '0'"/> - <span t-field="product.image_small" t-field-options='{"widget": "image"}'/> + <span t-field="product.image_small" t-options='{"widget": "image"}'/> </td> <td> <div class="pull-left"> @@ -104,14 +104,14 @@ <td> <span class="text-danger oe_optional" t-att-style="'' if (compute_currency(product.lst_price) - product.price) > 0.1 else 'display: none;'" style="text-decoration: line-through; white-space: nowrap;" t-field="product.lst_price" - t-field-options='{ + t-options='{ "widget": "monetary", "from_currency": product.currency_id, "display_currency": website.currency_id }'/><br/> <span class="oe_price" style="white-space: nowrap;" t-field="product.price" - t-field-options='{ + t-options='{ "widget": "monetary", "display_currency": website.currency_id }'/> diff --git a/addons/website_sale_stock/views/templates.xml b/addons/website_sale_stock/views/templates.xml index fb8965e9c32..a8b72aaeb3e 100644 --- a/addons/website_sale_stock/views/templates.xml +++ b/addons/website_sale_stock/views/templates.xml @@ -12,7 +12,7 @@ <div id='picking_info'> <a t-att-href="report_url"><span class="fa fa-download"/></a> <a t-att-href="report_url"><span t-field="i.name"/></a> - <span class="text-muted" t-field="i.date" t-field-options='{"widget": "date"}'/> + <span class="text-muted" t-field="i.date" t-options='{"widget": "date"}'/> <t t-if="i.state == 'done'"> <span class="label label-success label-text-align"><i class="fa fa-fw fa-truck"/> Shipped</span> </t> diff --git a/addons/website_slides/view/website_slides.xml b/addons/website_slides/view/website_slides.xml index 47e572c0eaa..5f924f59a06 100644 --- a/addons/website_slides/view/website_slides.xml +++ b/addons/website_slides/view/website_slides.xml @@ -580,7 +580,7 @@ <t t-call="website.publish_short"> <t t-set="object" t-value="message"/> </t> - <span t-field="message.author_id" style="display: inline-block;" t-field-options='{"widget": "contact", "fields": ["name"]}'/> + <span t-field="message.author_id" style="display: inline-block;" t-options='{"widget": "contact", "fields": ["name"]}'/> <span class="text-muted">on<span t-field="message.date"/></span> <div t-field="message.body" class="discussion_scroll_post"></div> </div> diff --git a/doc/howtos/website/field-format b/doc/howtos/website/field-format index 2fbaa541f8c..930ccfa0fa6 100644 --- a/doc/howtos/website/field-format +++ b/doc/howtos/website/field-format @@ -10,7 +10,7 @@ diff --git a/academy/templates.xml b/academy/templates.xml <div class="container"> <h3 t-field="person.name"/> - <p>Last modified: <i t-field="person.write_date"/></p> -+ <p>Last modified: <i t-field="person.write_date" t-field-options='{"format": "long"}'/></p> ++ <p>Last modified: <i t-field="person.write_date" t-options='{"format": "long"}'/></p> <div t-field="person.biography"/> </div> </div> diff --git a/doc/howtos/website/field-widget b/doc/howtos/website/field-widget index 667cb8a65f1..ea3ddce562a 100644 --- a/doc/howtos/website/field-widget +++ b/doc/howtos/website/field-widget @@ -9,8 +9,8 @@ diff --git a/academy/templates.xml b/academy/templates.xml <div class="oe_structure"> <div class="container"> <h3 t-field="person.name"/> -- <p>Last modified: <i t-field="person.write_date" t-field-options='{"format": "long"}'/></p> -+ <p>Last modified: <i t-field="person.write_date" t-field-options='{"widget": "relative"}'/></p> +- <p>Last modified: <i t-field="person.write_date" t-options='{"format": "long"}'/></p> ++ <p>Last modified: <i t-field="person.write_date" t-options='{"widget": "relative"}'/></p> <div t-field="person.biography"/> </div> </div> diff --git a/doc/reference/qweb.rst b/doc/reference/qweb.rst index fc4ecd43aca..1fa29212998 100644 --- a/doc/reference/qweb.rst +++ b/doc/reference/qweb.rst @@ -334,7 +334,7 @@ The ``t-field`` directive can only be used when performing field access to automatically format based on field type, and is integrated in the website's rich text edition. -``t-field-options`` can be used to customize fields, the most common option +``t-options`` can be used to customize fields, the most common option is ``widget``, other options are field- or widget-dependent. debugging diff --git a/doc/reference/reports.rst b/doc/reference/reports.rst index f1b4acfd479..64545fd5729 100644 --- a/doc/reference/reports.rst +++ b/doc/reference/reports.rst @@ -161,7 +161,7 @@ For example, let's look at the Sale Order report from the Sale module:: <div class="col-xs-6"> <strong t-if="doc.partner_shipping_id == doc.partner_invoice_id">Invoice and shipping address:</strong> <strong t-if="doc.partner_shipping_id != doc.partner_invoice_id">Invoice address:</strong> - <div t-field="doc.partner_invoice_id" t-field-options="{"no_marker": True}"/> + <div t-field="doc.partner_invoice_id" t-options="{"no_marker": True}"/> <...> <div class="oe_structure"/> </div> diff --git a/openerp/addons/base/ir/ir_qweb.xml b/openerp/addons/base/ir/ir_qweb.xml index e4d135119c0..b882a847d30 100644 --- a/openerp/addons/base/ir/ir_qweb.xml +++ b/openerp/addons/base/ir/ir_qweb.xml @@ -12,7 +12,7 @@ <span itemprop="name" t-esc="object.parent_name"/> </t> <t t-if="options.get('country_image') and 'country_id' in fields and object.country_id and object.country_id.image"> - <span t-field="object.country_id.image" t-field-options='{"widget": "image", "class": "country_flag"}'/> + <span t-field="object.country_id.image" t-options='{"widget": "image", "class": "country_flag"}'/> </t> </div> <div itemprop="address" itemscope="itemscope" itemtype="http://schema.org/PostalAddress"> diff --git a/openerp/addons/base/ir/ir_qweb/fields.py b/openerp/addons/base/ir/ir_qweb/fields.py index c0feaa27aa8..c8d93037c26 100644 --- a/openerp/addons/base/ir/ir_qweb/fields.py +++ b/openerp/addons/base/ir/ir_qweb/fields.py @@ -5,7 +5,7 @@ from odoo import api, fields, models, _ from PIL import Image from cStringIO import StringIO import babel -from openerp.tools import html_escape as escape, posix_to_ldml, safe_eval +from openerp.tools import html_escape as escape, posix_to_ldml, safe_eval, float_utils from .qweb import unicodifier import logging @@ -82,7 +82,7 @@ class FieldConverter(models.AbstractModel): return data @api.model - def value_to_html(self, value, field, options=None): + def value_to_html(self, value, options): """ value_to_html(value, field, options=None) Converts a single value to its HTML version/output @@ -91,21 +91,14 @@ class FieldConverter(models.AbstractModel): return html_escape(unicodifier(value) or u'', options) @api.model - def record_to_html(self, record, field_name, options, values=None): - """ record_to_html(record, field_name, options, values) + def record_to_html(self, record, field_name, options): + """ record_to_html(record, field_name, options) Converts the specified field of the browse_record ``record`` to HTML :rtype: unicode """ - field = record._fields[field_name] - - try: - value = record[field_name] - return False if value is False else record.env[self._name].value_to_html(value, field, options=options) - except Exception: - _logger.warning("Could not get field %s for model %s", - field_name, record._name, exc_info=True) - return None + value = record[field_name] + return False if value is False else record.env[self._name].value_to_html(value, options=options) @api.model def user_lang(self): @@ -126,7 +119,7 @@ class IntegerConverter(models.AbstractModel): _inherit = 'ir.qweb.field' @api.model - def value_to_html(self, value, field, options=None): + def value_to_html(self, value, options): return unicodifier(self.user_lang().format('%d', value, grouping=True)) @@ -135,16 +128,19 @@ class FloatConverter(models.AbstractModel): _inherit = 'ir.qweb.field' @api.model - def precision(self, field, options=None): - _, precision = field.digits or (None, None) - return precision + def value_to_html(self, value, options): + if 'decimal_precision' in options: + precision = self.env['decimal.precision'].search([('name', '=', options['decimal_precision'])]).digits + else: + precision = options['precision'] - @api.model - def value_to_html(self, value, field, options=None): - 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) + if precision is None: + fmt = '%f' + else: + value = float_utils.float_round(value, precision_digits=precision) + fmt = '%.{precision}f'.format(precision=precision) + + formatted = self.user_lang().format(fmt, value, grouping=True) # %f does not strip trailing zeroes. %g does but its precision causes # it to switch to scientific notation starting at a million *and* to @@ -152,15 +148,23 @@ class FloatConverter(models.AbstractModel): # strip trailing 0. if precision is None: formatted = re.sub(r'(?:(0|\d+?)0+)$', r'\1', formatted) + return unicodifier(formatted) + @api.model + def record_to_html(self, record, field_name, options): + if 'precision' not in options and 'decimal_precision' not in options: + _, precision = record._fields[field_name].digits or (None, None) + options = dict(options, precision=precision) + return super(FloatConverter, self).record_to_html(record, field_name, options) + class DateConverter(models.AbstractModel): _name = 'ir.qweb.field.date' _inherit = 'ir.qweb.field' @api.model - def value_to_html(self, value, field, options=None): + def value_to_html(self, value, options): if not value or len(value) < 10: return '' lang = self.user_lang() @@ -183,7 +187,7 @@ class DateTimeConverter(models.AbstractModel): _inherit = 'ir.qweb.field' @api.model - def value_to_html(self, value, field, options=None): + def value_to_html(self, value, options): if not value: return '' lang = self.user_lang() @@ -211,7 +215,7 @@ class TextConverter(models.AbstractModel): _inherit = 'ir.qweb.field' @api.model - def value_to_html(self, value, field, options=None): + def value_to_html(self, value, options): """ Escapes the value and converts newlines to br. This is bullshit. """ @@ -223,11 +227,16 @@ class SelectionConverter(models.AbstractModel): _inherit = 'ir.qweb.field' @api.model - def value_to_html(self, value, field, options=None): + def value_to_html(self, value, options): if not value: return '' - selection = dict(field.get_description(self.env)['selection']) - return html_escape(unicodifier(selection[value]) or u'', options) + return html_escape(unicodifier(options['selection'][value]) or u'', options) + + @api.model + def record_to_html(self, record, field_name, options): + if 'selection' not in options: + options = dict(options, selection=dict(record._fields[field_name].get_description(self.env)['selection'])) + return super(SelectionConverter, self).record_to_html(record, field_name, options) class ManyToOneConverter(models.AbstractModel): @@ -235,8 +244,7 @@ class ManyToOneConverter(models.AbstractModel): _inherit = 'ir.qweb.field' @api.model - def record_to_html(self, record, field_name, options, values=None): - value = record[field_name] + def value_to_html(self, value, options): if not value: return False value = value.sudo().display_name @@ -250,7 +258,7 @@ class HTMLConverter(models.AbstractModel): _inherit = 'ir.qweb.field' @api.model - def value_to_html(self, value, field, options=None): + def value_to_html(self, value, options): return unicodifier(value) or u'' @@ -267,7 +275,7 @@ class ImageConverter(models.AbstractModel): _inherit = 'ir.qweb.field' @api.model - def value_to_html(self, value, field, options=None): + def value_to_html(self, value, options): try: image = Image.open(StringIO(value.decode('base64'))) image.verify() @@ -297,25 +305,8 @@ class MonetaryConverter(models.AbstractModel): _inherit = 'ir.qweb.field' @api.model - def record_to_html(self, record, field_name, options, values=None): - field = record._fields[field_name] - - # for backward compatibility to remove after v10 - if isinstance(options.get('display_currency'), str): - _logger.warning("Use new syntax for '%s' monetary widget 'display_currency' option (instead of deprecated JSON syntax) to improve speed." % options['display_currency']) - options['display_currency'] = safe_eval.safe_eval(options['display_currency'], mode='eval', globals_dict=values) - if isinstance(options.get('from_currency'), str): - _logger.warning("Use new syntax for '%s' monetary widget 'from_currency' option (instead of deprecated JSON syntax) to improve speed." % options['from_currency']) - options['from_currency'] = safe_eval.safe_eval(options['from_currency'], mode='eval', globals_dict=values) - # end backward - - display_currency = False - #currency should be specified by monetary field - if field.type == 'monetary' and field.currency_field: - display_currency = record[field.currency_field] - #otherwise fall back to old method - if not display_currency: - display_currency = options['display_currency'] + def value_to_html(self, value, options): + display_currency = options['display_currency'] # lang.format mandates a sprintf-style format. These formats are non- # minimal (they have a default fixed precision instead), and @@ -324,26 +315,30 @@ class MonetaryConverter(models.AbstractModel): # (integer > 0) from the currency's rounding (a float generally < 1.0). fmt = "%.{0}f".format(display_currency.decimal_places) - from_amount = record[field_name] - if options.get('from_currency'): - from_amount = options['from_currency'].compute(from_amount, display_currency) + value = options['from_currency'].compute(value, display_currency) lang = self.user_lang() - formatted_amount = lang.format(fmt, display_currency.round(from_amount), + formatted_amount = lang.format(fmt, display_currency.round(value), grouping=True, monetary=True).replace(r' ', u'\N{NO-BREAK SPACE}') pre = post = u'' if display_currency.position == 'before': - pre = u'{symbol}\N{NO-BREAK SPACE}' + pre = u'{symbol}\N{NO-BREAK SPACE}'.format(symbol=display_currency.symbol) else: - post = u'\N{NO-BREAK SPACE}{symbol}' + post = u'\N{NO-BREAK SPACE}{symbol}'.format(symbol=display_currency.symbol) - return u'{pre}<span class="oe_currency_value">{0}</span>{post}'.format( - formatted_amount, pre=pre, post=post, - ).format( - symbol=display_currency.symbol, - ) + return u'{pre}<span class="oe_currency_value">{0}</span>{post}'.format(formatted_amount, pre=pre, post=post) + + @api.model + def record_to_html(self, record, field_name, options): + options = dict(options) + #currency should be specified by monetary field + field = record._fields[field_name] + if not options.get('display_currency') and field.type == 'monetary' and field.currency_field: + options['display_currency'] = record[field.currency_field] + + return self.value_to_html(record[field_name], options) TIMEDELTA_UNITS = ( ('year', 3600 * 24 * 365), @@ -372,10 +367,12 @@ class DurationConverter(models.AbstractModel): _inherit = 'ir.qweb.field' @api.model - def value_to_html(self, value, field, options=None): + def value_to_html(self, value, options): units = dict(TIMEDELTA_UNITS) + if value < 0: raise ValueError(_("Durations can't be negative")) + if not options or options.get('unit') not in units: raise ValueError(_("A unit must be provided to duration widgets")) @@ -400,48 +397,52 @@ class RelativeDatetimeConverter(models.AbstractModel): _inherit = 'ir.qweb.field' @api.model - def value_to_html(self, value, field, options=None): + def value_to_html(self, value, options): locale = babel.Locale.parse(self.user_lang().code) if isinstance(value, basestring): value = fields.Datetime.from_string(value) # value should be a naive datetime in UTC. So is fields.Datetime.now() - reference = fields.Datetime.from_string(field.now()) + reference = fields.Datetime.from_string(options['now']) return unicodifier(babel.dates.format_timedelta(value - reference, add_direction=True, locale=locale)) + @api.model + def record_to_html(self, record, field_name, options): + if 'now' not in options: + options = dict(options, now=record._fields[field_name].now()) + return super(RelativeDatetimeConverter, self).record_to_html(record, field_name, options) + class Contact(models.AbstractModel): _name = 'ir.qweb.field.contact' _inherit = 'ir.qweb.field.many2one' @api.model - def record_to_html(self, record, field_name, options, values=None): - opf = options and options.get('fields') or ["name", "address", "phone", "mobile", "fax", "email"] + def value_to_html(self, value, options): + if not value.exists(): + return False - value_rec = record[field_name] - if not value_rec: - return None - value_rec = value_rec.sudo().with_context(show_address=True) - value = value_rec.name_get()[0][1] + opf = options and options.get('fields') or ["name", "address", "phone", "mobile", "fax", "email"] + value = value.sudo().with_context(show_address=True) + name_get = value.name_get()[0][1] val = { - 'name': value.split("\n")[0], - 'address': escape("\n".join(value.split("\n")[1:])).strip(), - 'phone': value_rec.phone, - 'mobile': value_rec.mobile, - 'fax': value_rec.fax, - 'city': value_rec.city, - 'country_id': value_rec.country_id.display_name, - 'website': value_rec.website, - 'email': value_rec.email, + 'name': name_get.split("\n")[0], + 'address': escape("\n".join(name_get.split("\n")[1:])).strip(), + 'phone': value.phone, + 'mobile': value.mobile, + 'fax': value.fax, + 'city': value.city, + 'country_id': value.country_id.display_name, + 'website': value.website, + 'email': value.email, 'fields': opf, - 'object': value_rec, + 'object': value, 'options': options } - - return unicodifier(self.env.ref('base.contact').render(val, engine='ir.qweb')) + return self.env['ir.qweb'].render('base.contact', val) class QwebView(models.AbstractModel): @@ -449,7 +450,7 @@ class QwebView(models.AbstractModel): _inherit = 'ir.qweb.field.many2one' @api.model - def record_to_html(self, record, field_name, options, values=None): + def record_to_html(self, record, field_name, options): if not getattr(record, field_name): return None diff --git a/openerp/addons/base/ir/ir_qweb/ir_qweb.py b/openerp/addons/base/ir/ir_qweb/ir_qweb.py index 166858edd2c..88e6ee95307 100644 --- a/openerp/addons/base/ir/ir_qweb/ir_qweb.py +++ b/openerp/addons/base/ir/ir_qweb/ir_qweb.py @@ -2,11 +2,11 @@ import ast from urlparse import urlparse from lxml import html -import math from .qweb import QWeb, Contextifier from .assetsbundle import AssetsBundle from lxml import etree +from collections import OrderedDict from openerp import api, models, tools from openerp.tools import safe_eval @@ -144,11 +144,41 @@ class IrQWeb(models.AbstractModel, QWeb): )) ] + # for backward compatibility to remove after v10 + def _compile_widget_options(self, el, directive_type): + field_options = super(IrQWeb, self)._compile_widget_options(el, directive_type) + + if ('t-%s-options' % directive_type) in el.attrib: + if tools.config['dev_mode']: + _logger.warning("Use new syntax t-options instead of t-%s-options" % directive_type) + if not field_options: + field_options = el.attrib.pop('t-%s-options' % directive_type) + + if field_options and 'monetary' in field_options: + try: + options = "{'widget': 'monetary'" + for k, v in json.loads(field_options).iteritems(): + print k, v + if k in ('display_currency', 'from_currency'): + options = "%s, '%s': %s" % (options, k, v) + else: + options = "%s, '%s': '%s'" % (options, k, v) + options = "%s}" % options + field_options = options + _logger.warning("Use new syntax for '%s' monetary widget t-options (python dict instead of deprecated JSON syntax)." % etree.tostring(el)) + except ValueError: + pass + + return field_options + # end backward + # method called by computing code @tools.conditional( + # in non-xml-debug mode we want assets to be cached forever, and the admin can force a cache clear + # by restarting the server after updating the source code (or using the "Clear server cache" in debug tools) 'xml' not in tools.config['dev_mode'], - tools.ormcache('xmlid', 'options.get("lang", "en_US")', 'css', 'js', 'debug', 'async', 'values.get("time_cache_assets")'), + tools.ormcache('xmlid', 'options.get("lang", "en_US")', 'css', 'js', 'debug', 'async'), ) def _get_asset(self, xmlid, options, css=True, js=True, debug=False, async=False, values=None): files, remains = self._get_asset_content(xmlid, options) @@ -231,33 +261,30 @@ class IrQWeb(models.AbstractModel, QWeb): converter = self.env[model] if model in self.env else self.env['ir.qweb.field'] # get content - content = converter.record_to_html(record, field_name, field_options, values) + content = converter.record_to_html(record, field_name, field_options) attributes = converter.attributes(record, field_name, field_options, values) return (attributes, content, inherit_branding or translate) - # formating methods - def _format_func_monetary(self, value, display_currency=None, from_currency=None): - env = display_currency.env - precision = int(round(math.log10(display_currency.rounding))) - fmt = "%.{0}f".format(-precision if precision < 0 else 0) - lang = env['res.lang']._lang_get(env.context.get('lang', 'en_US')) - formatted_amount = lang.format(fmt, value, grouping=True, monetary=True).replace(r' ', u'\N{NO-BREAK SPACE}') - pre = post = u'' - if display_currency.position == 'before': - pre = u'{symbol}\N{NO-BREAK SPACE}' - else: - post = u'\N{NO-BREAK SPACE}{symbol}' - return u'{pre}{0}{post}'.format( - formatted_amount, pre=pre, post=post - ).format(symbol=display_currency.symbol,) - - def _format_func_htmlcontact(self, value, options, values=None): - return self.pool['ir.qweb.field.contact'].record_to_html( - self.env.cr, self.env.uid, dict(contact=value), 'contact', dict(options or {}), context=self.env.context - ) + def _get_widget(self, value, expression, tagName, field_options, options, values): + field_options['type'] = field_options['widget'] + field_options['tagName'] = tagName + field_options['expression'] = expression + + # field converter + model = 'ir.qweb.field.' + field_options['type'] + converter = self.env[model] if model in self.env else self.env['ir.qweb.field'] + + # get content + content = converter.value_to_html(value, field_options) + attributes = OrderedDict() + attributes['data-oe-type'] = field_options['type'] + attributes['data-oe-expression'] = field_options['expression'] + + return (attributes, content, None) # compile expression add safe_eval + def _compile_expr(self, expr): """ Compiles a purported Python expression to ast, verifies that it's safe (according to safe_eval's semantics) and alter its variable references to diff --git a/openerp/addons/base/ir/ir_qweb/qweb.py b/openerp/addons/base/ir/ir_qweb/qweb.py index dda4e1546c2..759559e1be3 100644 --- a/openerp/addons/base/ir/ir_qweb/qweb.py +++ b/openerp/addons/base/ir/ir_qweb/qweb.py @@ -6,7 +6,8 @@ import re import traceback from itertools import count from textwrap import dedent -from werkzeug.utils import escape +import werkzeug +from werkzeug.utils import escape as _escape from itertools import izip, tee import __builtin__ builtin_defaults = {name: getattr(__builtin__, name) for name in dir(__builtin__)} @@ -141,16 +142,8 @@ class QWebException(Exception): def __repr__(self): return str(self) - -import werkzeug -from werkzeug.utils import escape # Avoid DeprecationWarning while still remaining compatible with werkzeug pre-0.9 -if getattr(werkzeug, '__version__', '0.0') < '0.9.0': - def qweb_escape(text): - return escape(unicodifier(text), quote=True) -else: - def qweb_escape(text): - return escape(unicodifier(text)) +escape = (lambda text: _escape(text, quote=True)) if getattr(werkzeug, '__version__', '0.0') < '0.9.0' else _escape def unicodifier(val): if val is None or val is False: @@ -493,14 +486,14 @@ class QWeb(object): * collections * itertools Define: - * qweb_escape + * escape * unicodifier (empty string for a None or False, otherwise unicode string) """ return ast.parse(dedent(""" from collections import OrderedDict import itertools from itertools import repeat, imap - from openerp.addons.base.ir.ir_qweb.qweb import qweb_escape, unicodifier, foreach_iterator + from openerp.addons.base.ir.ir_qweb.qweb import escape, unicodifier, foreach_iterator """)) def _create_def(self, options, body, prefix='fn', lineno=None): @@ -684,11 +677,11 @@ class QWeb(object): return [ 'debug', 'groups', 'foreach', 'if', 'else', - 'field', + 'field', 'esc', 'raw', 'tag', 'call', 'set', - 'esc', 'raw', 'content', + 'content', ] def _is_static_node(self, el): @@ -704,7 +697,7 @@ class QWeb(object): content = self._compile_directive_content(el, options) if el.tag == 't': return content - tag = u'<%s%s' % (el.tag, u''.join([u' %s="%s"' % (name, qweb_escape(value)) for name, value in el.attrib.iteritems()])) + tag = u'<%s%s' % (el.tag, u''.join([u' %s="%s"' % (name, escape(unicodifier(value))) for name, value in el.attrib.iteritems()])) if el.tag in self._void_elements: return [self._append(ast.Str(tag + '/>'))] + content else: @@ -795,7 +788,7 @@ class QWeb(object): # append(u' ') # append(name) # append(u'="') - # append(qweb_escape(value)) + # append(escape(unicodifier((value))) # append(u'"') body.append(ast.For( target=ast.Tuple(elts=[ast.Name(id='name', ctx=ast.Store()), ast.Name(id='value', ctx=ast.Store())], ctx=ast.Store()), @@ -829,8 +822,12 @@ class QWeb(object): self._append(ast.Name(id='name', ctx=ast.Load())), self._append(ast.Str(u'="')), self._append(ast.Call( - func=ast.Name(id='qweb_escape', ctx=ast.Load()), - args=[ast.Name(id='value', ctx=ast.Load())], keywords=[], + func=ast.Name(id='escape', ctx=ast.Load()), + args=[ast.Call( + func=ast.Name(id='unicodifier', ctx=ast.Load()), + args=[ast.Name(id='value', ctx=ast.Load())], keywords=[], + starargs=None, kwargs=None + )], keywords=[], starargs=None, kwargs=None )), self._append(ast.Str(u'"')), @@ -844,6 +841,8 @@ class QWeb(object): def _compile_tag(self, el, content, options, attr_already_created=False): """ Compile the tag of the given element into a list of AST nodes. """ + if el.tag == 't': + return content body = [self._append(ast.Str(u'<%s' % el.tag))] body.extend(self._compile_all_attributes(el, options, attr_already_created)) if el.tag in self._void_elements: @@ -869,8 +868,6 @@ class QWeb(object): def _compile_directive_tag(self, el, options): el.attrib.pop('t-tag', None) content = self._compile_directives(el, options) - if el.tag == 't': - return content return self._compile_tag(el, content, options, False) def _compile_directive_set(self, el, options): @@ -924,45 +921,6 @@ class QWeb(object): value=value )] - def _compile_directive_esc(self, el, options): - return [ - # content = t-raw value - ast.Assign( - targets=[ast.Name(id='content', ctx=ast.Store())], - value=self._compile_expr0(el.attrib.pop('t-esc')), - ), - # if content is not None: display - self._if_content_is_not_Falsy( - # append(escape($content)) - body=[self._append(ast.Call( - func=ast.Name(id='qweb_escape', ctx=ast.Load()), - args=[ast.Name(id='content', ctx=ast.Load())], keywords=[], - starargs=None, kwargs=None - ))], - # append(body default value) - orelse=self._compile_directive_content(el, options), - ) - ] - - def _compile_directive_raw(self, el, options): - return [ - # content = t-raw value - ast.Assign( - targets=[ast.Name(id='content', ctx=ast.Store())], - value=self._compile_expr0(el.attrib.pop('t-raw')), - ), - self._if_content_is_not_Falsy( - # append($content) - body=[self._append(ast.Call( - func=ast.Name(id='unicodifier', ctx=ast.Load()), - args=[ast.Name(id='content', ctx=ast.Load())], keywords=[], - starargs=None, kwargs=None - ))], - # append(body default value) - orelse=self._compile_directive_content(el, options), - ) - ] - def _compile_directive_content(self, el, options): body = [] if el.text is not None: @@ -1048,6 +1006,103 @@ class QWeb(object): def _compile_tail(self, el): return el.tail is not None and [self._append(ast.Str(unicodifier(el.tail)))] or [] + def _compile_directive_esc(self, el, options): + field_options = self._compile_widget_options(el, 'esc') + content = self._compile_widget(el, el.attrib.pop('t-esc'), field_options, 'escape') + return content + self._compile_widget_value(el, options) + + def _compile_directive_raw(self, el, options): + field_options = self._compile_widget_options(el, 'raw') + content = self._compile_widget(el, el.attrib.pop('t-raw'), field_options) + return content + self._compile_widget_value(el, options) + + def _compile_widget(self, el, expression, field_options, escape=None): + # if isinstance(value, basestring): + # value = escape(unicodifier(value)) + escaped = ast.If( + test=ast.Call( + func=ast.Name(id='isinstance', ctx=ast.Load()), + args=[ + ast.Name(id='content', ctx=ast.Load()), + ast.Name(id='basestring', ctx=ast.Load()) + ], keywords=[], + starargs=None, kwargs=None + ), + body=[ast.Assign( + targets=[ast.Name(id='content', ctx=ast.Store())], + value=ast.Call( + func=ast.Name(id=escape, ctx=ast.Load()), + args=[ast.Call( + func=ast.Name(id='unicodifier', ctx=ast.Load()), + args=[ast.Name(id='content', ctx=ast.Load())], keywords=[], + starargs=None, kwargs=None + )], keywords=[], + starargs=None, kwargs=None + ) if escape else ast.Name(id='content', ctx=ast.Load()) + )], + orelse=[] + ) + + if field_options: + return [ + # value = t-(esc|raw) + ast.Assign( + targets=[ast.Name(id='content', ctx=ast.Store())], + value=self._compile_expr0(expression) + ), + escaped, + # t_attrs, content, force_display = self._get_widget(value, expression, tagName, field options, template options, values) + ast.Assign( + targets=[ast.Tuple(elts=[ + ast.Name(id='t_attrs', ctx=ast.Store()), + ast.Name(id='content', ctx=ast.Store()), + ast.Name(id='force_display', ctx=ast.Store()) + ], ctx=ast.Store())], + value=ast.Call( + func=ast.Attribute( + value=ast.Name(id='self', ctx=ast.Load()), + attr='_get_widget', + ctx=ast.Load() + ), + args=[ + ast.Name(id='content', ctx=ast.Load()), + ast.Str(expression), + ast.Str(el.tag), + field_options and self._compile_expr(field_options) or ast.Dict(keys=[], values=[]), + ast.Name(id='options', ctx=ast.Load()), + ast.Name(id='values', ctx=ast.Load()), + ], + keywords=[], starargs=None, kwargs=None + ) + ) + ] + + return [ + # t_attrs, content, force_display = OrderedDict(), t-(esc|raw), None + ast.Assign( + targets=[ast.Tuple(elts=[ + ast.Name(id='t_attrs', ctx=ast.Store()), + ast.Name(id='content', ctx=ast.Store()), + ast.Name(id='force_display', ctx=ast.Store()), + ], ctx=ast.Store())], + value=ast.Tuple(elts=[ + ast.Call( + func=ast.Name(id='OrderedDict', ctx=ast.Load()), + args=[], + keywords=[], starargs=None, kwargs=None + ), + self._compile_expr0(expression), + ast.Name(id='None', ctx=ast.Load()), + ], ctx=ast.Load()) + ), + escaped + ] + + # for backward compatibility to remove after v10 + def _compile_widget_options(self, el, directive_type): + return el.attrib.pop('t-options', None) + # end backward + def _compile_directive_field(self, el, options): """ Compile something like ``<span t-field="record.phone">+1 555 555 8069</span>`` """ node_name = el.tag @@ -1060,10 +1115,10 @@ class QWeb(object): "t-field must have at least a dot like 'record.field_name'" expression = el.attrib.pop('t-field') - field_options = el.attrib.pop('t-field-options', None) + field_options = self._compile_widget_options(el, 'field') record, field_name = expression.rsplit('.', 1) - content = [ + return [ # t_attrs, content, force_display = self._get_field(record, field_name, expression, tagName, field options, template options, values) ast.Assign( targets=[ast.Tuple(elts=[ @@ -1089,8 +1144,9 @@ class QWeb(object): keywords=[], starargs=None, kwargs=None ) ) - ] + ] + self._compile_widget_value(el, options) + def _compile_widget_value(self, el, options): # if force_display: # display the tag without content orelse = [ast.If( @@ -1145,17 +1201,22 @@ class QWeb(object): ] # if content is not None: - # display the tag + # display the tag (unicodifier(content)) # else # if default_content: # display the tag with default content # elif force_display: # display the tag without content - content.append(self._if_content_is_not_Falsy( - body=self._compile_tag(el, [self._append(ast.Name(id='content', ctx=ast.Load()))], options, True), + return [self._if_content_is_not_Falsy( + body=self._compile_tag(el, [self._append( + ast.Call( + func=ast.Name(id='unicodifier', ctx=ast.Load()), + args=[ast.Name(id='content', ctx=ast.Load())], keywords=[], + starargs=None, kwargs=None + ) + )], options, True), orelse=orelse, - )) - return content + )] def _compile_directive_call(self, el, options): tmpl = el.attrib.pop('t-call') @@ -1299,7 +1360,16 @@ class QWeb(object): * string or None: content * boolean: force_display display the tag if the content and default_content are None """ - return (OrderedDict(), escape(unicodifier(getattr(record, field_name, None))), False) + return self._get_widget(getattr(record, field_name, None), expression, tagName, field_options, options, values) + + def _get_widget(self, value, expression, tagName, field_options, options, values): + """ + :returns: tuple: + * OrderedDict: attributes + * string or None: content + * boolean: force_display display the tag if the content and default_content are None + """ + return (OrderedDict(), value, False) # compile expression diff --git a/openerp/addons/test_converter/tests/test_html.py b/openerp/addons/test_converter/tests/test_html.py index 58128176eac..f1d7dfc4ef7 100644 --- a/openerp/addons/test_converter/tests/test_html.py +++ b/openerp/addons/test_converter/tests/test_html.py @@ -30,8 +30,11 @@ class TestExport(common.TransactionCase): break except KeyError: pass - return lambda value, options=None, context=None: model.value_to_html( - self.cr, self.uid, value, field, options=options, context=context) + def converter(value, options=None, context=None): + record = self.Model.new(self.cr, self.uid, {name: value}, context=context) + return model.record_to_html( + self.cr, self.uid, record, name, options or {}, context=context) + return converter class TestBasicExport(TestExport): _model = 'test_converter.test_model' @@ -104,7 +107,7 @@ class TestCurrencyExport(TestExport): 'widget': 'monetary', 'display_currency': dest, } - return converter.record_to_html(self.cr, self.uid, obj, 'value', options, {'obj': obj}) + return converter.record_to_html(self.cr, self.uid, obj, 'value', options) def test_currency_post(self): currency = self.create(self.Currency, name="Test", symbol=u"test") @@ -188,36 +191,23 @@ class TestTextExport(TestBasicExport): class TestMany2OneExport(TestBasicExport): def test_many2one(self): Sub = self.registry('test_converter.test_model.sub') + converter = self.get_converter('many2one') - - id0 = self.Model.create(self.cr, self.uid, { - 'many2one': Sub.create(self.cr, self.uid, {'name': "Foo"}) - }) - id1 = self.Model.create(self.cr, self.uid, { - 'many2one': Sub.create(self.cr, self.uid, {'name': "Fo<b>o</b>"}) - }) - - def converter(record): - converter = self.registry('ir.qweb.field.many2one') - field_name = 'many2one' - return converter.record_to_html(self.cr, self.uid, record, field_name, {}) - - value = converter(self.Model.browse(self.cr, self.uid, id0)) + value = converter(Sub.create(self.cr, self.uid, {'name': "Foo"})) self.assertEqual(value, "Foo") - value = converter(self.Model.browse(self.cr, self.uid, id1)) + value = converter(Sub.create(self.cr, self.uid, {'name': "Fo<b>o</b>"})) self.assertEqual(value, "Fo<b>o</b>") class TestBinaryExport(TestBasicExport): def test_image(self): - field = self.get_field('binary') converter = self.registry('ir.qweb.field.image') with open(os.path.join(directory, 'test_vectors', 'image'), 'rb') as f: content = f.read() encoded_content = content.encode('base64') - value = converter.value_to_html(self.cr, self.uid, encoded_content, field) + value = converter.value_to_html(self.cr, self.uid, encoded_content, {}) self.assertEqual( value, '<img src="data:image/jpeg;base64,%s">' % ( @@ -229,30 +219,23 @@ class TestBinaryExport(TestBasicExport): with self.assertRaises(ValueError): converter.value_to_html( - self.cr, self.uid, 'binary', content.encode('base64'), field) + self.cr, self.uid, 'binary', content.encode('base64'), {}) with open(os.path.join(directory, 'test_vectors', 'pptx'), 'rb') as f: content = f.read() with self.assertRaises(ValueError): converter.value_to_html( - self.cr, self.uid, 'binary', content.encode('base64'), field) + self.cr, self.uid, 'binary', content.encode('base64'), {}) class TestSelectionExport(TestBasicExport): def test_selection(self): - [record] = self.Model.browse(self.cr, self.uid, [self.Model.create(self.cr, self.uid, { - 'selection': 4, - 'selection_str': 'C', - })]) - - converter = self.registry('ir.qweb.field.selection') - - field_name = 'selection' - value = converter.record_to_html(self.cr, self.uid, record, field_name, {}) + converter = self.get_converter('selection') + value = converter(4) self.assertEqual(value, e(u"rĂ©ponse <D>")) - field_name = 'selection_str' - value = converter.record_to_html(self.cr, self.uid, record, field_name, {}) + converter = self.get_converter('selection_str') + value = converter('C') self.assertEqual(value, u"Qu'est-ce qu'il fout ce maudit pancake, tabernacle ?") class TestHTMLExport(TestBasicExport): |
