fix sorted global report

fix get liquidation
This commit is contained in:
Wilson Gomez 2023-09-21 09:30:19 -05:00
parent ca38d4f3b9
commit b3806af9d4
3 changed files with 22 additions and 14 deletions

Binary file not shown.

View File

@ -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

View File

@ -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