• Step 1:

    1. packages

    
                          
    from odoo import models, fields, api
    

    2. define class

    
    class school(models.Model):
    
    

    3. model name

    
    _name = 'school.school'
    
    Model name is table name. Table name will be school_school

    4. define fields

    
    name = fields.Char()
        value = fields.Integer()
    

    5. define function

    
    def _value_pc(self):
    
    

    complete code

    
    from odoo import models, fields, api
    
    
    class school(models.Model):
        _name = 'school.school'
        _description = 'school.school'
    
        name = fields.Char()
        value = fields.Integer()
        def _value_pc(self):
    
    
  • Step 2: Types

    1. String

    
                  name = fields.Char(string="Account Name", required=True, index='trigram', tracking=True)
    
                  code = fields.Char(size=64, required=True, tracking=True)
    

    2. Boolean

    
                deprecated = fields.Boolean(string='Is deprecated' default=False, tracking=True)
    

    3. select

    
          internal_group = fields.Selection(
            selection=[
                ('equity', 'Equity'),
                ('asset', 'Asset'),
                ('liability', 'Liability'),
                ('income', 'Income'),
                ('expense', 'Expense'),
                ('off_balance', 'Off Balance'),
            ],
            string="Internal Group", readonly=True, compute="_compute_internal_group", store=True
        )
    
        
    
        applicability = fields.Selection([('accounts', 'Accounts'), ('taxes', 'Taxes'), ('products', 'Products')], required=True, default='accounts')
          
    
          MONTH_SELECTION = [
            ('1', 'January'),
            ('2', 'February'),
            ('3', 'March'),
            ('4', 'April'),
            ('5', 'May'),
            ('6', 'June'),
            ('7', 'July'),
            ('8', 'August'),
            ('9', 'September'),
            ('10', 'October'),
            ('11', 'November'),
            ('12', 'December'),
        ]
    
    
        fiscalyear_last_month = fields.Selection(MONTH_SELECTION, default='12', required=True)
          

    4. Text

    
            note = fields.Text('Internal Notes', tracking=True)
          

    5. Numbers

    
          sequence = fields.Integer(default=10)
          

    6. Date

    
          period_lock_date = fields.Date(
            string="Journals Entries Lock Date",
            tracking=True,
            help="Only users with the 'Adviser' role can edit accounts prior to and inclusive of this"
                 " date. Use it for period locking inside an open fiscal year, for example.")
    
          

    7. HTML

    
          note = fields.Html(
                string="Terms and conditions",
                compute='_compute_note',
                store=True, readonly=False, precompute=True)
          

    8. Dynamic show /hide

    
          amount_untaxed = fields.Monetary(string="Untaxed Amount", store=True, compute='_compute_amounts', tracking=5)
          amount_tax = fields.Monetary(string="Taxes", store=True, compute='_compute_amounts')
          amount_total = fields.Monetary(string="Total", store=True, compute='_compute_amounts', tracking=4)
    
          

    9. file

    
          photo = fields.Binary(string='Image')
          

    8. relation fields

    
          //Many2one  
          company_id = fields.Many2one('res.company', string='Company', required=True, readonly=True,
            default=lambda self: self.env.company)
    
    
         root_id = fields.Many2one('account.root', compute='_compute_account_root', store=True)  
    
         //Many2many
         allowed_journal_ids = fields.Many2many('account.journal', string="Allowed Journals")
    
    
         //One2many
         partial_reconcile_ids = fields.One2many('account.partial.reconcile', 'full_reconcile_id', string='Reconciliation Parts')
        reconciled_line_ids = fields.One2many('account.move.line', 'full_reconcile_id', string='Matched Journal Items')