This question has been flagged
1 Reply
4352 Views

Can anyone explain what the data['ids'] field is used for in openerp reports?

I am getting some odd permission denied errors in regards to the Aged Partner Balance report. After some debugging I discovered it was trying to access a partner it didnt have permission to view using the ID of the chart of account selected for the report... I suspect the issue is caused by this line in account_report_aged_partner_balance.py, line 82:

        data['ids']=[data['form'].get('chart_account_id',False)]

Most other reports seem to set data['ids'] to active_ids instead:

        data['ids']=context.get('active_ids', [])

In fact, replacing line 82 in account_report_aged_partner_balance.py with the line directly above prevents the permission errors I was getting.

Can anyone offer any kind of insight as to why the Aged Partner Balance would be setting 'ids' to the chart of account id? Also, whether my fix above would have any un-forseen consequences and break something else I am unaware of?

Avatar
Discard
Best Answer

Hi dawn, you are true generally we pass context.get('active_ids', []) only if the wizard is in form view

E.g. Trial Balance in Accounts form view.

In wizard like this context.get('active_ids', []) gives us the id of the record from which we have opened the wizard.

But here in this case of Aged Partner Balance report context.get('active_ids', []) will give us menu id of Aged Partner Balance wizard(Accounting/Reporting/Generic Reporting/Partners/Aged Partner Balance). So it is no use to pass active_ids.

Thanks.

Avatar
Discard
Author

Thanks for your reply Keyur! Would you be able to tell me why the Aged Partner Balance uses the chart of accounts id here instead? What it seems to be doing on my end as a result is trying to access a res.partner with that chart of accounts id...which has completely baffled me

It is a little bit confusing why it uses chart of account id, on my point of view there is no use of chart_account_id in report py file. Maybe it is the case that wizard is inherited so that means if it is opened from other place too so it should not give error maybe that's why they used chart_account_id. They have used data['form'] at most places in report rml & py of Aged Partner Balance. But I will respond to this question as soon as I get the solution. Thanks.

Author

Thanks again Keyur. I will probably try make a bug report if I manage to replicate my issue on a simpler database than our large one. Have upvoted your reponse in the meantime and look forward to hearing any updates from you!