Style fixed
This commit is contained in:
parent
e0dc033d22
commit
ed958568c7
|
@ -1,5 +1,5 @@
|
|||
#This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
#this repository contains the full copyright notices and license terms.
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
from decimal import Decimal
|
||||
from trytond import backend
|
||||
from trytond.model import Workflow, ModelSQL, ModelView, fields
|
||||
|
@ -9,17 +9,22 @@ from trytond.pyson import Eval, If, Bool
|
|||
from trytond.wizard import Wizard, StateView, Button, StateTransition
|
||||
from trytond.transaction import Transaction
|
||||
|
||||
__all__ = ['Liquidation', 'Report', 'LiquidationLine', 'LiquidationGroup',
|
||||
'LiquidationLineMoveLine', 'LiquidationLineAdjustment', 'LiquidationGroupStart'
|
||||
'LiquidationAdjustmentStart', 'LiquidationAdjustment']
|
||||
__all__ = [
|
||||
'Liquidation', 'Report', 'LiquidationLine', 'LiquidationGroup',
|
||||
'LiquidationLineMoveLine', 'LiquidationLineAdjustment',
|
||||
'LiquidationGroupStart', 'LiquidationAdjustmentStart',
|
||||
'LiquidationAdjustment'
|
||||
]
|
||||
|
||||
STATES = {'readonly': (Eval('state') != 'draft'),}
|
||||
STATES = {'readonly': (Eval('state') != 'draft')}
|
||||
|
||||
_ZERO = Decimal('0.0')
|
||||
|
||||
BONUS_SERVICE = ['bonus_service']
|
||||
CONTRACT = ['bonus_service', 'health', 'retirement', 'unemployment',
|
||||
'interest', 'holidays']
|
||||
CONTRACT = [
|
||||
'bonus_service', 'health', 'retirement', 'unemployment', 'interest',
|
||||
'holidays'
|
||||
]
|
||||
|
||||
|
||||
class Liquidation(Workflow, ModelSQL, ModelView):
|
||||
|
@ -164,9 +169,10 @@ class Liquidation(Workflow, ModelSQL, ModelView):
|
|||
bool_op = 'AND'
|
||||
else:
|
||||
bool_op = 'OR'
|
||||
return [bool_op,
|
||||
('employee',) + tuple(clause[1:]),
|
||||
('number',) + tuple(clause[1:]),
|
||||
return [
|
||||
bool_op,
|
||||
('employee',) + tuple(clause[1:]),
|
||||
('number',) + tuple(clause[1:]),
|
||||
]
|
||||
|
||||
@classmethod
|
||||
|
@ -204,7 +210,9 @@ class Liquidation(Workflow, ModelSQL, ModelView):
|
|||
wage_tax = WageType.search([('type_concept', '=', 'tax')])
|
||||
if wage_tax:
|
||||
wage_tax = wage_tax[0]
|
||||
deductions_month = sum([l.amount for l in rec.lines if l.wage.definition != 'payment'])
|
||||
deductions_month = sum([
|
||||
l.amount for l in rec.lines if l.wage.definition != 'payment'
|
||||
])
|
||||
salary_full = rec.net_payment
|
||||
payrolls = {p.end: p for p in rec.payrolls}
|
||||
max_date = max(payrolls.keys())
|
||||
|
@ -219,8 +227,6 @@ class Liquidation(Workflow, ModelSQL, ModelView):
|
|||
salary_args = payroll.get_salary_full(wage_tax)
|
||||
salary_full += salary_args['salary']
|
||||
|
||||
print('Salary ----> ', salary_full)
|
||||
print('Total Deductions ----> ', deductions_month)
|
||||
base_salary_withholding = salary_full - deductions_month
|
||||
amount_tax = UvtWithholding.compute_withholding(
|
||||
base_salary_withholding)
|
||||
|
@ -259,7 +265,6 @@ class Liquidation(Workflow, ModelSQL, ModelView):
|
|||
res = min(values)
|
||||
return res
|
||||
|
||||
|
||||
def get_payrolls(self, name):
|
||||
if not self.employee or not self.contract:
|
||||
return
|
||||
|
@ -296,7 +301,8 @@ class Liquidation(Workflow, ModelSQL, ModelView):
|
|||
}])
|
||||
self.write([self], {'move': move.id})
|
||||
for ml in move.lines:
|
||||
if ml.account.id not in grouped.keys() or ml.account.kind not in ('payable', 'receivable'):
|
||||
if ml.account.id not in grouped.keys() or (
|
||||
ml.account.kind not in ('payable', 'receivable')):
|
||||
continue
|
||||
to_reconcile = [ml]
|
||||
to_reconcile.extend(grouped[ml.account.id]['lines'])
|
||||
|
@ -408,15 +414,10 @@ class Liquidation(Workflow, ModelSQL, ModelView):
|
|||
moves_ids = []
|
||||
|
||||
for payroll in payrolls:
|
||||
#if not payroll.move:
|
||||
# self.raise_user_error('payroll_not_posted')
|
||||
# return
|
||||
if not payroll.move:
|
||||
continue
|
||||
moves_ids.append(payroll.move.id)
|
||||
|
||||
accounts_ids = []
|
||||
|
||||
for payroll in payrolls:
|
||||
days += payroll.worked_days
|
||||
for l in payroll.lines:
|
||||
|
@ -532,7 +533,7 @@ class LiquidationLine(ModelSQL, ModelView):
|
|||
__name__ = 'staff.liquidation.line'
|
||||
sequence = fields.Integer('Sequence', required=True)
|
||||
liquidation = fields.Many2One('staff.liquidation', 'Liquidation',
|
||||
required=True)
|
||||
required=True)
|
||||
wage = fields.Many2One('staff.wage_type', 'Wage Type', required=True)
|
||||
description = fields.Char('Description', required=True)
|
||||
amount = fields.Numeric('Amount', digits=(16, 2), required=True, depends=['adjustments', 'move_lines'])
|
||||
|
@ -541,7 +542,7 @@ class LiquidationLine(ModelSQL, ModelView):
|
|||
account = fields.Many2One('account.account', 'Account')
|
||||
move_lines = fields.Many2Many('staff.liquidation.line-move.line',
|
||||
'line', 'move_line', 'Liquidation Line - Move Line',
|
||||
domain=[
|
||||
domain=[
|
||||
('party', '=', Eval('party')),
|
||||
('account', '=', Eval('account')),
|
||||
], depends=['party', 'account'])
|
||||
|
@ -549,7 +550,6 @@ class LiquidationLine(ModelSQL, ModelView):
|
|||
'get_party')
|
||||
adjustments = fields.One2Many('staff.liquidation.line_adjustment', 'staff_liquidation_line', 'Adjustments')
|
||||
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(LiquidationLine, cls).__setup__()
|
||||
|
@ -565,27 +565,21 @@ class LiquidationLine(ModelSQL, ModelView):
|
|||
table.drop_column('hoard_amount')
|
||||
super(LiquidationLine, cls).__register__(module_name)
|
||||
|
||||
|
||||
def get_party(self, name=None):
|
||||
if self.liquidation.employee:
|
||||
return self.liquidation.employee.party.id
|
||||
|
||||
|
||||
@fields.depends('wage', 'description', 'amount', 'liquidation',
|
||||
'_parent_liquidation.employee', '_parent_liquidation.time_contracting',
|
||||
'_parent_liquidation.start_period', '_parent_liquidation.end_period',
|
||||
'_parent_liquidation.currency', 'sequence')
|
||||
'_parent_liquidation.employee', '_parent_liquidation.time_contracting',
|
||||
'_parent_liquidation.start_period', '_parent_liquidation.end_period',
|
||||
'_parent_liquidation.currency', 'sequence')
|
||||
def on_change_wage(self):
|
||||
if not self.wage:
|
||||
return
|
||||
self.sequence = self.wage.sequence
|
||||
self.description = self.wage.name
|
||||
self.days = self.liquidation.time_contracting
|
||||
#self.amount = self.liquidation.compute_amount(self.wage.id)
|
||||
|
||||
# @fields.depends('amount', 'move_lines')
|
||||
# def on_change_move_lines(self):
|
||||
# self.amount = sum([(ml.credit - ml.debit) for ml in self.move_lines])
|
||||
|
||||
@fields.depends('amount', 'adjustments', 'move_lines')
|
||||
def on_change_with_amount(self, name=None):
|
||||
|
@ -707,7 +701,7 @@ class LiquidationGroupStart(ModelView):
|
|||
'Liquidation Group Start'
|
||||
__name__ = 'staff.liquidation_group.start'
|
||||
employees = fields.Many2Many('company.employee', None, None, 'Employee',
|
||||
required=True)
|
||||
required=True)
|
||||
start_period = fields.Many2One('staff.payroll.period', 'Start Period',
|
||||
required=True)
|
||||
end_period = fields.Many2One('staff.payroll.period', 'End Period',
|
||||
|
@ -736,10 +730,10 @@ class LiquidationGroup(Wizard):
|
|||
'Liquidation Group'
|
||||
__name__ = 'staff.liquidation_group'
|
||||
start = StateView('staff.liquidation_group.start',
|
||||
'staff_payroll_co.liquidation_group_start_view_form', [
|
||||
'staff_payroll_co.liquidation_group_start_view_form', [
|
||||
Button('Cancel', 'end', 'tryton-cancel'),
|
||||
Button('Accept', 'open_', 'tryton-ok', default=True),
|
||||
])
|
||||
])
|
||||
open_ = StateTransition()
|
||||
|
||||
def transition_open_(self):
|
||||
|
@ -790,7 +784,6 @@ class LiquidationGroup(Wizard):
|
|||
compute_liquidations.append(liquidation)
|
||||
|
||||
Liquidation.compute_liquidation(compute_liquidations)
|
||||
|
||||
return 'end'
|
||||
|
||||
|
||||
|
@ -807,7 +800,6 @@ class MoveProvisionBonusServiceStart(ModelView):
|
|||
], required=True)
|
||||
category = fields.Many2One('staff.employee_category', 'Category')
|
||||
|
||||
|
||||
@staticmethod
|
||||
def default_company():
|
||||
return Transaction().context.get('company')
|
||||
|
@ -838,13 +830,12 @@ class MoveProvisionBonusService(Wizard):
|
|||
period_days = (self.start.period.end - self.start.period.start).days + 1
|
||||
|
||||
dom_contract = [
|
||||
['AND',
|
||||
['OR', [
|
||||
['AND', ['OR', [
|
||||
('end_date', '>', self.start.period.start),
|
||||
],[
|
||||
], [
|
||||
('end_date', '=', None),
|
||||
],
|
||||
],],
|
||||
]],
|
||||
]
|
||||
|
||||
if self.start.category:
|
||||
|
@ -855,7 +846,6 @@ class MoveProvisionBonusService(Wizard):
|
|||
period_in_month = 1 if period_days > 15 else 2
|
||||
salary_amount = contract.get_salary_in_date(_end_date)
|
||||
base_ = salary_amount
|
||||
bonus_service_wt = None
|
||||
move_lines = []
|
||||
employee = contract.employee
|
||||
|
||||
|
@ -869,7 +859,7 @@ class MoveProvisionBonusService(Wizard):
|
|||
period_id = AccountPeriod.find(_company.id, date=_end_date)
|
||||
provision_amount = provision_wage.compute_unit_price(
|
||||
{'salary': (round((base_ / period_in_month), 2))}
|
||||
)
|
||||
)
|
||||
move_lines.extend([
|
||||
{
|
||||
'debit': provision_amount,
|
||||
|
@ -894,6 +884,5 @@ class MoveProvisionBonusService(Wizard):
|
|||
'description': self.start.description,
|
||||
'lines': [('create', move_lines)],
|
||||
}])
|
||||
# Move.post([move])
|
||||
|
||||
return 'end'
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
import calendar
|
||||
from decimal import Decimal
|
||||
from datetime import date
|
||||
import math
|
||||
from trytond.model import ModelView, fields, Workflow
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.report import Report
|
||||
from trytond.wizard import Wizard, StateView, Button, StateAction, StateReport, StateTransition
|
||||
from trytond.wizard import Wizard, StateView, Button, StateAction, StateReport
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.pyson import Eval
|
||||
from trytond.modules.staff_payroll import Period
|
||||
import math
|
||||
from trytond.modules.staff_payroll import PayrollReport
|
||||
|
||||
|
||||
|
@ -1589,7 +1589,9 @@ class Exo2276Report(Report):
|
|||
vals['various'] + vals['food'])
|
||||
vals['total_benefit'] = vals['holidays'] + vals['bonus_service']
|
||||
vals['total_retirement'] = vals['fsp'] + vals['retirement']
|
||||
vals['total_salary'] = vals['salary'] + vals['extras'] + vals['transport']
|
||||
vals['total_salary'] = sum([
|
||||
vals['salary'], vals['extras'], vals['transport']
|
||||
])
|
||||
return vals
|
||||
|
||||
|
||||
|
|
13
position.py
13
position.py
|
@ -1,19 +1,18 @@
|
|||
#This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
#this repository contains the full copyright notices and license terms.
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
from trytond.model import fields
|
||||
from trytond.pool import PoolMeta
|
||||
|
||||
__all__ = ['Position']
|
||||
|
||||
|
||||
|
||||
class Position:
|
||||
__metaclass__ = PoolMeta
|
||||
class Position(metaclass=PoolMeta):
|
||||
__name__ = 'staff.position'
|
||||
adjust_days_worked = fields.Boolean('Adjust Days Worked',
|
||||
help='If is true, rounded month work days on payroll to 30 indeed'
|
||||
' if month has 31 days, or rounded to 15 indeed the biweekly'
|
||||
' pay has 16 days')
|
||||
' if month has 31 days, or rounded to 15 indeed the biweekly'
|
||||
' pay has 16 days'
|
||||
)
|
||||
partial_sunday = fields.Boolean('Partial Sunday',
|
||||
help='If is true, sunday day is pay for partial amount if start '
|
||||
'or end contract in its period')
|
||||
|
|
Loading…
Reference in New Issue