diff --git a/content/administration/odoo_sh/getting_started/first_module.rst b/content/administration/odoo_sh/getting_started/first_module.rst index 25c6dd1d6..e2737f4f4 100644 --- a/content/administration/odoo_sh/getting_started/first_module.rst +++ b/content/administration/odoo_sh/getting_started/first_module.rst @@ -481,15 +481,15 @@ Add .. code-block:: python @api.model - def create(self, values): - if 'name' in values: - values['name'] = unidecode(values['name']) - return super(my_module, self).create(values) + def create(self, vals_list): + if 'name' in vals_list: + vals_list['name'] = unidecode(vals_list['name']) + return super().create(vals_list) - def write(self, values): - if 'name' in values: - values['name'] = unidecode(values['name']) - return super(my_module, self).write(values) + def write(self, vals): + if 'name' in vals: + vals['name'] = unidecode(vals['name']) + return super().write(vals) Adding a Python dependency requires a module version increase for the platform to install it. diff --git a/content/contributing/development/coding_guidelines.rst b/content/contributing/development/coding_guidelines.rst index 07a7c17ab..e8c9b5b0e 100644 --- a/content/contributing/development/coding_guidelines.rst +++ b/content/contributing/development/coding_guidelines.rst @@ -904,7 +904,8 @@ Symbols and Conventions ... # CRUD methods (and name_search, _search, ...) overrides - def create(self, values): + @api.model + def create(self, vals_list): ... # Action methods diff --git a/content/developer/tutorials/server_framework_101/12_inheritance.rst b/content/developer/tutorials/server_framework_101/12_inheritance.rst index 581736eb6..f83389c78 100644 --- a/content/developer/tutorials/server_framework_101/12_inheritance.rst +++ b/content/developer/tutorials/server_framework_101/12_inheritance.rst @@ -59,11 +59,11 @@ specific business logic:: ... @api.model - def create(self, vals): + def create(self, vals_list): # Do some business logic, modify vals... ... # Then call super to execute the parent method - return super().create(vals) + return super().create(vals_list) The decorator :func:`~odoo.api.model` is necessary for the :meth:`~odoo.models.Model.create` method because the content of the recordset ``self`` is not relevant in the context of creation,