[FIX] base: company contact data

As a portal user, access one of your invoices from the frontend
(download the PDF). The generation of the report crashes because of an
access error. The error arises when trying to access the company contact
information (address, phone, fax...) displayed in the report footer.

This is due an API migration error (7eab8e26d3). Before the migration,
the partner was browsed in `_get_address_data` as:
`address = part_obj.read(cr, openerp.SUPERUSER_ID, ...`

After the migration, this is not browsed as superuser anymore.
Therefore, users with limited access rights won't be able to read it
anymore.

opw-708581
This commit is contained in:
Nicolas Martinelli
2017-02-15 13:04:47 +01:00
parent d506199988
commit ad50324a8e
+1 -1
View File
@@ -164,7 +164,7 @@ class Company(models.Model):
for company in self.filtered(lambda company: company.partner_id):
address_data = company.partner_id.sudo().address_get(adr_pref=['contact'])
if address_data['contact']:
partner = company.partner_id.browse(address_data['contact'])
partner = company.partner_id.browse(address_data['contact']).sudo()
company.street = partner.street
company.street2 = partner.street2
company.city = partner.city