Odoo Help


Expected singleton stock.picking

Arturo B.
on 9/20/16, 8:41 AM 1,084 views

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.

Arturo B.
On 9/20/16, 12:00 PM

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">
<strong>Delivery Order:</strong>
<p t-esc="o.get_delivery_order(o.origin)" />

Thank you very much for your help

Have you removed get_delivery_order method completely?

This method has to be present in account.invoice class. Please check that if it exists in inherited class.

Asmita Chavan
on 9/21/16, 2:44 AM
Asmita Chavan
On 9/20/16, 11:17 AM

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
     return ','.join(p_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.


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)


Asked: 9/20/16, 8:41 AM
Seen: 1084 times
Last updated: 9/20/16, 12:00 PM