[FIX] website_sale: use commercial_partner_id instead of parent_id to have the compan...
authorDenis Ledoux <dle@openerp.com>
Thu, 10 Apr 2014 09:58:14 +0000 (11:58 +0200)
committerDenis Ledoux <dle@openerp.com>
Thu, 10 Apr 2014 09:58:14 +0000 (11:58 +0200)
If the user is portal, its partner is a company and has a parent: a security rule prevent to read the parent_id
and the company which should be displayed is the closest company of the partner in the hierarchy, and, in this case, itself.

bzr revid: dle@openerp.com-20140410095814-x7hqymfelspvjdsw

addons/website_sale/controllers/main.py

index 4ef5229..75dce8e 100644 (file)
@@ -43,7 +43,7 @@ class CheckoutInfo(object):
         result = dict((prefix + field_name, getattr(partner, field_name)) for field_name in self.string_billing_fields if getattr(partner, field_name))
         result[prefix + 'state_id'] = partner.state_id and partner.state_id.id or ''
         result[prefix + 'country_id'] = partner.country_id and partner.country_id.id or ''
-        result[prefix + 'company'] = partner.parent_id and partner.parent_id.name or ''
+        result[prefix + 'company'] = partner.commercial_partner_id and partner.commercial_partner_id.is_company and partner.commercial_partner_id.name or ''
         return result
 
     def from_post(self, post):