
from openerp import models, fields


class MedicalPatientEthnicity(models.Model):
    _name = 'medical.patient.ethnicity'

    notes = fields.Char()
    code = fields.Char()
    name = fields.Char(required=True, translate=True)

    _sql_constraints = [
        ('name_uniq', 'UNIQUE(name)', 'Ethnicity name must be unique!'),
        ('code_uniq', 'UNIQUE(code)', 'Ethnicity code must be unique!'),
    ]


from openerp import models, fields


class MedicalPatientEthnicity(models.Model):
    _name = 'medical.patient.ethnicity'

    notes = fields.Char()
    code = fields.Char(required=True, )
    name = fields.Char(required=True, translate=True)

    _sql_constraints = [
        ('name_uniq', 'UNIQUE(name)', 'Ethnicity name must be unique!'),
        ('code_uniq', 'UNIQUE(code)', 'Ethnicity code must be unique!'),
    ]

Add required to ethnicity code
Add required to ethnicity code

  
  from openerp import models, fields
  
  
  class MedicalPatientEthnicity(models.Model):
      _name = 'medical.patient.ethnicity'
  
      notes = fields.Char()
-     code = fields.Char()
+     code = fields.Char(required=True, )
      name = fields.Char(required=True, translate=True)
  
      _sql_constraints = [
          ('name_uniq', 'UNIQUE(name)', 'Ethnicity name must be unique!'),
          ('code_uniq', 'UNIQUE(code)', 'Ethnicity code must be unique!'),
      ]
  
Add required to ethnicity code
## Code Before:

from openerp import models, fields


class MedicalPatientEthnicity(models.Model):
    _name = 'medical.patient.ethnicity'

    notes = fields.Char()
    code = fields.Char()
    name = fields.Char(required=True, translate=True)

    _sql_constraints = [
        ('name_uniq', 'UNIQUE(name)', 'Ethnicity name must be unique!'),
        ('code_uniq', 'UNIQUE(code)', 'Ethnicity code must be unique!'),
    ]

## Instruction:
Add required to ethnicity code
## Code After:

from openerp import models, fields


class MedicalPatientEthnicity(models.Model):
    _name = 'medical.patient.ethnicity'

    notes = fields.Char()
    code = fields.Char(required=True, )
    name = fields.Char(required=True, translate=True)

    _sql_constraints = [
        ('name_uniq', 'UNIQUE(name)', 'Ethnicity name must be unique!'),
        ('code_uniq', 'UNIQUE(code)', 'Ethnicity code must be unique!'),
    ]
