fix compute_salary_full
This commit is contained in:
parent
5e75ac0a4f
commit
c5aac068c2
33
payroll.py
33
payroll.py
|
@ -32,11 +32,11 @@ from .constants import (
|
|||
)
|
||||
|
||||
# Nimporter is required for impot Nim
|
||||
try:
|
||||
import nimporter
|
||||
import trytond.modules.staff_payroll_co.fpc as fpc # Nim imports!
|
||||
except:
|
||||
print("Nim or nimporter is not installed")
|
||||
# try:
|
||||
# import nimporter
|
||||
# import trytond.modules.staff_payroll_co.fpc as fpc # Nim imports!
|
||||
# except:
|
||||
# print("Nim or nimporter is not installed")
|
||||
|
||||
STATES = {'readonly': (Eval('state') != 'draft')}
|
||||
|
||||
|
@ -317,9 +317,8 @@ class Payroll(metaclass=PoolMeta):
|
|||
salary_full = salary_full_month
|
||||
else:
|
||||
salary_full = _ZERO
|
||||
|
||||
if wage['minimal_amount'] and salary_full < wage['minimal_amount']:
|
||||
salary_full = wage['minimal_amount']
|
||||
salary_full = _ZERO
|
||||
return {'salary': salary_full}
|
||||
|
||||
@lru_cache(maxsize=20)
|
||||
|
@ -526,7 +525,7 @@ class Payroll(metaclass=PoolMeta):
|
|||
time_r = time.time()
|
||||
self.recompute_lines(cache_wage_dict)
|
||||
time_r2 = time.time()
|
||||
print(time_r2-time_r, 'time recompute lines')
|
||||
# print(time_r2-time_r, 'time recompute lines')
|
||||
if not config.allow_zero_quantities:
|
||||
lines_delete = [ln for ln in self.lines if ln.quantity == 0]
|
||||
PayrollLine.delete(lines_delete)
|
||||
|
@ -787,13 +786,13 @@ class Payroll(metaclass=PoolMeta):
|
|||
'amount_60_40': new_unit_value,
|
||||
})
|
||||
time_60_40_2 = time.time()
|
||||
print(time_60_40_2- time_60_40, 'validar 60 40')
|
||||
# print(time_60_40_2- time_60_40, 'validar 60 40')
|
||||
|
||||
|
||||
time_r = time.time()
|
||||
super(Payroll, self).recompute_lines(cache_wage_dict)
|
||||
time_r2 = time.time()
|
||||
print(time_r2- time_r, 'validar recom')
|
||||
# print(time_r2- time_r, 'validar recom')
|
||||
line_tax = None
|
||||
# deductions = _ZERO
|
||||
time_pr = time.time()
|
||||
|
@ -810,11 +809,11 @@ class Payroll(metaclass=PoolMeta):
|
|||
'unit_value': amount,
|
||||
})
|
||||
time_pr2 = time.time()
|
||||
print(time_pr2- time_pr, 'validar provision')
|
||||
# print(time_pr2- time_pr, 'validar provision')
|
||||
time_up = time.time()
|
||||
self.update_wage_no_salary(cache_wage_dict)
|
||||
time_up2 = time.time()
|
||||
print(time_up2- time_up, 'validar update')
|
||||
# print(time_up2- time_up, 'validar update')
|
||||
# elif line.wage_type.type_concept == 'tax':
|
||||
# line_tax = line
|
||||
# if line_tax:
|
||||
|
@ -830,7 +829,7 @@ class Payroll(metaclass=PoolMeta):
|
|||
unit_value = self.get_round_amount(wage['round_amounts'], line.unit_value)
|
||||
line.write([line], {'unit_value': unit_value})
|
||||
time_ro2 = time.time()
|
||||
print(time_ro2- time_ro, 'validar rounds')
|
||||
# print(time_ro2- time_ro, 'validar rounds')
|
||||
|
||||
def check_limit(self, base, field, value_field):
|
||||
Configuration = Pool().get('staff.configuration')
|
||||
|
@ -1744,7 +1743,7 @@ class PayrollGroup(metaclass=PoolMeta):
|
|||
'type_concept'
|
||||
]
|
||||
wages = Wage.search_read([], fields_names=fields_names)
|
||||
print('wages ===================', type(wages))
|
||||
# print('wages ===================', type(wages))
|
||||
|
||||
wage = {
|
||||
"id" : 3,
|
||||
|
@ -2033,22 +2032,26 @@ class Exo2276Report(Report):
|
|||
_cesanpag = 0
|
||||
_total_benefit = 0
|
||||
_other = 0
|
||||
_tax = 0
|
||||
lines_liquid = LiquidationLine.search_read([
|
||||
('liquidation.employee.party', '=', party.id),
|
||||
('liquidation.liquidation_date', '>=', data['start_period']),
|
||||
('liquidation.liquidation_date', '<=', data['end_period']),
|
||||
('wage.type_concept', 'in', ['unemployment', 'interest', 'holidays', 'bonus_service'])
|
||||
('wage.type_concept', 'in', ['unemployment', 'interest', 'holidays', 'bonus_service', 'tax'])
|
||||
], fields_names=['amount', 'wage.type_concept'])
|
||||
for l in lines_liquid:
|
||||
if l['wage.']['type_concept'] in ['unemployment', 'interest']:
|
||||
_cesanpag += l['amount']
|
||||
elif l['wage.']['type_concept'] == 'convencional_bonus':
|
||||
_other += l['amount']
|
||||
elif l['wage.']['type_concept'] == 'tax':
|
||||
_tax += abs(l['amount'])
|
||||
else:
|
||||
_total_benefit += l['amount']
|
||||
new_objects[party.id]['cesanpag'] = _cesanpag
|
||||
new_objects[party.id]['total_benefit'] += _total_benefit
|
||||
new_objects[party.id]['others_payments'] += _other
|
||||
new_objects[party.id]['retefuente'] += _tax
|
||||
|
||||
report_context['records'] = new_objects.values()
|
||||
report_context['end_period'] = end_period
|
||||
|
|
Loading…
Reference in New Issue