2020-11-04 02:16:18 +01:00
|
|
|
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
|
|
|
# this repository contains the full copyright notices and license terms.
|
2020-11-03 23:39:33 +01:00
|
|
|
from trytond.pool import PoolMeta
|
2020-04-16 00:38:42 +02:00
|
|
|
from trytond.model import fields
|
2020-05-28 16:03:30 +02:00
|
|
|
from trytond.transaction import Transaction
|
2020-04-16 00:38:42 +02:00
|
|
|
|
|
|
|
|
|
|
|
__all__ = ['WageType']
|
|
|
|
|
|
|
|
ROUND_AMOUNTS = [
|
|
|
|
('', ''),
|
|
|
|
('above_amount', 'Above Amount'),
|
|
|
|
('under_amount', 'Under Amount'),
|
|
|
|
('automatic', 'Automatic'),
|
|
|
|
]
|
|
|
|
|
|
|
|
|
2020-05-27 21:54:36 +02:00
|
|
|
class WageType(metaclass=PoolMeta):
|
2020-04-16 00:38:42 +02:00
|
|
|
__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',
|
2020-11-03 23:39:33 +01:00
|
|
|
help='If is true, rounded month work days on payroll to 30 indeed '
|
2020-11-04 02:16:18 +01:00
|
|
|
'if month has 31 days, or rounded to 15 indeed the biweekly'
|
|
|
|
'pay has 16 days')
|
2020-11-03 23:39:33 +01:00
|
|
|
round_amounts = fields.Selection(ROUND_AMOUNTS, 'Rounds amounts',
|
|
|
|
help='Approximates the highest value in hundreds')
|
2021-02-02 15:02:24 +01:00
|
|
|
provision_cancellation = fields.Many2One('staff.wage_type', 'Cancellation of Provision')
|
2020-04-16 00:38:42 +02:00
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def __setup__(cls):
|
|
|
|
super(WageType, cls).__setup__()
|
|
|
|
new_sel = [
|
2020-11-03 23:39:33 +01:00
|
|
|
('health', 'Health'),
|
|
|
|
('retirement', 'Retirement'),
|
|
|
|
('risk', 'Risk'),
|
|
|
|
('box_family', 'Box Family'),
|
|
|
|
('commission', 'Commission'),
|
|
|
|
('bonus_service', 'Bonus Service'),
|
|
|
|
('food', 'Food'),
|
|
|
|
('unemployment', 'Unemployment'),
|
|
|
|
('allowance', 'Allowance'),
|
|
|
|
('transport', 'Transport'),
|
|
|
|
('interest', 'Interest'),
|
|
|
|
('bonus', 'Bonus'),
|
|
|
|
('tax', 'Tax'),
|
|
|
|
('holidays', 'Holidays'),
|
|
|
|
('syndicate', 'Syndicate'),
|
|
|
|
('fsp', 'FSP'),
|
|
|
|
('sena', 'SENA'),
|
|
|
|
('icbf', 'ICBF'),
|
|
|
|
('acquired_product', 'Acquired Product'),
|
|
|
|
('loan', 'Loan'),
|
|
|
|
('advance', 'Advance'),
|
2020-04-16 00:38:42 +02:00
|
|
|
]
|
|
|
|
if new_sel not in cls.type_concept.selection:
|
|
|
|
cls.type_concept.selection.extend(new_sel)
|
2020-05-27 21:54:36 +02:00
|
|
|
|
2020-05-28 16:03:30 +02:00
|
|
|
@classmethod
|
|
|
|
def __register__(cls, module_name):
|
|
|
|
super(WageType, cls).__register__(module_name)
|
|
|
|
cursor = Transaction().connection.cursor()
|
2020-11-04 02:16:18 +01:00
|
|
|
cursor.execute(
|
|
|
|
'ALTER TABLE staff_wage_type DROP COLUMN IF EXISTS amount_required'
|
|
|
|
)
|