ODOO
odoo mdule
In this step we will explain how to build simple empty module and the data types in odoo
how to start build your module
how to start build your module
odoo module is afolder that contain two files , so to create new module me must start with the steps bellow
- create new folder with name "module_name"
- inside it create file with name "__init__.py"
- inside it create another file with name "__manifest__.py"
now create __manifest__.py as bellow
# -*- coding: utf-8 -*-
{
'name' : 'clinic',
'version' : '1.1',
'summary': 'clinic erp system',
'sequence': 10,
'description': """
manage patient data
{
'name' : 'clinic',
'version' : '1.1',
'summary': 'clinic erp system',
'sequence': 10,
'description': """
manage patient data
doctors data
Patient dormitory data
""",
'category': 'Health',
'author': 'Shilal,
'website': 'https://shilalg.blogspot.com',
'images' : [],
'depends' : [],
'data': [
],
'demo': [
],
'installable': True,
'active': True,
}
'category': 'Health',
'author': 'Shilal,
'website': 'https://shilalg.blogspot.com',
'images' : [],
'depends' : [],
'data': [
],
'demo': [
],
'installable': True,
'active': True,
}
Now let us explain what that is mean
first __manifest__ file is contain the data of the module so
'name' : 'clinic', is define the name for our module
'version' : '1.1', the current version for this module , I use it when I have more than one version for my module
'summary': short description for your module
'description': description for your module and the tasks that your module do
'category': the category that your module belong to
'author': the company or the engineer who build the module
'website': EG the web site of the company or the engineer who build the module
'images' : the image for your module
'depends' : any other module that must be installed in the system to make your module work (other modules name)
'data': here we call the xml files in which we made our views
now we will create empty file by name __init__.py , then our module will be created then we can install it by following the steps bellow
'version' : '1.1', the current version for this module , I use it when I have more than one version for my module
'summary': short description for your module
'description': description for your module and the tasks that your module do
'category': the category that your module belong to
'author': the company or the engineer who build the module
'website': EG the web site of the company or the engineer who build the module
'images' : the image for your module
'depends' : any other module that must be installed in the system to make your module work (other modules name)
'data': here we call the xml files in which we made our views
now we will create empty file by name __init__.py , then our module will be created then we can install it by following the steps bellow
- restart the Odoo server (be sure that you call the directory which contain your modules with the run command by editing the addons path just like we explain)
- go to your browser and login to your database
- then go to setting to activate the developer mode
- the go to apps menu and click on update app list menu (load your module )
- the search for your module by it's name in apps view and install it
Data
types :
Numeric
: on which we are
storing numbers and it has two types
Integer
> on which we store integers
Float
> on which we can store numbers with decimal part
Textual
: on which we can store text data, and it has three types
Char
: on which we can store string maximum 255 characters
Text
: on which we can store string and it view as text area with unlimited characters
Html
: on which we can store string but it view as text editor
Date
: on which we can
store date and it has two types
Date
: on this field we can enter the date only without the time (month,
day ,year)
Datetime
: on this field we can enter date and time too(month , day ,year
hours ,minutes , seconds)
Boolean
: has one type by name Boolean which can has True or False vale only
Binary
: has one type too my name Binary in which we can store binary date
(docs , images , sounds , videos …)
Selection
: it also has one
type by name selection and in it the user will select one value from
the values in this field
Relational
Fields : on this
type we store the relation between objects , and we have three types
of relational fields
One2many
> just when we say there are one record in object A will has
relations with many records in object B just like (in the table of
doctors one doctor will take care of more than one patient)
Many2one
> the reverse of One2many
Many2many
> in this type many records in object A will has relation with
many records in object B just like (more than one medication will be
given for many patients)
Now
what is the syntax to define fields ?
All
fields have one syntax just as
Field_name
= fields.datatype(field attributes)
Watch On YouTube
Watch On YouTube