title: I want to save an odoo form with atleast one field should be different and no duplicate saving of form
body: <p>I have created a form where i want to <strong>store all the information</strong> by filling it out, but the condition is there <strong>should not be any duplicate entry</strong> with same entries in all the fields, <strong>atleast one different</strong> entry will work..</p>
  
  <p><em>Here is my code-</em></p>
  
  <pre><code>class HRLeaveRules(models.Model):
      _name = 'hr_leave_rules.leave_rules'
      half_day_allowed = fields.Selection([
          ('yes',"Yes"),
          ('no',"No")],
          string="Half Day Allowed", required=True)
      gender_specific = fields.Selection([
          ('all' ,"All"),
          ('male',"Male"),
          ('female',"Female")],
          string="Gender Specific", required=True)    
      leaves_allowed_on_prorata_basis = fields.Selection([
          ('yes',"Yes"),
          ('no',"No")],
          string="Leaves allowed on pro rata basis", required=True)
      leave_encashment = fields.Boolean(string="Leave Encashment", 
          required=True)
      leave_encashment_for_maximum = fields.Integer(
          string = "Leave Encashment for maximum", required=True)     
      can_emp_club_leave = fields.Selection([
          ('yes',"Yes"),
          ('no',"No")],
          string="Can Employees Club this leave with any other leave", 
          required=True)  
      past_dated_leave_allowed = fields.Selection([
          ('yes',"Yes"),
          ('no',"No")],
          string="Past dated leave application allowed", required=True)   
      override_paid_leave_to_unpaid = fields.Selection([
          ('yes',"Yes"),
          ('no',"No")],
          string="Can managers override paid leaves to unpaid", required=True)    
      carry_frwrdng_leaves = fields.Boolean(string="Carry forwarding of leaves", 
          required=True)  
      maximum_accumulation_in_year = fields.Integer(string = "Maximum Accumulation in year", 
          required=True)  
      leave_encash_rest_leaves = fields.Selection([
          ('yes',"Yes"),
          ('no',"No")],
          string="Leave Encashment for Rest Leaves", required=True)
      employee_id = fields.Many2one('hr.employee', string="Employee")
      holiday_status_id = fields.Many2one("hr.holidays.status", 
          string="Leave Type", required=True) 
      department_id = fields.Many2one('hr.department', 
          related='employee_id.department_id', string='Department') 
      count_intervening_leaves = fields.Boolean(
          string="Count intervening holidays/weekly offs as leaves", 
          required=True)
      count_intervening_leaves_back_date = fields.Boolean(
          string="Count intervening holidays/weekly offs as leaves if applying for back date", 
          required=True)
      leaves_probation_period = fields.Boolean(string="Leaves allowed in probation period", 
          required=True)
      max_con_leaves_month = fields.Boolean(string="Maximum consecutive leaves per month", 
          required=True)
      leave_encashment_cycle = fields.Selection([
          ('annually',"Annually"),
          ('super_annuation',"Super Annuation / Relieving")],
          string="Leave Encashment Cycle", required=True)
      description = fields.Text(string="Description")
  
      @api.model
      def create(self,value):
          current = self.env['hr_leave_rules.leave_rules'].search([])
          for rec in current:
              if value.has_key("holiday_status_id"):
                  if rec.holiday_status_id.id == value["holiday_status_id"] and rec.holiday_status_id:
                      if value.has_key("gender_specific"):
                          if rec.gender_specific == value["gender_specific"] and rec.gender_specific:                 
                              if value.has_key("half_day_allowed"):
                                  if rec.half_day_allowed == value["half_day_allowed"] and rec.half_day_allowed:                  
                                      if value.has_key("leaves_allowed_on_prorata_basis"):
                                          if rec.leaves_allowed_on_prorata_basis == value["leaves_allowed_on_prorata_basis"] and rec.leaves_allowed_on_prorata_basis:                 
                                              if value.has_key("leave_encashment_cycle"):
                                                  if rec.leave_encashment_cycle == value["leave_encashment_cycle"] and rec.leave_encashment_cycle:
                                                      if value.has_key("leave_encash_rest_leaves"):
                                                          if rec.leave_encash_rest_leaves == value["leave_encash_rest_leaves"] and rec.leave_encash_rest_leaves:                                                  
                                                              if value.has_key("can_emp_club_leave"):
                                                                  if rec.can_emp_club_leave == value["can_emp_club_leave"] and rec.can_emp_club_leave:
                                                                      if value.has_key("past_dated_leave_allowed"):
                                                                          if rec.past_dated_leave_allowed == value["past_dated_leave_allowed"] and rec.past_dated_leave_allowed:
                                                                              if value.has_key("override_paid_leave_to_unpaid"):
                                                                                  if rec.override_paid_leave_to_unpaid == value["override_paid_leave_to_unpaid"] and rec.override_paid_leave_to_unpaid:
                                                                                      raise UserError(_('This type of leave already exist in the leave rules !'))
  </code></pre>
  
  <p>Condition for no duplicate entry is working properly but the unique form is not saving information</p>
  
  <p><em>The error is -</em></p>
  
  <blockquote>
    <p>AttributeError: 'NoneType' object has no attribute 'id'</p>
  </blockquote>