Odoo Help

0

Uncaught exception on creating invoice from Purchase Order without products

By
Alessandro Domanico
on 9/24/15, 11:21 AM 639 views

When creating invoice from a purchase order, with any Invoicing Control Method, it will show an Uncaught exception if the product field is left empty. This is due to the fact that the Invoice creation needs the "Expense Account" for each item, information that OE takes from the product itself or its parent categories:

2015-09-24 15:14:23,720 4952 ERROR TOSA_DEBUG openerp.osv.osv: Uncaught exception

Traceback (most recent call last):
File "C:\Users\Nanni\git\odoo\openerp\osv\osv.py", line 132, in wrapper
return f(self, dbname, *args, **kwargs)
File "C:\Users\Nanni\git\odoo\openerp\osv\osv.py", line 199, in execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "C:\Users\Nanni\git\odoo\openerp\osv\osv.py", line 187, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "C:\Users\Nanni\git\odoo\addons\purchase\wizard\purchase_line_invoice.py", line 99, in makeInvoices
acc_id = purchase_obj._choose_account_from_po_line(cr, uid, line, context=context)
File "C:\Users\Nanni\git\odoo\addons\purchase\purchase.py", line 502, in _choose_account_from_po_line
acc_id = property_obj.get(cr, uid, 'property_account_expense_categ', 'product.category', context=context).id
AttributeError: 'bool' object has no attribute 'id'
2015-09-24 15:14:23,720 4952 ERROR TOSA_DEBUG openerp.netsvc: 'bool' object has no attribute 'id'
Traceback (most recent call last):
File "C:\Users\Nanni\git\odoo\openerp\netsvc.py", line 300, in dispatch_rpc
result = ExportService.getService(service_name).dispatch(method, params)
File "C:\Users\Nanni\git\odoo\openerp\service\web_services.py", line 632, in dispatch
res = fn(db, uid, *params)
File "C:\Users\Nanni\git\odoo\openerp\osv\osv.py", line 190, in execute_kw
return self.execute(db, uid, obj, method, *args, **kw or {})
File "C:\Users\Nanni\git\odoo\openerp\osv\osv.py", line 132, in wrapper
return f(self, dbname, *args, **kwargs)
File "C:\Users\Nanni\git\odoo\openerp\osv\osv.py", line 199, in execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "C:\Users\Nanni\git\odoo\openerp\osv\osv.py", line 187, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "C:\Users\Nanni\git\odoo\addons\purchase\wizard\purchase_line_invoice.py", line 99, in makeInvoices
acc_id = purchase_obj._choose_account_from_po_line(cr, uid, line, context=context)
File "C:\Users\Nanni\git\odoo\addons\purchase\purchase.py", line 502, in _choose_account_from_po_line
acc_id = property_obj.get(cr, uid, 'property_account_expense_categ', 'product.category', context=context).id
AttributeError: 'bool' object has no attribute 'id'
2015-09-24 15:14:23,752 4952 INFO TOSA_DEBUG werkzeug: 127.0.0.1 - - [24/Sep/2015 15:14:23] "POST /web/dataset/call_button HTTP/1.1" 200 -
2015-09-24 15:14:30,742 4952 ERROR TOSA_DEBUG openerp.osv.osv: Uncaught exception
Traceback (most recent call last):
File "C:\Users\Nanni\git\odoo\openerp\osv\osv.py", line 132, in wrapper
return f(self, dbname, *args, **kwargs)
File "C:\Users\Nanni\git\odoo\openerp\osv\osv.py", line 199, in execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "C:\Users\Nanni\git\odoo\openerp\osv\osv.py", line 187, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "C:\Users\Nanni\git\odoo\addons\purchase\wizard\purchase_line_invoice.py", line 99, in makeInvoices
acc_id = purchase_obj._choose_account_from_po_line(cr, uid, line, context=context)
File "C:\Users\Nanni\git\odoo\addons\purchase\purchase.py", line 502, in _choose_account_from_po_line
acc_id = property_obj.get(cr, uid, 'property_account_expense_categ', 'product.category', context=context).id
AttributeError: 'bool' object has no attribute 'id'
2015-09-24 15:14:30,742 4952 ERROR TOSA_DEBUG openerp.netsvc: 'bool' object has no attribute 'id'
Traceback (most recent call last):
File "C:\Users\Nanni\git\odoo\openerp\netsvc.py", line 300, in dispatch_rpc
result = ExportService.getService(service_name).dispatch(method, params)
File "C:\Users\Nanni\git\odoo\openerp\service\web_services.py", line 632, in dispatch
res = fn(db, uid, *params)
File "C:\Users\Nanni\git\odoo\openerp\osv\osv.py", line 190, in execute_kw
return self.execute(db, uid, obj, method, *args, **kw or {})
File "C:\Users\Nanni\git\odoo\openerp\osv\osv.py", line 132, in wrapper
return f(self, dbname, *args, **kwargs)
File "C:\Users\Nanni\git\odoo\openerp\osv\osv.py", line 199, in execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "C:\Users\Nanni\git\odoo\openerp\osv\osv.py", line 187, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "C:\Users\Nanni\git\odoo\addons\purchase\wizard\purchase_line_invoice.py", line 99, in makeInvoices
acc_id = purchase_obj._choose_account_from_po_line(cr, uid, line, context=context)
File "C:\Users\Nanni\git\odoo\addons\purchase\purchase.py", line 502, in _choose_account_from_po_line
acc_id = property_obj.get(cr, uid, 'property_account_expense_categ', 'product.category', context=context).id
AttributeError: 'bool' object has no attribute 'id'

This seems like a bug in the standard, it needs to be reported as a bug. My suggestion is to create a custom module to show an error message that there is a missing product in some lines

Tarek Mohamed Ibrahim
on 9/25/15, 2:09 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 9/24/15, 11:21 AM
Seen: 639 times
Last updated: 9/25/15, 2:09 AM