@@ -257,10 +257,22 @@ class document_file(osv.osv):
|
||||
else:
|
||||
if vals.get('file_size'):
|
||||
del vals['file_size']
|
||||
if not self._check_duplication(cr, uid, vals):
|
||||
raise osv.except_osv(_('ValidateError'), _('File name must be unique!'))
|
||||
result = super(document_file, self).create(cr, uid, vals, context)
|
||||
cr.commit() # ?
|
||||
result = self._check_duplication(cr, uid, vals)
|
||||
if not result:
|
||||
domain = [
|
||||
('res_id', '=', vals['res_id']),
|
||||
('res_model', '=', vals['res_model']),
|
||||
('datas_fname', '=', vals['datas_fname']),
|
||||
]
|
||||
attach_ids = self.search(cr, uid, domain, context=context)
|
||||
super(document_file, self).write(cr, uid, attach_ids,
|
||||
{'datas' : vals['datas']},
|
||||
context=context)
|
||||
result = attach_ids[0]
|
||||
else:
|
||||
#raise osv.except_osv(_('ValidateError'), _('File name must be unique!'))
|
||||
result = super(document_file, self).create(cr, uid, vals, context)
|
||||
cr.commit() # ?
|
||||
return result
|
||||
|
||||
def __get_partner_id(self, cr, uid, res_model, res_id, context=None):
|
||||
|
||||
+1
-1
@@ -154,7 +154,7 @@ class hr_employee(osv.osv):
|
||||
'work_email': fields.char('Work E-mail', size=240),
|
||||
'work_location': fields.char('Office Location', size=32),
|
||||
'notes': fields.text('Notes'),
|
||||
'parent_id': fields.related('department_id', 'manager_id', relation='hr.employee', string='Manager', type='many2one', store=True, select=True, readonly=True, help="It is linked with manager of Department"),
|
||||
'parent_id': fields.related('department_id', 'manager_id', relation='hr.employee', string='Manager', type='many2one', store=True, select=True, help="It is linked with manager of Department"),
|
||||
'category_ids': fields.many2many('hr.employee.category', 'employee_category_rel','category_id','emp_id','Category'),
|
||||
'child_ids': fields.one2many('hr.employee', 'parent_id', 'Subordinates'),
|
||||
'resource_id': fields.many2one('resource.resource', 'Resource', ondelete='cascade', required=True),
|
||||
|
||||
Reference in New Issue
Block a user