minor fix
This commit is contained in:
parent
f6a6a4be8c
commit
0d8452004f
40
payroll.py
40
payroll.py
|
@ -389,8 +389,7 @@ class Payroll(metaclass=PoolMeta):
|
|||
])
|
||||
lines_to_reconcile = []
|
||||
values = []
|
||||
res = self.validate_wage_type(line, concept='holidays')
|
||||
if res == 'holidays':
|
||||
if line.origin and line.wage_type.type_concept == 'holidays':
|
||||
amount = line.amount
|
||||
for m in move_lines:
|
||||
values.append(abs(m.debit - m.credit))
|
||||
|
@ -444,17 +443,6 @@ class Payroll(metaclass=PoolMeta):
|
|||
LoanLine.write([m], {'state': 'paid', 'origin': line_})
|
||||
PayrollLine.write([line], to_write)
|
||||
|
||||
def validate_wage_type(self, line, concept=None):
|
||||
if concept == 'holidays':
|
||||
Event = Pool().get('staff.event')
|
||||
events = Event.search([
|
||||
('employee', '=', self.employee),
|
||||
('state', '=', 'done'),
|
||||
('line_payroll', '=', line.id)
|
||||
])
|
||||
if events:
|
||||
return 'holidays'
|
||||
|
||||
def search_salary_month(self, wage):
|
||||
res = _ZERO
|
||||
payrolls = self._get_payrolls_month()
|
||||
|
@ -521,13 +509,16 @@ class Payroll(metaclass=PoolMeta):
|
|||
for event in events:
|
||||
if not event.category.payroll_effect:
|
||||
continue
|
||||
start_date = self.start
|
||||
if event.start_date > start_date:
|
||||
start_date = event.start_date
|
||||
end_date = self.end
|
||||
if event.end_date < end_date:
|
||||
end_date = event.end_date
|
||||
qty_pay = self.contract.get_time_days(start_date, end_date)
|
||||
if event.end_date:
|
||||
start_date = self.start
|
||||
if event.start_date > start_date:
|
||||
start_date = event.start_date
|
||||
end_date = self.end
|
||||
if event.end_date and event.end_date < end_date:
|
||||
end_date = event.end_date
|
||||
qty_pay = self.contract.get_time_days(start_date, end_date)
|
||||
else:
|
||||
qty_pay = event.quantity_pay
|
||||
if event.absenteeism:
|
||||
absenteeism_days += qty_pay
|
||||
if event.quantity_pay:
|
||||
|
@ -550,16 +541,11 @@ class Payroll(metaclass=PoolMeta):
|
|||
'origin': event
|
||||
})
|
||||
PayrollLine.create([res])
|
||||
# lines = PayrollLine.create([res])
|
||||
|
||||
# if lines:
|
||||
# event.line_payroll = lines[0]
|
||||
# event.save()
|
||||
if event.category.wage_type_discount and event.quantity_discount:
|
||||
if event.category.wage_type_discount and event.quantity:
|
||||
id_wt_event = event.category.wage_type_discount.id
|
||||
if id_wt_event not in discounts.keys():
|
||||
discounts[id_wt_event] = 0
|
||||
discounts[id_wt_event] += event.quantity_discount
|
||||
discounts[id_wt_event] += event.quantity
|
||||
|
||||
self.absenteeism_days = absenteeism_days
|
||||
self.save()
|
||||
|
|
11
wage_type.py
11
wage_type.py
|
@ -67,10 +67,13 @@ class WageType(metaclass=PoolMeta):
|
|||
@classmethod
|
||||
def __register__(cls, module_name):
|
||||
super(WageType, cls).__register__(module_name)
|
||||
cursor = Transaction().connection.cursor()
|
||||
cursor.execute(
|
||||
'ALTER TABLE staff_wage_type DROP COLUMN IF EXISTS amount_required'
|
||||
)
|
||||
table_h = cls.__table_handler__(module_name)
|
||||
if table_h.column_exist('amount_required'):
|
||||
table_h.drop_column('amount_required')
|
||||
# cursor = Transaction().connection.cursor()
|
||||
# cursor.execute(
|
||||
# 'ALTER TABLE staff_wage_type DROP COLUMN IF EXISTS amount_required'
|
||||
# )
|
||||
|
||||
|
||||
class WageTypeReport(Report):
|
||||
|
|
Loading…
Reference in New Issue