Odoo Help


how to solve value error ----- Expected singleton: sale.order(131, 128, 102, 101, 98, 97, 96, 95, 93, 92, 91, 90, 83, 80)

Apoorv Soral
on 11/12/16, 9:05 AM 333 views

Traceback (most recent call last):

  File "/home/pchouksey1/workspace/dexciss/core/openerp/http.py", line 543, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "/home/pchouksey1/workspace/dexciss/core/openerp/http.py", line 580, in dispatch result = self._call_function(**self.params) File "/home/pchouksey1/workspace/dexciss/core/openerp/http.py", line 316, in _call_function return checked_call(self.db, *args, **kwargs) File "/home/pchouksey1/workspace/dexciss/core/openerp/service/model.py", line 118, in wrapper return f(dbname, *args, **kwargs) File "/home/pchouksey1/workspace/dexciss/core/openerp/http.py", line 313, in checked_call return self.endpoint(*a, **kw) File "/home/pchouksey1/workspace/dexciss/core/openerp/http.py", line 809, in __call__ return self.method(*args, **kw) File "/home/pchouksey1/workspace/dexciss/core/openerp/http.py", line 409, in response_wrap response = f(*args, **kw) File "/home/pchouksey1/workspace/dexciss/core/addons/web/controllers/main.py", line 948, in call_button action = self._call_kw(model, method, args, {}) File "/home/pchouksey1/workspace/dexciss/core/addons/web/controllers/main.py", line 936, in _call_kw return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs) File "/home/pchouksey1/workspace/dexciss/core/openerp/api.py", line 268, in wrapper return old_api(self, *args, **kwargs) File "/home/pchouksey1/workspace/dexciss/core/openerp/api.py", line 399, in old_api result = method(recs, *args, **kwargs) File "/home/pchouksey1/workspace/dexciss/repo/delivery_performance/wizard/delivery_performance.py", line 303, in out_picking self.function_done_state(sale_list) File "/home/pchouksey1/workspace/dexciss/core/openerp/api.py", line 266, in wrapper return new_api(self, *args, **kwargs) File "/home/pchouksey1/workspace/dexciss/repo/delivery_performance/wizard/delivery_performance.py", line 114, in function_done_state print "########## saleorder",saleorder.picking_ids File "/home/pchouksey1/workspace/dexciss/core/openerp/fields.py", line 825, in __get__ record.ensure_one() File "/home/pchouksey1/workspace/dexciss/core/openerp/models.py", line 5319, in ensure_one raise except_orm("ValueError", "Expected singleton: %s" % self)except_orm: ('ValueError', 'Expected singleton: sale.order(131, 128, 102, 101, 98, 97, 96, 95, 93, 92, 91, 90, 83, 80)'


def function_done_state(self,sale_list):

                 for saleorder in sale_list:

             for picking in saleorder.picking_ids: 

                    if picking.location_id.usage=='internal' and picking.location_dest_id.usage=='customer': lines_count = 0 no_days_late = 0 qty_on_time = 0 lines_late = 0 tot_qty = 0 late = 0                                                       

                        stock_obj = self.env['stock.move'].search([('picking_id','=',picking.name)]) for stockmove in stock_obj: # for movequant in stockmove.quant_ids: if movequant.location_id.usage =='customer':

                                        delivery_date = datetime.strptime(stockmove.date, "%Y-%m-%d %H:%M:%S") expected_date = datetime.strptime(stockmove.date_expected, "%Y-%m-%d %H:%M:%S") late = delivery_date - expected_date if late.days>0:

                                            lines_late += 1 tot_qty += stockmove.product_uom_qty


Could you just post the value for sale_list.

on 11/12/16, 3:00 PM

Ahmed M.Elmubarak

--Ahmed M.Elmubarak--
--Ahmed M.Elmubarak--

Ahmed M.Elmubarak
On 11/13/16, 7:00 AM


You need to manipulate the value of sale_list, it seems it holds a value that you don't expect.

to got it you can check:

for saleorder in sale_list[0]

try to print the sale_list value ...

Hope this could helps ..

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

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: 11/12/16, 9:05 AM
Seen: 333 times
Last updated: 11/16/16, 1:08 AM