[FIX] website_sale: access right for currency for public user

This commit is contained in:
Christophe Matthieu
2014-06-19 13:12:07 +02:00
committed by Christophe Simonis
parent a6185caa18
commit 43ca22d10c
2 changed files with 9 additions and 7 deletions
+3 -1
View File
@@ -171,6 +171,8 @@ class website(orm.Model):
_columns = {
'pricelist_id': fields.related('user_id','partner_id','property_product_pricelist',
type='many2one', relation='product.pricelist', string='Default pricelist'),
'company_currency_id': fields.related('company_id','partner_id','property_product_pricelist','currency_id',
type='many2one', relation='res.currency', string='Default pricelist'),
}
def sale_product_domain(self, cr, uid, ids, context=None):
@@ -265,7 +267,7 @@ class website(orm.Model):
})
def compute_curency(self, cr, uid, ids, from_amount, from_currency_id=None, context=None):
from_currency_id = from_currency_id or self.browse(cr, uid, ids[0]).pricelist_id.currency_id.id
from_currency_id = from_currency_id or self.browse(cr, SUPERUSER_ID, ids[0]).company_currency_id.id
to_currency_id = self.pool.get("res.users").browse(cr, uid, uid).partner_id.property_product_pricelist.currency_id.id
return self.pool['res.currency'].compute(cr, uid, from_currency_id, to_currency_id, from_amount, context=context)
+6 -6
View File
@@ -76,7 +76,7 @@
<t t-if="(website.compute_curency(product.lst_price) - product.price) &gt; 0.1">
<del class="text-danger" style="white-space: nowrap;" t-field="product.lst_price" t-field-options='{
"widget": "monetary",
"from_currency": "res_company.partner_id.property_product_pricelist.currency_id",
"from_currency": "website.company_currency_id",
"display_currency": "user_id.partner_id.property_product_pricelist.currency_id"
}'/>&amp;nbsp;
</t>
@@ -435,7 +435,7 @@
t-field="product.lst_price"
t-field-options='{
"widget": "monetary",
"from_currency": "res_company.partner_id.property_product_pricelist.currency_id",
"from_currency": "website.company_currency_id",
"display_currency": "user_id.partner_id.property_product_pricelist.currency_id"
}'/><br/>
</t>
@@ -486,7 +486,7 @@
t-field="product.lst_price"
t-field-options='{
"widget": "monetary",
"from_currency": "res_company.partner_id.property_product_pricelist.currency_id",
"from_currency": "website.company_currency_id",
"display_currency": "user_id.partner_id.property_product_pricelist.currency_id"
}'/><br/>
</t>
@@ -574,7 +574,7 @@
t-field="product.lst_price"
t-field-options='{
"widget": "monetary",
"from_currency": "res_company.partner_id.property_product_pricelist.currency_id",
"from_currency": "website.company_currency_id",
"display_currency": "user_id.partner_id.property_product_pricelist.currency_id"
}'/><br/>
</t>
@@ -822,7 +822,7 @@
<del class="text-danger" style="white-space: nowrap;"
t-field="line.product_id.lst_price" t-field-options='{
"widget": "monetary",
"from_currency": "res_company.partner_id.property_product_pricelist.currency_id",
"from_currency": "website.company_currency_id",
"display_currency": "user_id.partner_id.property_product_pricelist.currency_id"
}'/>&amp;nbsp;
</t>
@@ -919,7 +919,7 @@
<del class="text-danger" style="white-space: nowrap;"
t-field="product.lst_price" t-field-options='{
"widget": "monetary",
"from_currency": "res_company.partner_id.property_product_pricelist.currency_id",
"from_currency": "website.company_currency_id",
"display_currency": "user_id.partner_id.property_product_pricelist.currency_id"
}'/>&amp;nbsp;
</t>