multi-company invoice validation error

Bug #810548 reported by Paulius Sladkevičius @ hbee
26
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Medium
OpenERP R&D Addons Team 3

Bug Description

I try confirm invoice with admin user and another company. Then I get error "Company must be same for its related account and period.". Account and period are defined for same company.

After searching for a problem I find out that constrain (_check_company_id) from the account_move_line have line:

"if l.company_id != l.account_id.company_id or l.company_id != l.period_id.company_id:" and field 'company_id': "
http://bazaar.launchpad.net/~openerp/openobject-addons/trunk/view/head:/account/account_move_line.py#L587

and saw that company_id field is related with account_id:
'company_id': fields.related('account_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True)
http://bazaar.launchpad.net/~openerp/openobject-addons/trunk/view/head:/account/account_move_line.py#L517

So question is why it needs check when l.company_id must be same like l.account_id.company_id, because it is related field?

For me problem is that company_id is not same like l.account_id.company_id, but when I comment 587 line everything goes okay and account move and account move lines are created for same company which was in invoice. So I think it is problem with related field which don't show good value when I want confirm invoice.

Related branches

Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 3 (openerp-dev-addons3)
importance: Undecided → Medium
status: New → Confirmed
Changed in openobject-addons:
status: Confirmed → In Progress
Revision history for this message
Ashvin Rathod (OpenERP) (ara-tinyerp) wrote :

Hello Paulius,

Yes as per your specified problem i have done some research on it which concludes you have to set company for admin user from user/preferences so that it can take related income/expense accounts from property fields on product for given company on invoice and I have remove the code l.company_id != l.account_id.company_id because its not required for related field and its fixed in lp:~openerp-dev/openobject-addons/trunk-bug-810548-ara branch.

Revision ID: <email address hidden>
Revision No: 4892

Thanks,
ara

Changed in openobject-addons:
status: In Progress → Fix Committed
Changed in openobject-addons:
milestone: none → 6.1
Revision history for this message
Paulius Sladkevičius @ hbee (komsas) wrote :

Thanks for the fix! Question, why you don't include it to the stable version?

Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

the proposed branch was incorrect, I reopen the bug.
We need this constraint, the problem is elsewhere (something is created with the wrong company_id, probably the move or move line)

Changed in openobject-addons:
status: Fix Committed → Confirmed
Revision history for this message
DJ Patel (OpenERP) (mdi-openerp) wrote :

Hello Paulius Sladkevičius,

Thanks for reporting. The solution for this bug is proposed in the branch with following Revision ID and Number.

Revision ID : <email address hidden>
Revision Number : 5404

Regards,
Divyesh Makwana(MDI)

Changed in openobject-addons:
status: Confirmed → In Progress
status: In Progress → Fix Committed
Revision history for this message
qdp (OpenERP) (qdp) wrote :

still incorrect, i reopen the bug

Changed in openobject-addons:
status: Fix Committed → Confirmed
Changed in openobject-addons:
status: Confirmed → In Progress
status: In Progress → Fix Committed
Revision history for this message
qdp (OpenERP) (qdp) wrote :

Hello the fix for that bug has finally been released in revision 5703 of trunk addons.

Thanks for the contribution,
Quentin

Changed in openobject-addons:
status: Fix Committed → Fix Released
Revision history for this message
Michael Karrer (michaelkarrer81) wrote :

This bug is still present in the latest openerp 7.0 !!!

Revision history for this message
Laurent Urbain (Realdolmen) (laurent-urbain) wrote :

I confirm the bug in 7.0

Revision history for this message
António Sequeira (antonio-sequeira) wrote :

Hello,

I also confirm this bug in version 7.0-20130114-001605.

I used this fix and it solved the problem here but I'm not sure if this doesn't have other consequences elsewhere.

Anyone can comment on this? will it be a confirmed bug in multi-company and the fix released?

Regards
AS

Revision history for this message
qdp (OpenERP) (qdp) wrote :

Hello,

you were right. I just fixed it properly in addons v7.

revision: 9132
rev-id: <email address hidden>

thanks for pointing us this issue again,
Quentin

Revision history for this message
Daniel Torres (daniel-torres-julian) wrote :

hi Quentin,

Can you please tell me how to download the revision that you say and install it in my server?

I don't find anywhere how to do it.

Thanks!

Revision history for this message
qdp (OpenERP) (qdp) wrote :

Hi Daniel,

you can find the last revision v7 packaged here: http://nightly.openerp.com/7.0/nightly/

it includes all the fixes published since yesterday and it's updated on a daily basis.

Best Regards

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.