Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I have a problem in Odoo 8 whenever I try to print an invoice that has two different delivery order. I get the following error:
File "C:\Program Files (x86)\Odoo 8.0-20160326\server\openerp\addons\company_accounts\account_invoice.py",line 24, in get_delivery_order File "C:\Program Files (x86)\Odoo 8.0-20160326\server\.\openerp\fields.py", line 824, in __get__ File "C:\Program Files (x86)\Odoo 8.0-20160326\server\.\openerp\models.py", line 5306, in ensure_oneQWebException: "ValueErrorExpected singleton: stock.picking(59, 58)" while evaluating"translate_doc(doc_id, doc_model, 'partner_id.lang', 'account.report_invoice_document')"
when I access account_invoice.py the code affected is the following:
def get_delivery_order(self, cr, uid, order_origin, context=None):
p_id = self.pool.get('stock.picking').search(cr, uid, [('origin', '=', order_origin)])
return self.pool.get('stock.picking').browse(cr, uid, p_id).name
This error only happens if my invoice has more than one delivery order related to it, and I don't know how to solve it. It was coding done by a third party, and we didn't run into problems with it until now. I think that the problem is that it is expecting only one delivery order and it is getting more than one, but I'm unsure on how to solve it.
It works to some extent, but now I get an error when trying to print any invoice. The error is as follows
QWebException: ""'account.invoice' object has no attribute 'get_delivery_order'" while evaluating'o.get_delivery_order(o.origin)'" while evaluating"translate_doc(doc_id, doc_model, 'partner_id.lang', 'account.report_invoice_document')"
I think this is referencing "report_invoice.xml", which has the following
<div class="col-xs-3" t-if="o.origin">
<p t-esc="o.get_delivery_order(o.origin)" />
Thank you very much for your help
Replace def get_delivery_order method with :
def get_delivery_order((self, cr, uid, order_origin, context=None):
p_name = 
p_ids = self.pool.get('stock.picking').search(cr, uid, [('origin', '=', order_origin)])
for p_id in p_ids:
name = self.pool.get('stock.picking').browse(cr, uid, p_id).name
Hope it works for you.
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
|Asked: 9/20/16, 8:41 AM|
|Seen: 711 times|
|Last updated: 9/20/16, 12:00 PM|