[trunk / 6.1] system error creating invoice in multi-company context when customer has no payable/receivable account for current user's company
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
Related branches
- Olivier Dony (Odoo): Pending requested
-
Diff: 158 lines (+115/-22)3 files modifiedaccount/account_invoice.py (+28/-22)
account/tests/__init__.py (+27/-0)
account/tests/test_multi_company.py (+60/-0)
tags: | added: invoicing |
Hello Stephane,
Thanks for the good bug report!
The stack trace is below.
Server Traceback (most recent call last): amp/workspace/ rdtools/ web/trunk/ addons/ web/session. py", line 91, in send netsvc. dispatch_ rpc(service_ name, method, args) amp/workspace/ rdtools/ server/ trunk/openerp/ netsvc. py", line 361, in dispatch_rpc getService( service_ name).dispatch( method, params) amp/workspace/ rdtools/ server/ trunk/openerp/ service/ web_services. py", line 585, in dispatch amp/workspace/ rdtools/ server/ trunk/openerp/ osv/osv. py", line 167, in execute_kw amp/workspace/ rdtools/ server/ trunk/openerp/ osv/osv. py", line 121, in wrapper amp/workspace/ rdtools/ server/ trunk/openerp/ osv/osv. py", line 176, in execute amp/workspace/ rdtools/ server/ trunk/openerp/ osv/osv. py", line 164, in execute_cr amp/workspace/ rdtools/ addons/ trunk/account/ account_ invoice. py", line 453, in onchange_partner_id account_ receivable. company_ id.id != company_id and p.property_ account_ payable. company_ id.id != company_id:
File "/home/
return openerp.
File "/home/
result = ExportService.
File "/home/
res = fn(db, uid, *params)
File "/home/
return self.execute(db, uid, obj, method, *args, **kw or {})
File "/home/
return f(self, dbname, *args, **kwargs)
File "/home/
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/home/
return getattr(object, method)(cr, uid, *args, **kw)
File "/home/
if p.property_
AttributeError: 'NoneType' object has no attribute 'id'