Skip to Content
Menu
This question has been flagged
2 Replies
3621 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

Avatar
Discard

Hi,

Could you just post the value for sale_list.

Best Answer

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

Avatar
Discard