Odoo Help


Key error "ir.values" occurrs when migration module from v10 to v11

on 5/16/18, 6:10 AM 216 views

How can I fix the following error?I found this error when I migrated module from v10 to v11.

Here is My code in .py file:

    def create(self, vals):
        date_start = self.env['ir.values'].get_default('res.config.settings', 'so_expiration_date_start')
        if not date_start:
            if 'validity_date' in vals:
                if vals.get('validity_date'):
                    date_no = self.env['ir.values'].get_default('res.config.settings', 'so_expiration_date_no')
                    date_today = fields.Date.today()
                    date_object = datetime.strptime(date_today, '%Y-%m-%d')
                    if not date_no:
                        v_date = date_object + timedelta(days=date_no)
                        vals['validity_date'] = v_date

        return super(SaleOrder, self).create(vals)

The error log is

2018-05-16 10:00:28,331 15743 ERROR odoo11comTestData odoo.http: Exception during JSON request handling.
Traceback (most recent call last):
  File "/home/sudarly/odoo11com/odoo11com-server/odoo/http.py", line 647, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/home/sudarly/odoo11com/odoo11com-server/odoo/http.py", line 307, in _handle_exception
    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
  File "/home/sudarly/odoo11com/odoo11com-server/odoo/tools/pycompat.py", line 87, in reraise
    raise value
  File "/home/sudarly/odoo11com/odoo11com-server/odoo/http.py", line 689, in dispatch
    result = self._call_function(**self.params)
  File "/home/sudarly/odoo11com/odoo11com-server/odoo/http.py", line 339, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/home/sudarly/odoo11com/odoo11com-server/odoo/service/model.py", line 97, in wrapper
    return f(dbname, *args, **kwargs)
  File "/home/sudarly/odoo11com/odoo11com-server/odoo/http.py", line 332, in checked_call
    result = self.endpoint(*a, **kw)
  File "/home/sudarly/odoo11com/odoo11com-server/odoo/http.py", line 933, in __call__
    return self.method(*args, **kw)
  File "/home/sudarly/odoo11com/odoo11com-server/odoo/http.py", line 512, in response_wrap
    response = f(*args, **kw)
  File "/home/sudarly/odoo11com/odoo11com-server/addons/web/controllers/main.py", line 934, in call_button
    action = self._call_kw(model, method, args, {})
  File "/home/sudarly/odoo11com/odoo11com-server/addons/web/controllers/main.py", line 922, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/home/sudarly/odoo11com/odoo11com-server/odoo/api.py", line 689, in call_kw
    return call_kw_multi(method, model, args, kwargs)
  File "/home/sudarly/odoo11com/odoo11com-server/odoo/api.py", line 680, in call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/home/sudarly/odoo11com/odoo11com-server/addons/quotation_handler/models/sale.py", line 114, in make_revision
    new_so_copy = rec.copy(default=vals)
  File "/home/sudarly/odoo11com/odoo11com-server/odoo/models.py", line 3876, in copy
    new = self.with_context(lang=None).create(vals)
  File "/home/sudarly/odoo11com/odoo11com-server/addons/quotation_handler/models/sale.py", line 56, in create
    date_start = self.env['ir.values'].get_default('res.config.settings', 'so_expiration_date_start')
  File "/home/sudarly/odoo11com/odoo11com-server/odoo/api.py", line 760, in __getitem__
    return self.registry[model_name]._browse((), self)
  File "/home/sudarly/odoo11com/odoo11com-server/odoo/modules/registry.py", line 181, in __getitem__
    return self.models[model_name]
KeyError: 'ir.values'


Ludo - 21South

--Ludo - 21South--
| 2 2 5
Zwijndrecht, Netherlands
--Ludo - 21South--


Ludo - 21South
On 5/16/18, 10:25 AM

This seems like a similiar error. Have you checked it out already?

IR values in Odoo 11

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: 5/16/18, 6:10 AM
Seen: 216 times
Last updated: 5/16/18, 10:36 AM