Skip to main content

Posts

Showing posts with the label odoo modules

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...