← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 810548] Re: multi-company invoice validation error

 

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: ara@xxxxxxxxxxx-20110722102650-ojk1i3f86vs2f1sg 
Revision No: 4892

Thanks,
ara

** Changed in: openobject-addons
       Status: In Progress => Fix Committed

-- 
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):
  Fix Committed

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


References