0% found this document useful (0 votes)
9 views19 pages

Unit 3

The document provides an overview of Odoo, an open-source ERP software with a modular architecture and customizable features. It covers the history of Odoo, the structure and creation of add-on modules, and various types of views and fields used in Odoo development. Key concepts include ORM, relation fields, widgets, and constraints essential for building applications within the Odoo framework.

Uploaded by

mparma2006
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views19 pages

Unit 3

The document provides an overview of Odoo, an open-source ERP software with a modular architecture and customizable features. It covers the history of Odoo, the structure and creation of add-on modules, and various types of views and fields used in Odoo development. Key concepts include ORM, relation fields, widgets, and constraints essential for building applications within the Odoo framework.

Uploaded by

mparma2006
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Course Code:- 3040233207

Course Name:- Integrated Web


Solutions with Django and Basic of
Odoo

Unit No: 3 Introduction and Technical


Fundamentals of ODOO Add-ons

SEMESTER: 4
PREPARED BY: Ms. Kiran Rajput
Introduction to ORM in Odoo

•What is Odoo?
• An open-source ERP Enterprise Resource Planning)
software
• Modular architecture with a wide range of business
applications

•Key Features:
• Customizable and scalable
• User-friendly interface
2
History of Odoo

•Timeline:
• Founded in 2005 as TinyERP
• Renamed to OpenERP in 2010
• Rebranded to Odoo in 2014

•Evolution:
• Growth from a single application to a full suite of business
applications
• Community-driven development

3
Add-on Module Structure

• What are Add-ons?


• Modules that extend Odoo's functionality

•Module Structure:
•Directory structure: __init__.py, __manifest__.py, models, views, etc.

•Manifest File Usage:


•Defines module metadata (name, version, dependencies)

•Example of a manifest file:

{
'name': 'My Module',
'version': '1.0',
'depends': ['base'],
'data': ['views/my_view.xml'],
} 4
Writing Your First Module

•Steps to Create a Module:


1.Create a new directory for your
module
2.Create __init__.py and __manifest__.py
3.Define models and views
4.Install the module in Odoo

5
Relation Fields with Fields

•Types of Relation Fields:


•Many2one: One-to-many relationship
•One2many: Reverse of Many2one
•Many2many: Many-to-many relationship

•Example:
class MyModel(models.Model):
_name = 'my.model'
partner_id = fields.Many2one('res.partner', string='Partner')

6
Views, Functions, and Menus

•Defining Views:
•XML files to define how data is presented

•Creating Menus:
•Example of a menu item in XML

<menuitem id="my_module_menu" name="My Module"sequence="10"/>

•Functions:
• Define business logic in Python methods

7
Widgets and Controls in UI

•What are Widgets?


•UI components that enhance user interaction

•Common Widgets:
•Many2one, One2many, Datepicker, etc.

•Example:

<field name="partner_id" widget="many2one"/>

8
Domain - Dynamic UI Visions

•What is a Domain?
•Filters applied to fields to limit data displayed

•Dynamic UI with Domains:


•Example of a domain filter:

<field name="partner_id" domain="[('is_company', '=', True)]"/>

9
Views and View Attributes

•Types of Views:
•Form View, Tree View, Kanban View, Calendar View

•View Attributes:
•create, edit, delete, search, etc.

•Example of a Form View:


<form>
<sheet>
<group>
<field name="name"/>
<field name="partner_id"/>
</group>
</sheet>
</form> 10
Diagram View and Graph View

•Diagram View:
•Visual representation of data relationships

•Graph View:
•Used for displaying data in a graphical format

•Example:

<graph>
<field name="date"/>
<field name="amount"/>
</graph>
11
Calendar View

•What is a Calendar View?


•Displays records in a calendar format

•Example:

<calendar string="My Calendar" date_start="start_date"


date_stop="end_date"/>

12
Model and Class Level Attributes

Model Attributes:

•Define the structure of the data

•Example of class-level attributes:

class MyModel(models.Model):
_name = 'my.model'
_description = 'My Model Description'

13
Creating a Base Module

•What is a Base Module?


• A foundational module that other
modules can depend on

•Steps to Create:
• Define core models and views
• Ensure proper dependencies in the
manifest file

14
Field Parameters

•Common Field Parameters:


•string: User-friendly name
•required: Boolean to enforce field completion
•default: Default value for the field

•Example:

name = fields.Char(string='Name', required=True, default='New Record')

15
Complex Fields

•What are Complex Fields?


•Fields that require additional logic or structure

•Examples:
•Computed fields, related fields, and function fields

•Example of a Computed Field:

total_amount = fields.Float(compute='_compute_total_amount')

@api.depends('line_ids.price_total')
def _compute_total_amount(self):
for record in self:
record.total_amount = sum(line.price_total for line in record.line_ids) 16
Designing Kanban Views

•What is a Kanban View?


•A visual representation of records in a card
format

•Example of a Kanban View:

<kanban>
<field name="name"/>
<field name="state"/>
</kanban>

17
Introduction to Constraints

•What are Constraints?


•Rules that enforce data integrity

•Types of Constraints:
•SQL constraints, Python constraints

•Example of a SQL Constraint:

_sql_constraints = [
('unique_name', 'UNIQUE(name)', 'Name must be unique!')
]
18
Automatic Reserve Fields

•What are Automatic Reserve Fields?


•Fields that are automatically managed by Odoo

•Examples:
•create_uid, write_uid, create_date, write_date

•Usage:
•Useful for tracking record creation and modification
history

19

You might also like