Compare commits
3 Commits
a212b24abc
...
3f894915b9
Author | SHA1 | Date |
---|---|---|
Wilson Gomez | 3f894915b9 | |
Wilson Gomez | 574b787825 | |
Wilson Gomez | d92eacd1cd |
Binary file not shown.
|
@ -378,7 +378,7 @@ class Liquidation(Workflow, ModelSQL, ModelView):
|
|||
if account_id not in grouped.keys():
|
||||
grouped[account_id] = {
|
||||
'amount': [],
|
||||
'description': line.description,
|
||||
'description': line.description,
|
||||
'lines': [],
|
||||
}
|
||||
grouped[account_id]['amount'].append(amount_line)
|
||||
|
@ -389,7 +389,7 @@ class Liquidation(Workflow, ModelSQL, ModelView):
|
|||
if account_id not in grouped.keys():
|
||||
grouped[account_id] = {
|
||||
'amount': [],
|
||||
'description': line.description,
|
||||
'description': line.description,
|
||||
'lines': [],
|
||||
}
|
||||
grouped[account_id]['amount'].append(line.amount)
|
||||
|
@ -476,8 +476,9 @@ class Liquidation(Workflow, ModelSQL, ModelView):
|
|||
date_start = self.start_period.start
|
||||
if self.contract.start_date > self.start_period.start:
|
||||
date_start = self.contract.start_date
|
||||
# date_end = self.end_period.end
|
||||
date_end = self.contract.finished_date
|
||||
date_end = self.end_period.end
|
||||
if self.kind == 'contract':
|
||||
date_end = self.contract.finished_date
|
||||
return date_start, date_end
|
||||
|
||||
@classmethod
|
||||
|
@ -503,7 +504,6 @@ class Liquidation(Workflow, ModelSQL, ModelView):
|
|||
('move.origin', '=', None),
|
||||
])
|
||||
lines = MoveLine.search(domain)
|
||||
|
||||
return lines
|
||||
|
||||
@classmethod
|
||||
|
@ -579,6 +579,7 @@ class Liquidation(Workflow, ModelSQL, ModelView):
|
|||
self.write([self], {'lines': [('create', wages.values())]})
|
||||
if self.kind == 'contract':
|
||||
self.process_loans_to_pay()
|
||||
# self.calculate_discounts()
|
||||
|
||||
def get_line_(self, wage, amount, days, account_id, party=None):
|
||||
value = {
|
||||
|
@ -592,6 +593,30 @@ class Liquidation(Workflow, ModelSQL, ModelView):
|
|||
}
|
||||
return value
|
||||
|
||||
def calculate_discounts(self):
|
||||
LiquidationLine = Pool().get('staff.liquidation.line')
|
||||
wage_no_salary = [mw for mw in self.employee.mandatory_wages \
|
||||
if not mw.wage_type.salary_constitute and mw.wage_type.definition == 'deduction']
|
||||
lines_to_create = []
|
||||
for mw in wage_no_salary:
|
||||
wage = mw.wage_type
|
||||
concepts_salary = [c.id for c in wage.concepts_salary]
|
||||
if concepts_salary:
|
||||
salary_full = sum(
|
||||
line.amount for line in self.lines if line.wage.id in concepts_salary)
|
||||
amount = wage.compute_unit_price(
|
||||
wage.unit_price_formula,
|
||||
{'salary': salary_full})
|
||||
if amount > 0:
|
||||
value = self.get_line_(
|
||||
wage, amount * -1,
|
||||
1,
|
||||
wage.deduction_account.id,
|
||||
party=mw.party)
|
||||
value['liquidation'] = self
|
||||
lines_to_create.append(value)
|
||||
LiquidationLine.create(lines_to_create)
|
||||
|
||||
def process_loans_to_pay(self):
|
||||
pool = Pool()
|
||||
MoveLine = pool.get('account.move.line')
|
||||
|
|
11
payroll.py
11
payroll.py
|
@ -1094,11 +1094,11 @@ class PayrollGlobalReport(Report):
|
|||
dom_periods.extend([
|
||||
('start', '>=', start_period.start),
|
||||
('end', '<=', end_period.end),
|
||||
])
|
||||
])
|
||||
else:
|
||||
dom_periods.append(
|
||||
('id', '=', start_period.id)
|
||||
)
|
||||
)
|
||||
periods = Period.search(dom_periods)
|
||||
dom_pay = cls.get_domain_payroll(data)
|
||||
dom_pay.append(
|
||||
|
@ -1109,11 +1109,12 @@ class PayrollGlobalReport(Report):
|
|||
)
|
||||
if data['department']:
|
||||
dom_pay.append(
|
||||
['AND', ['OR', [
|
||||
['AND', [
|
||||
'OR', [
|
||||
('employee.department', '=', data['department']),
|
||||
('department', '=', None),
|
||||
], [
|
||||
('department', '=', data['department']),
|
||||
('department', '=', data['department']),
|
||||
],
|
||||
]]
|
||||
)
|
||||
|
@ -1184,7 +1185,7 @@ class PayrollGlobalReport(Report):
|
|||
sum_total_deductions.append(payroll.total_deductions)
|
||||
sum_net_payment.append(payroll.net_payment)
|
||||
|
||||
employee_dict = {e['employee']: e for e in parties.values()}
|
||||
employee_dict = {e['employee_id_number']: e for e in parties.values()}
|
||||
|
||||
report_context['records'] = sorted(
|
||||
employee_dict.items(), key=lambda t: t[0])
|
||||
|
|
Loading…
Reference in New Issue