minor fix domain employee

This commit is contained in:
wilson gomez 2021-09-14 09:02:55 -05:00
parent 1056b2d713
commit 7f3ea78849

View file

@ -782,15 +782,15 @@ class PayrollGroup(Wizard):
('period', '=', self.start.period.id),
])
employees_w_payroll = [p.employee.id for p in payrolls_period if p.employee.contract and p.employee.contract.id == p.contract.id]
dom_employees = self.get_employees_dom(employees_w_payroll)
contracts_w_payroll = [p.contract.id for p in payrolls_period]
dom_employees = self.get_employees_dom(contracts_w_payroll)
payroll_to_create = []
for employee in Employee.search(dom_employees):
employees = Employee.search(dom_employees)
for employee in employees:
start = self.start.period.start
end = self.start.period.end
contract = Payroll.search_contract_on_period(employee, self.start.period)
if not contract:
if not contract or contract.id in contracts_w_payroll:
continue
values = self.get_values(contract, start, end)
@ -808,10 +808,10 @@ class PayrollGroup(Wizard):
payroll._create_payroll_lines(wages, None, {})
return 'end'
def get_employees_dom(self, employees_w_payroll):
def get_employees_dom(self, contracts_w_payroll):
dom_employees = [
('active', '=', True),
('id', 'not in', employees_w_payroll),
('contract', 'not in', contracts_w_payroll),
]
return dom_employees