diff --git a/addons/website/models/ir_qweb.py b/addons/website/models/ir_qweb.py index 6d46c0d4473..0a196869204 100644 --- a/addons/website/models/ir_qweb.py +++ b/addons/website/models/ir_qweb.py @@ -54,6 +54,9 @@ class Field(orm.AbstractModel): def from_html(self, cr, uid, model, column, element, context=None): return self.value_from_string(element.text_content().strip()) + def qweb_object(self): + return self.pool['website.qweb'] + class Integer(orm.AbstractModel): _name = 'website.qweb.field.integer' _inherit = ['website.qweb.field'] @@ -176,5 +179,26 @@ class Image(orm.AbstractModel): return out.getvalue().encode('base64') class Monetary(orm.AbstractModel): + """ + The website's monetary field/widget can become website-aware, and thus + should be able to use a pricelist somehow available through the session? + Why not directly the qweb context. There's also a method stored in + the ecommerce controller in website_sale, would that one be a good/better + idea? => just eval some string and hope that's a pricelist? + + Either way, it also gets the ability to fetch the "company" pricelist + via website.get_current().company_id (or 'res_company' in the qweb context) + + The widget then needs to call (ir.currency).compute(from_currency, + to_currency, value) to convert the company's to the user's during display + and the other way around during parsing + """ _name = 'website.qweb.field.monetary' _inherit = ['website.qweb.field', 'ir.qweb.field.monetary'] + + def source_currency(self, cr, uid, options): + assert 'source_currency' not in options,\ + u"The source currency is automatically defined by the website" \ + u" and must not be provided" + + return self.pool['website'].get_current().company_id.currency_id diff --git a/addons/website_sale/__init__.py b/addons/website_sale/__init__.py index c5e6825c179..27eba73191a 100644 --- a/addons/website_sale/__init__.py +++ b/addons/website_sale/__init__.py @@ -2,3 +2,4 @@ import controllers import website_styles import product import website_sale +import website diff --git a/addons/website_sale/views/website_sale.xml b/addons/website_sale/views/website_sale.xml index 03b786ece08..ee672fa4c47 100644 --- a/addons/website_sale/views/website_sale.xml +++ b/addons/website_sale/views/website_sale.xml @@ -113,11 +113,17 @@
- - € +   - € +
@@ -339,7 +345,10 @@ Standard - € +
@@ -349,10 +358,18 @@ - € +   -

€

+

@@ -454,9 +471,15 @@
- € +
- € +
@@ -486,11 +509,21 @@

Total:

-

€

+

+

+ Incl. Taxes: - € + + + @@ -574,7 +607,10 @@
- € + Add to Cart @@ -742,11 +778,20 @@
Subtotal:
-
€
+
Taxes:
-
€
+

Total To Pay:

-

€

+