Comment 7 for bug 1111298

Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

Hello,

Ok my analysis was wrong. It was working by pure coincidence.

In fact when you do an inv.company_id.xxx we have a problem.

The point is the following
pp inv._data

=> {4: {'origin': False, 'text_condition2': <openerp.osv.orm.browse_null object at 0x5ec1510>, 'date_due': '2013-02-25', 'check_total': 0.0, 'partner_bank_id': <openerp.osv.orm.browse_null object at 0x5ec1110>, 'supplier_invoice_number': False, 'number': False, 'company_id': browse_record(res.company, 4), 'currency_id': browse_record(res.currency, 1), 'text_condition1': <openerp.osv.orm.browse_null object at 0x5ec1810>, 'partner_id': browse_record(res.partner, 11), 'id': 4, 'fiscal_position': browse_record(account.fiscal.position, 12), 'user_id': browse_record(res.users, 6), 'reference': False, 'note1': False, 'tax_line': [browse_record(account.invoice.tax, 20), browse_record(account.invoice.tax, 19)], 'payment_term': <openerp.osv.orm.browse_null object at 0x5ec10d0>, 'reference_type': u'none', 'journal_id': browse_record(account.journal, 18), 'amount_tax': 0.0, 'state': u'draft', 'type': u'out_invoice', 'sent': False, 'internal_number': False, 'account_id': browse_record(account.account, 4488), 'reconciled': False, 'residual': 0.0, 'move_name': False, 'date_invoice': False, 'note2': False, 'period_id': <openerp.osv.orm.browse_null object at 0x5ec0f90>, 'amount_untaxed': 50.0, 'move_id': <openerp.osv.orm.browse_null object at 0x5ec0dd0>, 'amount_total': 50.0, 'name': False, 'comment': False, 'invoice_line': [browse_record(account.invoice.line, 5)]}}

comp = inv.company_id
pp comp
=> browse_record(res.company, 4)
pp comp.data
=>{1: {'id': 1}, 4: {'id': 4}}

Here we can see the data are incorrect. I am not browsing the company_id 1. The id 1 is the id of the currency, but when __get_item__ is called it tries to read the company 1 that is not in allowed companies.

Regards

Nicolas