With this fonction below, my goal is to write hr.payslip.run lines states into done when i am closing it. So i write this but anything happenp on hr.payslip.run lines states
def validate_sheet(self, cr, uid, ids, context=None):
emp_pool = self.pool.get('hr.employee')
slip_pool = self.pool.get('hr.payslip')
run_pool = self.pool.get('hr.payslip.run')
for sheet in slip_pool.browse(cr, uid, ids, context=None):
date_end = sheet.contract_id and sheet.contract_id.date_end or False
date_from = sheet.date_from or False
if date_end < date_from:
slip_pool.write(cr, uid, ids, {'state':'echu'}, context=context)
slip_pool.write(cr, uid, ids, {'state':'done'}, context=context)
self.write(cr, uid, ids, {'state': 'confirm'}, context=context)
return True