Skip to main content

Posts

Showing posts with the label odoo

Relations between different tables in modules in odoo

  Many2One Relationship 1. we have school_profile table (module) 2. we have school_students table (module) so school can have many student and the relationship between these to table will be one-to-many Inside School_Students In model define Forieng key field like so name = fields.Char() school_id = fields.Many2one( "school.profile" , string = "School" ) Show in XML file as separate view. <record model ="ir.ui.view" id ="school_students.form" > <field name ="name" > school_students.form </field> <field name ="model" > school.students </field> <field name ="arch" type ="xml" > <form> <group> <group> <field name ="name" /> <field name ="school_id" string ="School" /> </group> </group> </form> </field> </record...

Custom fields in modules development in odoo

Different type of fields used in developing module  name = fields.Char( string = "School Name" , help = "This is school name" ) email = fields.Char( string = "Email" ) phone = fields.Char( string = "Phone" ) school_rank = fields.Integer( string = "Rank" , default = lambda lm:lm.get_default_rank()) is_virtual = fields.Boolean() results = fields.Float( string = "results" , default = 0.00 , help = "This is tool tip" , readonly = True ) address = fields.Text( string = "Address" , help = "This is school permanent address" , default = "Pakistan" , trim = False ) establish_date = fields.Date( string = "Establish Date" ) open_date = fields.Datetime( "Open Date" , default =fields.Datetime.now()) 2. Upload any format file. documents = fields.Binary( string = "Document" ) # to display file_name document_name = fields.Char( string = "File Name" ) Show in the X...

How to develop module in odoo

 Odoo Module (App) Development First of all you need to active/run the app usinf pecifies database and enable the developer mode option in /settings/General settings Step 1 Create Python package in addons folder with name 'Module Name' e.g School Create 2 files inside School directory 1) __init__.py  2) __manifest__.py Step 2 Write some information regarding module inside __manifest__.py file  Code { 'name' : 'School' , 'version' : '1.1' , 'author' : 'AdnanZaib' , 'summary' : "School Management System" , 'sequence' : 1 , 'description' : "School Management System" "Odoo v15" , 'category' : 'School' , 'website' : 'https://www.linkedin.com/in/adnan-zaib-devinlara/' , 'depends' : [ 'base' ] }