What is the difference between giving required field in python file and xml file in openerp?
In xml file :field name="employee_id"  required="1"
In python file: 'employee_id' : fields.char('Employee Name',required=True),
The difference is that in the python .py when you set a fields required argument to True, it's creates a NOT NULL constraint directly on the database, this means that no matter what happens (Provided data didn't already exist in the table) you can never insert data into that table without that field containing a value, if you try to do so directly from psql or Odoo's xmlrpc or jsonrpc api you'll get an SQL NOT NULL error, with something like this
`ERROR: null value in column "xxx" violates not-null constraint 
On the other-hand if you set a field to be required on the view (xml) then no constraint is set on the database, this means that the only restriction is the view and you can bypass that and write to the database directly or if you're making an external web service you can use Odoo's ORM methods to write to the database directly
If you really want to make sure a column is not null and is required, then it's better to set that in the python code itself instead of the view.
required field difference in python file and xml file