diff --git a/addons/account/views/report_invoice.xml b/addons/account/views/report_invoice.xml index 80af37c8ee1..8e4401a7a16 100644 --- a/addons/account/views/report_invoice.xml +++ b/addons/account/views/report_invoice.xml @@ -85,7 +85,7 @@ + t-field-options='{"widget": "monetary", "display_currency": o.currency_id}'/> @@ -97,7 +97,7 @@ Subtotal - + @@ -111,7 +111,7 @@ Total - + diff --git a/addons/event/report/event_event_templates.xml b/addons/event/report/event_event_templates.xml index 39f4b21bf6f..efb46e5ce6f 100644 --- a/addons/event/report/event_event_templates.xml +++ b/addons/event/report/event_event_templates.xml @@ -18,7 +18,7 @@
-
( to )
+
( to )
@@ -69,7 +69,7 @@

-

( to )
+
( to )
diff --git a/addons/hr_expense/views/report_expense.xml b/addons/hr_expense/views/report_expense.xml index 78a0402a2ad..90c92c05792 100644 --- a/addons/hr_expense/views/report_expense.xml +++ b/addons/hr_expense/views/report_expense.xml @@ -55,7 +55,7 @@ + t-field-options='{"widget": "monetary", "display_currency": line.currency_id}'/> @@ -75,7 +75,7 @@ + t-field-options='{"widget": "monetary", "display_currency": line.currency_id}'/> diff --git a/addons/lunch/report/lunch_order_templates.xml b/addons/lunch/report/lunch_order_templates.xml index 58af7ebdc46..588e5392d2a 100644 --- a/addons/lunch/report/lunch_order_templates.xml +++ b/addons/lunch/report/lunch_order_templates.xml @@ -51,7 +51,7 @@ + t-field-options='{"widget": "monetary", "display_currency": user.company_id.currency_id}'/> diff --git a/addons/mrp_repair/views/report_mrprepairorder.xml b/addons/mrp_repair/views/report_mrprepairorder.xml index 0e66cba9ebc..df7e1049fa6 100644 --- a/addons/mrp_repair/views/report_mrprepairorder.xml +++ b/addons/mrp_repair/views/report_mrprepairorder.xml @@ -88,7 +88,7 @@ + t-field-options='{"widget": "monetary", "display_currency": o.pricelist_id.currency_id}'/> @@ -112,7 +112,7 @@ + t-field-options='{"widget": "monetary", "display_currency": o.pricelist_id.currency_id}'/> @@ -127,21 +127,21 @@ Total Without Taxes + t-field-options='{"widget": "monetary", "display_currency": o.pricelist_id.currency_id}'/> Taxes + t-field-options='{"widget": "monetary", "display_currency": o.pricelist_id.currency_id}'/> Total + t-field-options='{"widget": "monetary", "display_currency": o.pricelist_id.currency_id}'/> diff --git a/addons/point_of_sale/views/report_statement.xml b/addons/point_of_sale/views/report_statement.xml index bc4cc70b473..cedd7f55309 100644 --- a/addons/point_of_sale/views/report_statement.xml +++ b/addons/point_of_sale/views/report_statement.xml @@ -34,11 +34,11 @@
Starting Balance:
- +
Ending Balance:
- +
@@ -56,7 +56,7 @@ + t-field-options='{"widget": "monetary", "display_currency": res_company.currency_id}'/> @@ -67,7 +67,7 @@ - +
Total
diff --git a/addons/purchase/views/report_purchaseorder.xml b/addons/purchase/views/report_purchaseorder.xml index 138f40ca7e1..cdc15a3e754 100644 --- a/addons/purchase/views/report_purchaseorder.xml +++ b/addons/purchase/views/report_purchaseorder.xml @@ -76,7 +76,7 @@ + t-field-options='{"widget": "monetary", "display_currency": o.currency_id}'/> @@ -89,21 +89,21 @@ Total Without Taxes + t-field-options='{"widget": "monetary", "display_currency": o.currency_id}'/> Taxes + t-field-options='{"widget": "monetary", "display_currency": o.currency_id}'/> Total + t-field-options='{"widget": "monetary", "display_currency": o.currency_id}'/> diff --git a/addons/report_intrastat/report/report_intrastat_invoice_template.xml b/addons/report_intrastat/report/report_intrastat_invoice_template.xml index 65cb7c26cc4..4fa10563f72 100644 --- a/addons/report_intrastat/report/report_intrastat_invoice_template.xml +++ b/addons/report_intrastat/report/report_intrastat_invoice_template.xml @@ -67,7 +67,7 @@ + t-field-options='{"widget": "monetary", "display_currency": o.currency_id}'/> @@ -79,19 +79,19 @@ Total Without Taxes - + Taxes - + Total - + @@ -112,7 +112,7 @@ + t-field-options='{"widget": "monetary", "display_currency": o.currency_id}'/> diff --git a/addons/sale/views/report_invoice_layouted.xml b/addons/sale/views/report_invoice_layouted.xml index bcbf57de207..3ee9d65c707 100644 --- a/addons/sale/views/report_invoice_layouted.xml +++ b/addons/sale/views/report_invoice_layouted.xml @@ -48,7 +48,7 @@ + t-field-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
diff --git a/addons/sale/views/report_saleorder.xml b/addons/sale/views/report_saleorder.xml index 471c7a47ac3..a603688a19b 100644 --- a/addons/sale/views/report_saleorder.xml +++ b/addons/sale/views/report_saleorder.xml @@ -97,7 +97,7 @@ + t-field-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/> @@ -128,7 +128,7 @@ Total Without Taxes + t-field-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/> @@ -143,7 +143,7 @@ Total + t-field-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/> diff --git a/addons/website/models/ir_qweb.py b/addons/website/models/ir_qweb.py index c8c0fe64613..6c9cd9f41b7 100644 --- a/addons/website/models/ir_qweb.py +++ b/addons/website/models/ir_qweb.py @@ -2,7 +2,6 @@ from openerp.addons.web.http import request from openerp.osv import orm import ast -from openerp.addons.base.ir.ir_qweb import utils class QWeb(orm.AbstractModel): @@ -29,7 +28,7 @@ class QWeb(orm.AbstractModel): ] def _website_build_attribute(self, tagName, name, value, qwebcontext): - context = qwebcontext.context or {} + context = qwebcontext.env.context or {} if not context.get('rendering_bundle'): if name == self.URL_ATTRS.get(tagName) and qwebcontext.get('url_for'): return qwebcontext.get('url_for')(value or '') 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 10dff2e264b..f4f628bd501 100644 --- a/addons/website_event_sale/views/website_event_sale_templates.xml +++ b/addons/website_event_sale/views/website_event_sale_templates.xml @@ -40,13 +40,13 @@ 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 860ea6e1bd1..1e85296688f 100644 --- a/addons/website_event_track/views/website_event_track_templates.xml +++ b/addons/website_event_track/views/website_event_track_templates.xml @@ -248,7 +248,7 @@ Date

Duration
-
+
Location

diff --git a/addons/website_portal_sale/views/templates.xml b/addons/website_portal_sale/views/templates.xml index 80103dca671..0b251c6abb9 100644 --- a/addons/website_portal_sale/views/templates.xml +++ b/addons/website_portal_sale/views/templates.xml @@ -91,7 +91,7 @@ Expired
- + @@ -136,7 +136,7 @@ Done - + @@ -186,7 +186,7 @@ Pay Now - + @@ -319,7 +319,7 @@
- +
@@ -330,7 +330,7 @@
- +
@@ -350,7 +350,7 @@ Untaxed Amount:
- +
@@ -358,7 +358,7 @@ Taxes:
- +
@@ -366,7 +366,7 @@ Total:
- +
diff --git a/addons/website_quote/views/report_saleorder.xml b/addons/website_quote/views/report_saleorder.xml index bb70ad82778..1a2ad2606b5 100644 --- a/addons/website_quote/views/report_saleorder.xml +++ b/addons/website_quote/views/report_saleorder.xml @@ -38,7 +38,7 @@
diff --git a/addons/website_quote/views/website_quotation.xml b/addons/website_quote/views/website_quotation.xml index d1b309dc62f..7ba8c719aaf 100644 --- a/addons/website_quote/views/website_quotation.xml +++ b/addons/website_quote/views/website_quotation.xml @@ -61,7 +61,7 @@ @@ -292,7 +292,7 @@ I agree that by signing this proposal, I accept it on the behalf of , for an amount of + t-field-options='{"widget": "monetary", "display_currency": quotation.pricelist_id.currency_id}'/> with payment terms: .

@@ -319,7 +319,7 @@ I agree that by paying this proposal, I accept it on the behalf of , for an amount of + t-field-options='{"widget": "monetary", "display_currency": quotation.pricelist_id.currency_id}'/> with payment terms: .

@@ -587,7 +587,7 @@
@@ -699,7 +699,7 @@ Expired - + diff --git a/addons/website_sale/views/report_shop_saleorder.xml b/addons/website_sale/views/report_shop_saleorder.xml index 823c16d32ae..74519e6b78a 100644 --- a/addons/website_sale/views/report_shop_saleorder.xml +++ b/addons/website_sale/views/report_shop_saleorder.xml @@ -35,7 +35,7 @@ + t-field-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/> diff --git a/addons/website_sale/views/templates.xml b/addons/website_sale/views/templates.xml index 3b1df7dd892..3ad3e76dced 100644 --- a/addons/website_sale/views/templates.xml +++ b/addons/website_sale/views/templates.xml @@ -78,7 +78,7 @@
@@ -97,13 +97,13 @@ @@ -437,14 +437,14 @@ t-field="product.lst_price" t-field-options='{ "widget": "monetary", - "from_currency": "product.currency_id", - "display_currency": "website.currency_id" + "from_currency": product.currency_id, + "display_currency": website.currency_id }'/> @@ -453,7 +453,7 @@ @@ -473,8 +473,8 @@ @@ -498,8 +498,8 @@ @@ -518,8 +518,8 @@ @@ -793,12 +793,12 @@ @@ -914,13 +914,13 @@ @@ -1169,8 +1169,8 @@ @@ -1310,13 +1310,13 @@
+ t-field-options='{"widget": "monetary", "display_currency": order.pricelist_id.currency_id}'/>
+ t-field-options='{"widget": "monetary", "display_currency": order.pricelist_id.currency_id}'/> @@ -1324,7 +1324,7 @@ Total: + t-field-options='{"widget": "monetary", "display_currency": order.pricelist_id.currency_id}'/> @@ -1341,7 +1341,7 @@ Total: + t-field-options='{"widget": "monetary", "display_currency": order.pricelist_id.currency_id}'/> @@ -1410,8 +1410,8 @@
@@ -1420,8 +1420,8 @@
@@ -1430,8 +1430,8 @@
diff --git a/addons/website_sale_delivery/views/website_sale_delivery.xml b/addons/website_sale_delivery/views/website_sale_delivery.xml index 8beffca2b70..90d9e2665cc 100644 --- a/addons/website_sale_delivery/views/website_sale_delivery.xml +++ b/addons/website_sale_delivery/views/website_sale_delivery.xml @@ -9,8 +9,8 @@
@@ -38,8 +38,8 @@
diff --git a/addons/website_sale_options/views/templates.xml b/addons/website_sale_options/views/templates.xml index cf262d3abfb..b36e1eb7cb9 100644 --- a/addons/website_sale_options/views/templates.xml +++ b/addons/website_sale_options/views/templates.xml @@ -59,15 +59,15 @@ t-field="product.lst_price" t-field-options='{ "widget": "monetary", - "from_currency": "product.currency_id", - "display_currency": "website.currency_id" + "from_currency": product.currency_id, + "display_currency": website.currency_id }'/> @@ -106,14 +106,14 @@ t-field="product.lst_price" t-field-options='{ "widget": "monetary", - "from_currency": "product.currency_id", - "display_currency": "website.currency_id" + "from_currency": product.currency_id, + "display_currency": website.currency_id }'/>

Product not available

diff --git a/openerp/addons/base/ir/ir_qweb/fields.py b/openerp/addons/base/ir/ir_qweb/fields.py index a1b6b32f281..92638b5b11c 100644 --- a/openerp/addons/base/ir/ir_qweb/fields.py +++ b/openerp/addons/base/ir/ir_qweb/fields.py @@ -6,7 +6,7 @@ from PIL import Image from cStringIO import StringIO import babel from openerp.tools import html_escape as escape, posix_to_ldml -from .utils import QWebContext, eval_expr, unicodifier +from .utils import QWebContext, unicodifier import logging _logger = logging.getLogger(__name__) @@ -308,7 +308,7 @@ class MonetaryConverter(models.AbstractModel): display_currency = record[field.currency_field] #otherwise fall back to old method if not display_currency: - display_currency = self.display_currency(options['display_currency'], qwebcontext) + 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 @@ -320,8 +320,7 @@ class MonetaryConverter(models.AbstractModel): from_amount = record[field_name] if options.get('from_currency'): - from_currency = self.display_currency(options['from_currency'], qwebcontext) - from_amount = from_currency.compute(from_amount, display_currency) + from_amount = options['from_currency'].compute(from_amount, display_currency) lang = self.user_lang() formatted_amount = lang.format(fmt, display_currency.round(from_amount), @@ -339,11 +338,6 @@ class MonetaryConverter(models.AbstractModel): symbol=display_currency.symbol, ) - @api.model - def display_currency(self, currency, qwebcontext): - return eval_expr(currency, qwebcontext) - - TIMEDELTA_UNITS = ( ('year', 3600 * 24 * 365), ('month', 3600 * 24 * 30), diff --git a/openerp/addons/base/ir/ir_qweb/qweb.py b/openerp/addons/base/ir/ir_qweb/qweb.py index b6ae1f8856e..1dfa52e0502 100644 --- a/openerp/addons/base/ir/ir_qweb/qweb.py +++ b/openerp/addons/base/ir/ir_qweb/qweb.py @@ -866,7 +866,7 @@ class QWeb(models.AbstractModel): ast.Str(expression), ast.Name(id='default_content', ctx=ast.Load()), ast.Str(node_name), - options and utils.compile_format(options) or ast.Name(id='None', ctx=ast.Load()), + options and utils.compile_expr(options) or ast.Dict(keys=[], values=[]), ast.Name(id='qwebcontext', ctx=ast.Load()), ], keywords=[], starargs=None, kwargs=None @@ -949,7 +949,6 @@ class QWeb(models.AbstractModel): return (files, remains) def _get_field(self, record, field_name, expression, default_content, tagName, options, qwebcontext): - options = options and json.loads(options) or {} field = record._fields[field_name] field_type = options.get('widget', field.type)