tax report error in multi company

Bug #1110189 reported by JB (eficent.com)
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Confirmed
Medium
OpenERP R&D Addons Team 3

Bug Description

Hello,

I have set-up two companies, unlinked to each other.

When I login in one of the companies with a user that has been set-up specifically for that company, and attempt to run the tax report, the system throws an error message indicating that the user does not have permission to read the object tax.code.

I'm debugging, and find that the account.tax.report report attempts to read during the call to _set_context to a tax code that belongs to the other company.

When I login with a user on the other company, the report is run with no errors.

So, looks like the report attempts to read a random tax code during the initial set-up regardless of what company does the tax code belongs to....

Any ideas??

Regards,
Jordi
www.eficent.com

Tags: taxes
Revision history for this message
Atul Makwana(SerpentCS) (amakwana-serpentcs) wrote :

Hello Jordi,

I just checked here and found no issues whatsoever.

Where exactly do you suspect random company_id and tax code being malformed?

I have seen the code and I think everything is ok.

Would you please make sure of any record rule?

Thanks,
Atul,
Serpent Consulting Services.

Revision history for this message
JB (eficent.com) (jb.eficent) wrote :

Hello! Thanks Atul for your feedback.

I finally found the cause of the error. In account/wizard/account_vat.py, by doing this change..

...
    def create_vat(self, cr, uid, ids, context=None):
        if context is None:
            context = {}
- datas = {'ids': []}
+ datas = {'ids': context.get('active_ids', [])}

That is, replacing "datas = {'ids': context.get('active_ids', [])}" with datas = {'ids': []} the error is solved.

While debugging with a user with permissions to work in company 1 on this sentence I found that context.get('active_ids', []) returned a tax code object that belonged company 2! How could that tax code from company 2 get into the context? No idea.... The fact is that report account.vat.declaration is then called passing in 'datas' this object, which the system attempts to read in account_tax_report.py, in function set_context and throws the error.

Revision history for this message
Serpent Consulting Services (serpent-consulting-services) wrote :

Jordi,

Good catch! I have yet to face though.

Active_ids should be ids of menu here, isnt it?

Thanks.

Revision history for this message
JB (eficent.com) (jb.eficent) wrote :

Well, active_ids is being passed into the report as a tax.code object. I understand that the wizard is associated to the tax.code object.

I don't really understand the role of active_ids in the wizard...

Revision history for this message
Amit Parik (amit-parik) wrote :

Hello,

I have tested the same but I could not reach to the result as JB is specified on bug report due to different error.

I have faced this following error.

The requested operation cannot be completed due to security restrictions. Please contact your system administrator.
Document type: Partner, Operation: read) even I assign the full rights to the user.

May be I think this problem comes from the multi-company record rule but not sure yet.

I request to R&D team that first resolve this issue then after check the problem reported under the bug.

Thank you!

Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 3 (openerp-dev-addons3)
importance: Undecided → Medium
status: New → Confirmed
Amit Parik (amit-parik)
tags: added: taxes
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.