diff --git a/global_payroll.fods b/global_payroll.fods index deedb52..f8a8d67 100644 Binary files a/global_payroll.fods and b/global_payroll.fods differ diff --git a/liquidation.py b/liquidation.py index cfd1336..f271662 100644 --- a/liquidation.py +++ b/liquidation.py @@ -531,16 +531,21 @@ class Liquidation(Workflow, ModelSQL, ModelView): ('account', '=', account_id), ('party', '=', employee.party.id), ('reconciliation', '=', None), + ('move.origin', 'not ilike', 'staff.payroll'), + ('move.origin', '=', None), ] + lines1 = MoveLine.search(domain) + lines2 = [] if moves: - domain.append( - [ - 'OR', - ('move', 'in', moves), - ('move.origin', 'not ilike', 'staff.payroll'), - ('move.origin', '=', None), - ]) - lines = MoveLine.search(domain) + domain = [ + ('credit', '>', 0), + ('account', '=', account_id), + ('party', '=', employee.party.id), + ('reconciliation', '=', None), + ('move', 'in', moves), + ] + lines2 = MoveLine.search(domain) + lines = set(lines1 + lines2) return lines @classmethod @@ -574,15 +579,17 @@ class Liquidation(Workflow, ModelSQL, ModelView): for payroll in payrolls: for l in payroll.lines: wage = l.wage_type - if l.wage_type.contract_finish or l.wage_type.provision_cancellation: - if l.wage_type.provision_cancellation and not l.wage_type.contract_finish: - wage = l.wage_type.provision_cancellation + print(wage, wage.contract_finish, wage.provision_cancellation, self.kind, 'asasdasd') + if wage.contract_finish or wage.provision_cancellation: + if wage.provision_cancellation and not wage.contract_finish: + wage = wage.provision_cancellation if self.kind == 'contract': + print(wage.type_concept, 'validate2323') if wage.type_concept not in CONTRACT: continue elif self.kind != wage.type_concept: continue - + print('va a buscar') if wage.id not in wages_target.keys(): mlines = self.get_moves_lines_pending( payroll.employee, wage, date_end, moves diff --git a/payroll.py b/payroll.py index d9a2743..cd3fa4a 100644 --- a/payroll.py +++ b/payroll.py @@ -1187,8 +1187,9 @@ class PayrollGlobalReport(Report): employee_dict = {e['employee_id_number']: e for e in parties.values()} - report_context['records'] = sorted( - employee_dict.items(), key=lambda t: t[0]) + # report_context['records'] = sorted( + # employee_dict.items(), key=lambda t: t[0]) + report_context['records'] = sorted(employee_dict.values(), key=lambda x: x['employee']) report_context['department'] = department report_context['periods_number'] = periods_number report_context['start_period'] = start_period