Skip to Content
Menu
This question has been flagged

Hi guys 
I have a new model in a custom module . 
in this module i want to do a backorder on a order (1 product with 2 of quantity)
I want to do this backorder when a field is changed on a form 

When i do that i have this error : 

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 642, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 684, in dispatch
    result = self._call_function(**self.params)
  File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 334, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/odoo/service/model.py", line 101, in wrapper
    return f(dbname, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 327, in checked_call
    result = self.endpoint(*a, **kw)
  File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 942, in __call__
    return self.method(*args, **kw)
  File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 507, in response_wrap
    response = f(*args, **kw)
  File "/usr/lib/python2.7/dist-packages/odoo/addons/web/controllers/main.py", line 895, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/usr/lib/python2.7/dist-packages/odoo/addons/web/controllers/main.py", line 887, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/usr/lib/python2.7/dist-packages/odoo/api.py", line 689, in call_kw
    return call_kw_multi(method, model, args, kwargs)
  File "/usr/lib/python2.7/dist-packages/odoo/api.py", line 680, in call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/odoo/models.py", line 5535, in onchange
    value = record[name]
  File "/usr/lib/python2.7/dist-packages/odoo/models.py", line 5269, in __getitem__
    return self._fields[key].__get__(self, type(self))
  File "/usr/lib/python2.7/dist-packages/odoo/fields.py", line 930, in __get__
    value = record._cache[self]
  File "/usr/lib/python2.7/dist-packages/odoo/models.py", line 5620, in __getitem__
    value = self._recs.env.cache[field][self._recs.id]
KeyError: <odoo.models.NewId object at 0x7f312b74d150>


Here is my model : 

class PickingProcess(models.Model):
  _inherit = "mail.thread"
    _name = 'picking.process'
    _description = "picking process ecoparc"

    input_action = fields.Char("Action" ,store=True)
    @api.one
    @api.depends('input_action')
    def _compute_imput_action2(self):
      ctx = dict(self._context or {})
      _logger.error(ctx)
      pic =  self.env['stock.picking'].browse(4910)
        for pack in pic.pack_operation_ids:
       pack.qty_done = 1

        backOrderModel = self.env['stock.backorder.confirmation']
      backorderObj = backOrderModel.create(
      {'pick_id'4910})
       backorderObj._process(cancel_backorder=False
        return 

Do you have an idea why i have this error and how to fix it please?

Thanks a lot 
Thomas


Avatar
Discard

Please check the following link for custom module:

https://youtu.be/Xya_fCNr6tw

Thanks & Regards

Related Posts Replies Views Activity
2
Sep 17
4066
0
Nov 16
2615
0
Jul 20
1947
1
Jul 18
5939
1
Jul 18
2668