Odoo Help

Welcome!

This community 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.

0

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

By
Apoorv Soral
on 11/12/16, 9:05 AM 217 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)'


@api.multi

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

Hi,

Could you just post the value for sale_list.

Sarga
on 11/12/16, 3:00 PM
0

Ahmed M.Elmubarak

--Ahmed M.Elmubarak--
2988
| 5 3 5
Sudan
--Ahmed M.Elmubarak--


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

Hi,

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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 11/12/16, 9:05 AM
Seen: 217 times
Last updated: 11/16/16, 1:08 AM