Skip to Content
Menú
This question has been flagged
2387 Vistes

I made an custom module that imports its work entry lets say WORK600.


I import xml record and it goes to database and when i create payslip it shows under attendance column.

class WorkedDayOvertime(models.Model):
_inherit = 'hr.payslip'

@api.model
def _get_worked_day_lines(self, domain=None, check_out_of_contract=True):

res = super(WorkedDayOvertime, self)._get_worked_day_lines()
contract = self.contract_id

extra_hours = request.env['ru.extra.hours'].sudo().search([('employee_id','=',self.employee_id.id)])
extra_sum = 0
extra_count = 0
for extra in extra_hours:
if extra.check_in.date() >= contract.date_start:
if contract.date_end >= extra.check_out.date():
extra_sum += extra.worked_hours
extra_count += 1
work_entry_type = request.env['hr.work.entry.type'].sudo().search([('code', '=', 'WORK600')])
if extra_sum is not 0:
res.append({
'sequence': work_entry_type.sequence,
'work_entry_type_id': work_entry_type.id,
'number_of_days': extra_count,
'number_of_hours': extra_sum,
})
return res

    
The problem is here, it doesn't add or subtract current attendance work entry which created before based on
working times. I need add addition or subtraction work entries. Better say i don't need default attendance
record which made i just want mine. please help me


Avatar
Descartar
Autor

Also i want to write ,y custom work entries to hr.work.entry table which is the function to inherit?

Related Posts Respostes Vistes Activitat
1
de maig 22
2184
1
de gen. 22
1916
1
d’oct. 21
14117
2
de gen. 24
14240
6
de gen. 24
15806