0% found this document useful (0 votes)
220 views

Odoo 11.0 Crud Development

The document discusses CRUD (Create, Read, Update, Delete) operations in Odoo. It explains that CRUD provides a framework for constructing web applications by allowing developers to focus on the four main data operations. In Odoo, CRUD is implemented using the ORM framework and models inherit from models.Model. Records can be created using create(), read using search(), read(), search_read(), and browse(), updated using write(), and deleted using unlink(). The methods for each operation are described in further detail.

Uploaded by

globalknowledge
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
220 views

Odoo 11.0 Crud Development

The document discusses CRUD (Create, Read, Update, Delete) operations in Odoo. It explains that CRUD provides a framework for constructing web applications by allowing developers to focus on the four main data operations. In Odoo, CRUD is implemented using the ORM framework and models inherit from models.Model. Records can be created using create(), read using search(), read(), search_read(), and browse(), updated using write(), and deleted using unlink(). The methods for each operation are described in further detail.

Uploaded by

globalknowledge
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Odoo

Mastering Odoo 11.0 Development

Mohamed Magdy
CRUD
● CRUD is stands for the 4 main operations
that performed by Odoo framework.
● The CRUD paradigm is common in
constructing web applications, because it
provides a memorable framework for
reminding developers of how to construct
full, usable models.
CRUD
● SQL still an option for the DB operations but
not recommended as it will omit the security
considerations and data validation.
● Using the ORM framework will ensure of the
targeted records and that the user has a
sufficient permissions to perform such
operation.
CRUD in Odoo
● As any other Framework, CRUD is
implemented and ready to be used in Odoo
by default. All you need is to have an object
that inherits models.Model:
CRUD in Odoo
● C: Stands for Create. It refers to the
operation of creating new records in DB.
● In Odoo, you can create new records using
the method create()
● create(), according to Odoo:
Creates a new record for the model.
The new record is initialized using the values from ``vals`` and if
necessary those from :meth:`~.default_get`.
CRUD in Odoo
● R: Stands for Read. It refers to the operation
of Reading existing records in DB.
● In Odoo, you can find/read existing records
using the methods search(), read(),
search_read() and browse().

To be continued ...
CRUD in Odoo
● R: Stands for Read. It refers to the operation
of Reading existing records in DB.
● search(), according to Odoo:
Searches for records based on the ``args``
:returns: at most ``limit`` records matching the search criteria
CRUD in Odoo
● R: Stands for Read. It refers to the operation
of Reading existing records in DB.
● read(), according to Odoo:
Reads the requested fields for the records in ``self``, low-level/RPC
method. In Python code, prefer :meth:`~.browse`.
:return: a list of dictionaries mapping field names to their values,
with one dictionary per record
CRUD in Odoo
● R: Stands for Read. It refers to the operation
of Reading existing records in DB.
● search_read(), according to Odoo:
Performs a ``search()`` followed by a ``read()``.
:return: List of dictionaries containing the asked fields.
CRUD in Odoo
● R: Stands for Read. It refers to the operation
of Reading existing records in DB.
● browse(), according to Odoo:
Returns a recordset for the ids provided as parameter in the current
environment.
Can take no ids, a single id or a sequence of ids.
CRUD in Odoo
● U: Stands for Update. It refers to the
operation of Updating existing records in DB.
● In Odoo, you can update existing records
using the method write().
● write(), according to Odoo:
Updates all records in the current set with the provided values.
CRUD in Odoo
● D: Stands for Delete. It refers to the
operation of Deleting existing records in DB.
● In Odoo, you can Delete existing records
using the method unlink().
● unlink(), according to Odoo:
Deletes the records of the current set
Odoo
Mastering Odoo 11.0 Development

Mohamed Magdy

You might also like