Skip to Content
Menu
This question has been flagged
985 Views

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
Discard
Author

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

Related Posts Replies Views Activity
1
May 22
1217
1
Jan 22
905
1
Oct 21
12622
2
Jan 24
12787
6
Jan 24
14849