ORM

  • Step 1:

    1. create

    
                    Model.create(vals_list)

    eg:

    
                    customer = self.env['res.partner'].create({    'name': 'Lead1 Email Customer'})
                    

    2. update

    
                  self.write({'state': 'open'})
                  

    3. Search/Read

    
                    Model.browse([ids])
                  

    eg:

    
                   employee.employee_id = self.env['hr.employee'].browse(employee.id)
                  
    
                  Model.search(args[, offset=0][, limit=None][, order=None][, count=False])
                  
    
                  //syntax
                  Model.search_count(args)
    
                  //eg:
                  user_connected =   self.env['res.users'].search_count([('company_id', '=', company.id), ('login_date', '>=', start), ('login_date', '<', end)])
                  

    4. delete

    
                  Model.unlink()
                  

    eg:

    
                  self.env['mail.channel'].browse(self.group_private.id).unlink()