Compare commits

...

2 Commits

Author SHA1 Message Date
Wilson Gomez 3a37eceaef minor fix 2023-09-21 09:32:35 -05:00
Wilson Gomez b3806af9d4 fix sorted global report
fix get liquidation
2023-09-21 09:30:19 -05:00
3 changed files with 20 additions and 16 deletions

Binary file not shown.

View File

@ -531,16 +531,21 @@ class Liquidation(Workflow, ModelSQL, ModelView):
('account', '=', account_id), ('account', '=', account_id),
('party', '=', employee.party.id), ('party', '=', employee.party.id),
('reconciliation', '=', None), ('reconciliation', '=', None),
('move.origin', 'not ilike', 'staff.payroll'),
('move.origin', '=', None),
] ]
lines1 = MoveLine.search(domain)
lines2 = []
if moves: if moves:
domain.append( domain = [
[ ('credit', '>', 0),
'OR', ('account', '=', account_id),
('move', 'in', moves), ('party', '=', employee.party.id),
('move.origin', 'not ilike', 'staff.payroll'), ('reconciliation', '=', None),
('move.origin', '=', None), ('move', 'in', moves),
]) ]
lines = MoveLine.search(domain) lines2 = MoveLine.search(domain)
lines = set(lines1 + lines2)
return lines return lines
@classmethod @classmethod
@ -574,15 +579,17 @@ class Liquidation(Workflow, ModelSQL, ModelView):
for payroll in payrolls: for payroll in payrolls:
for l in payroll.lines: for l in payroll.lines:
wage = l.wage_type wage = l.wage_type
if l.wage_type.contract_finish or l.wage_type.provision_cancellation: print(wage, wage.contract_finish, wage.provision_cancellation, self.kind, 'asasdasd')
if l.wage_type.provision_cancellation and not l.wage_type.contract_finish: if wage.contract_finish or wage.provision_cancellation:
wage = l.wage_type.provision_cancellation if wage.provision_cancellation and not wage.contract_finish:
wage = wage.provision_cancellation
if self.kind == 'contract': if self.kind == 'contract':
print(wage.type_concept, 'validate2323')
if wage.type_concept not in CONTRACT: if wage.type_concept not in CONTRACT:
continue continue
elif self.kind != wage.type_concept: elif self.kind != wage.type_concept:
continue continue
print('va a buscar')
if wage.id not in wages_target.keys(): if wage.id not in wages_target.keys():
mlines = self.get_moves_lines_pending( mlines = self.get_moves_lines_pending(
payroll.employee, wage, date_end, moves payroll.employee, wage, date_end, moves

View File

@ -1185,10 +1185,7 @@ class PayrollGlobalReport(Report):
sum_total_deductions.append(payroll.total_deductions) sum_total_deductions.append(payroll.total_deductions)
sum_net_payment.append(payroll.net_payment) sum_net_payment.append(payroll.net_payment)
employee_dict = {e['employee_id_number']: e for e in parties.values()} report_context['records'] = sorted(parties.values(), key=lambda x: x['employee'])
report_context['records'] = sorted(
employee_dict.items(), key=lambda t: t[0])
report_context['department'] = department report_context['department'] = department
report_context['periods_number'] = periods_number report_context['periods_number'] = periods_number
report_context['start_period'] = start_period report_context['start_period'] = start_period