minor fix
This commit is contained in:
parent
bac3c9fd65
commit
7ee246d095
BIN
export_moves.ods
BIN
export_moves.ods
Binary file not shown.
49
payroll.py
49
payroll.py
|
@ -16,21 +16,25 @@ from trytond.modules.staff_payroll import PayrollReport
|
|||
|
||||
|
||||
__all__ = ['Payroll', 'PayrollGlobalStart', 'PayrollGlobal',
|
||||
'PayrollGlobalReport', 'PayrollPaymentReport', 'PayrollPayment',
|
||||
'PayrollPaymentStart', 'PayrollPaycheckStart',
|
||||
'PayrollPaycheckReport', 'PayrollPaycheck',
|
||||
'PayrollSheetReport', 'PayrollSheet', 'PayrollSheetStart',
|
||||
'PayrollGroupStart', 'PayrollGroup', 'PayrollByPeriodDynamic',
|
||||
'OpenPayrollByPeriod', 'OpenPayrollByPeriodStart',
|
||||
'FixPayrollStart', 'FixPayroll', 'Exo2276Start', 'Exo2276',
|
||||
'Exo2276Report', 'PayrollLine', 'IncomeWithholdings',
|
||||
'IncomeWithholdingsStart', 'IncomeWithholdingsReport'
|
||||
]
|
||||
'PayrollGlobalReport', 'PayrollPaymentReport', 'PayrollPayment',
|
||||
'PayrollPaymentStart', 'PayrollPaycheckStart',
|
||||
'PayrollPaycheckReport', 'PayrollPaycheck',
|
||||
'PayrollSheetReport', 'PayrollSheet', 'PayrollSheetStart',
|
||||
'PayrollGroupStart', 'PayrollGroup', 'PayrollByPeriodDynamic',
|
||||
'OpenPayrollByPeriod', 'OpenPayrollByPeriodStart',
|
||||
'FixPayrollStart', 'FixPayroll', 'Exo2276Start', 'Exo2276',
|
||||
'Exo2276Report', 'PayrollLine', 'IncomeWithholdings',
|
||||
'IncomeWithholdingsStart', 'IncomeWithholdingsReport'
|
||||
]
|
||||
|
||||
|
||||
STATES = {'readonly': (Eval('state') != 'draft'),}
|
||||
STATES = {'readonly': (Eval('state') != 'draft')}
|
||||
_ZERO = Decimal('0.0')
|
||||
PAYMENTS = ['salary', 'bonus', 'reco', 'recf', 'hedo', 'heno', 'dom', 'hedf', 'henf']
|
||||
PAYMENTS = ['salary', 'bonus', 'reco', 'recf', 'hedo', 'heno',
|
||||
'dom', 'hedf', 'henf']
|
||||
SOCIAL_SEGURITY = ['risk', 'health', 'retirement',
|
||||
'box_family', 'sena', 'icbf']
|
||||
|
||||
|
||||
class PayrollLine(metaclass=PoolMeta):
|
||||
__name__ = "staff.payroll.line"
|
||||
|
@ -277,10 +281,27 @@ class Payroll(metaclass=PoolMeta):
|
|||
# if len(payrolls) >= num_subperiod:
|
||||
for payroll in payrolls:
|
||||
res += payroll.compute_salary_full(wage)
|
||||
# if payroll.contract:
|
||||
# payrolls_contract[payroll.contract.id] = res
|
||||
# if payroll.contract:
|
||||
# payrolls_contract[payroll.contract.id] = res
|
||||
return res
|
||||
|
||||
def get_line(self, wage, qty, unit_value, party=None):
|
||||
res = super(Payroll, self).get_line(wage, qty, unit_value, party)
|
||||
res['unit_value'] = self._validate_amount_wage(wage, res['unit_value'])
|
||||
return res
|
||||
|
||||
def _validate_amount_wage(self, wage, amount):
|
||||
config = Pool().get('staff.configuration')(1)
|
||||
salary_in_date = self.contract.get_salary_in_date(self.end)
|
||||
if config and config.minimum_salary and \
|
||||
wage.type_concept == 'transport' and \
|
||||
salary_in_date >= (config.minimum_salary * 2):
|
||||
amount = 0
|
||||
if wage.type_concept in SOCIAL_SEGURITY and \
|
||||
amount < wage.minimal_unit_price:
|
||||
amount = wage.minimal_unit_price
|
||||
return amount
|
||||
|
||||
def set_preliquidation(self, extras, discounts=None):
|
||||
discounts = self.set_events()
|
||||
ctx = {
|
||||
|
|
28
wage_type.py
28
wage_type.py
|
@ -1,6 +1,6 @@
|
|||
#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.pool import PoolMeta
|
||||
from trytond.pool import PoolMeta, Pool
|
||||
from trytond.model import fields
|
||||
from trytond.pyson import Eval
|
||||
|
||||
|
@ -15,17 +15,20 @@ ROUND_AMOUNTS = [
|
|||
]
|
||||
|
||||
|
||||
class WageType:
|
||||
__metaclass__ = PoolMeta
|
||||
class WageType(metaclass=PoolMeta):
|
||||
__name__ = 'staff.wage_type'
|
||||
minimal_amount = fields.Numeric('Minimal Amount')
|
||||
month_application = fields.Boolean('Month Application')
|
||||
apply_special_salary = fields.Boolean('Apply Special Salary')
|
||||
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')
|
||||
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')
|
||||
round_amounts = fields.Selection(ROUND_AMOUNTS, 'Rounds amounts', help='Approximates the highest value in hundreds')
|
||||
minimal_expense = fields.Function(fields.Numeric('Minimun Expense Amount'),
|
||||
'validate_minimum_amount')
|
||||
minimal_unit_price = fields.Function(fields.Numeric('Minimun Expense Amount'),
|
||||
'validate_minimum_amount')
|
||||
# limit_days = fields.Numeric('Limit Days', states={
|
||||
# 'invisible': Eval('type_concept') != 'special',
|
||||
# 'required': Eval('type_concept') == 'special',
|
||||
|
@ -59,3 +62,16 @@ class WageType:
|
|||
]
|
||||
if new_sel not in cls.type_concept.selection:
|
||||
cls.type_concept.selection.extend(new_sel)
|
||||
|
||||
def validate_minimum_amount(self, name):
|
||||
config = Pool().get('staff.configuration')(1)
|
||||
if config:
|
||||
minimum_salary = config.minimum_salary
|
||||
num_subperiod = 30 / config.default_liquidation_period
|
||||
amount = minimum_salary / num_subperiod
|
||||
if name == 'minimal_unit_price':
|
||||
return self.compute_unit_price({'salary': amount})
|
||||
if name == 'minimal_expense':
|
||||
return self.compute_expense({'salary': amount})
|
||||
return 0
|
||||
|
||||
|
|
Loading…
Reference in New Issue