[trunk / 6.1] system error creating invoice in multi-company context when customer has no payable/receivable account for current user's company

Bug #1067375 reported by Stéphane Bidoul (Acsone)
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Medium
OpenERP R&D Addons Team 3

Bug Description

Hello,

When creating a customer invoice in a multi-company context, a stack-trace is generated when the user selects a customer which has no payable/receivable account defined for the current user's company.

This applies to 6.1 and trunk.

How to reproduce:
1. install trunk, accounting module, no demo data, initialize the Belgian chart of account for the default company
2. activate multi-company feature in general settings
3. set multi-company and technical feature right for user Administrator
4. create a customer named Customer1
5. create a new company called Mother Company and set it as parent of the default Company, do not create an account chart for the mother company
6. in user preferences, switch to Mother Company
7. create a new Customer Invoice:
   * a warning is produced saying there is no sales journal on Mother Company; this is normal
   * select the Sales Journal
   * select Customer 1 -> stack trace below

Expected result: no stack trace or a warning.

I'll attach a merge proposal.

-sbi

Tags: invoicing

Related branches

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

Hello Stephane,

Thanks for the good bug report!

The stack trace is below.

Server Traceback (most recent call last):
  File "/home/amp/workspace/rdtools/web/trunk/addons/web/session.py", line 91, in send
    return openerp.netsvc.dispatch_rpc(service_name, method, args)
  File "/home/amp/workspace/rdtools/server/trunk/openerp/netsvc.py", line 361, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/home/amp/workspace/rdtools/server/trunk/openerp/service/web_services.py", line 585, in dispatch
    res = fn(db, uid, *params)
  File "/home/amp/workspace/rdtools/server/trunk/openerp/osv/osv.py", line 167, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
  File "/home/amp/workspace/rdtools/server/trunk/openerp/osv/osv.py", line 121, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/amp/workspace/rdtools/server/trunk/openerp/osv/osv.py", line 176, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/amp/workspace/rdtools/server/trunk/openerp/osv/osv.py", line 164, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/amp/workspace/rdtools/addons/trunk/account/account_invoice.py", line 453, in onchange_partner_id
    if p.property_account_receivable.company_id.id != company_id and p.property_account_payable.company_id.id != company_id:
AttributeError: 'NoneType' object has no attribute 'id'

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: invoicing
Revision history for this message
Twinkle Christian(OpenERP) (tch-openerp) wrote :

Hello,

Not able to reproduce any more . checked with following builds :

   (Build 27278)
    server (5020)
    addons (9038)
    web (3910)

So, I am marking it as 'Fix released ' .

Regards,

Changed in openobject-addons:
status: Confirmed → Fix Released
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.