minor fix

This commit is contained in:
wilson gomez 2022-01-11 14:54:53 -05:00
parent f70f9f7747
commit 173f91dd60
2 changed files with 7 additions and 4 deletions

Binary file not shown.

View File

@ -15,7 +15,7 @@ from trytond.wizard import (
Wizard, StateView, Button, StateAction, StateReport, StateTransition
)
from trytond.transaction import Transaction
from trytond.pyson import Eval
from trytond.pyson import Eval, Id
from trytond.modules.staff_payroll.period import Period
from trytond.modules.staff_payroll.payroll import PayrollReport
from trytond.i18n import gettext
@ -186,10 +186,13 @@ class Payroll(metaclass=PoolMeta):
def get_worked_days_effective(self, name=None):
if self.lines:
days = []
unit = 1
for l in self.lines:
if l.wage_type.wage_type.concept == 'salary':
if l.wage_type.type_concept == 'salary':
days.append(l.quantity)
days = sum(days)
if l.wage_type.uom.id == Id('product', 'uom_hour').pyson():
unit = 8
return sum(days)/unit
def adjust_partial_sunday(self, quantity):
# Factor = 8 hour sunday / 6 days (monday-saturday)
@ -1003,7 +1006,7 @@ class PayrollGlobalReport(Report):
raise WageTypeConceptError(
gettext('staff_payroll_co.msg_type_concept_not_exists', s=line.wage_type.name))
parties[employee_id][concept] += line.amount
parties[employee_id]['worked_days'] += payroll.worked_days
parties[employee_id]['worked_days'] += payroll.worked_days_effective
parties[employee_id]['gross_payments'] += payroll.gross_payments
parties[employee_id]['total_deductions'] += payroll.total_deductions
parties[employee_id]['net_payment'] += payroll.net_payment