← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 810548] [NEW] multi-company invoice validation error

 

Public bug reported:

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.

** Affects: openobject-addons
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/810548

Title:
  multi-company invoice validation error

Status in OpenERP Modules (addons):
  New

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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/810548/+subscriptions


Follow ups

References