From f83eb11421fdcd222fffa43e54ac60d5a18ab310 Mon Sep 17 00:00:00 2001 From: Oscar Date: Thu, 11 Nov 2021 00:47:34 -0500 Subject: [PATCH] Fix --- payroll.py | 54 ++++++++++++++++++++++++------------------------------ 1 file changed, 24 insertions(+), 30 deletions(-) diff --git a/payroll.py b/payroll.py index 01fc826..cc888b1 100644 --- a/payroll.py +++ b/payroll.py @@ -63,9 +63,9 @@ class PayrollLineMoveLine(ModelSQL): __name__ = "staff.payroll.line-move.line" _table = 'staff_payroll_line_move_line_rel' line = fields.Many2One('staff.payroll.line', 'Line', - ondelete='CASCADE', select=True, required=True) + ondelete='CASCADE', select=True, required=True) move_line = fields.Many2One('account.move.line', 'Move Line', - ondelete='RESTRICT', select=True, required=True) + ondelete='RESTRICT', select=True, required=True) class Payroll(metaclass=PoolMeta): @@ -194,9 +194,6 @@ class Payroll(metaclass=PoolMeta): fix_qty = self.start.weekday() * factor quantity = Decimal(str(round(quantity - fix_qty, 2))) - # FIXME - # if self.is_last_payroll: - # pass return quantity def _get_line_quantity(self, quantity_days, wage, extras, discount): @@ -372,10 +369,10 @@ class Payroll(metaclass=PoolMeta): if concept == 'holidays': Event = Pool().get('staff.event') events = Event.search([ - ('employee', '=', self.employee), - ('state', '=', 'done'), - ('line_payroll', '=', line.id) - ]) + ('employee', '=', self.employee), + ('state', '=', 'done'), + ('line_payroll', '=', line.id) + ]) if events: return 'holidays' @@ -493,7 +490,7 @@ class Payroll(metaclass=PoolMeta): try: res = sum(average_days_monthly)/len(average_days_monthly)/30 except: - res = contract.salary/30 if contract.salary else 0 + res = contract.salary / 30 if contract.salary else 0 else: next_date = end_date payrolls = cls._get_payrolls_period( @@ -574,7 +571,6 @@ class Payroll(metaclass=PoolMeta): if interest < _ZERO: interest = _ZERO - print(interest) return Decimal(str(round(interest, 2))) # return self.currency.round(Decimal(interest)) @@ -1033,10 +1029,10 @@ class PayrollPayment(Wizard): 'Payroll Payment' __name__ = 'staff.payroll.payment' start = StateView('staff.payroll_payment.start', - 'staff_payroll_co.payroll_payment_start_view_form', [ - Button('Cancel', 'end', 'tryton-cancel'), - Button('Print', 'print_', 'tryton-ok', default=True), - ]) + 'staff_payroll_co.payroll_payment_start_view_form', [ + Button('Cancel', 'end', 'tryton-cancel'), + Button('Print', 'print_', 'tryton-ok', default=True), + ]) print_ = StateReport('staff.payroll.payment_report') def do_print_(self, action): @@ -1126,10 +1122,10 @@ class PayrollPaycheck(Wizard): 'Payroll Paycheck' __name__ = 'staff.payroll.paycheck' start = StateView('staff.payroll_paycheck.start', - 'staff_payroll_co.payroll_paycheck_start_view_form', [ - Button('Cancel', 'end', 'tryton-cancel'), - Button('Print', 'print_', 'tryton-ok', default=True), - ]) + 'staff_payroll_co.payroll_paycheck_start_view_form', [ + Button('Cancel', 'end', 'tryton-cancel'), + Button('Print', 'print_', 'tryton-ok', default=True), + ]) print_ = StateReport('staff.payroll.paycheck_report') def do_print_(self, action): @@ -1319,10 +1315,10 @@ class PayrollSheet(Wizard): 'Payroll Sheet' __name__ = 'staff.payroll.sheet' start = StateView('staff.payroll.sheet.start', - 'staff_payroll_co.payroll_sheet_start_view_form', [ - Button('Cancel', 'end', 'tryton-cancel'), - Button('Print', 'print_', 'tryton-ok', default=True), - ]) + 'staff_payroll_co.payroll_sheet_start_view_form', [ + Button('Cancel', 'end', 'tryton-cancel'), + Button('Print', 'print_', 'tryton-ok', default=True), + ]) print_ = StateReport('staff.payroll.sheet_report') def do_print_(self, action): @@ -1363,9 +1359,10 @@ class PayrollSheetReport(Report): ('project', '=', data.get('project')), ) payrolls = Payroll.search(dom_payroll, - order=[('employee.party.name', 'ASC'), - ('period.name', 'ASC')] - ) + order=[ + ('employee.party.name', 'ASC'), + ('period.name', 'ASC') + ]) new_objects = [] default_vals = cls.default_values() @@ -1511,9 +1508,7 @@ class PayrollGroupStart(metaclass=PoolMeta): __name__ = 'staff.payroll_group.start' department = fields.Many2One('company.department', 'Department') employees = fields.Many2Many('company.employee', None, None, - 'Employees', domain=[ - ('active', '=', True), - ]) + 'Employees', domain=[('active', '=', True)]) class PayrollGroup(metaclass=PoolMeta): @@ -2138,7 +2133,6 @@ class PayrollsMultiPayment(Wizard): }]) amount_to_pay = voucher._get_amount_to_pay() voucher.amount_to_pay = amount_to_pay - print(voucher) voucher.save() return 'end'