trytonpsk-staff_payroll_co/wage_type.py

90 lines
3.6 KiB
Python
Raw Normal View History

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
from trytond.transaction import Transaction
2021-06-09 18:07:42 +02:00
from trytond.report import Report
2023-02-01 23:25:10 +01:00
from trytond.pyson import Eval
2020-04-16 00:38:42 +02:00
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')
provision_cancellation = fields.Many2One('staff.wage_type', 'Cancellation of Provision')
2023-02-01 23:25:10 +01:00
# wage_type_60_40 = fields.Many2One('staff.wage_type', 'Wage Type 60/40', help='select wage type for set 60/40')
account_60_40 = fields.Many2One('account.account', 'Account 60/40',
domain=[
('type', '!=', None),
('company', '=', Eval('context', {}).get('company', 0))],
states={
'invisible': ~Eval('context', {}).get('company'),
}, help='select wage type for set 60/40')
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'),
2021-10-22 01:01:44 +02:00
('convencional_bonus', 'Convencional Bonus'),
('vacation_bonus', 'Vacation Bonus'),
('room_bonus', 'Room Bonus'),
('salary_readjustment', 'Salary Readjustment'),
('non_salary_readjustment', 'Non-Salary Readjustment'),
('non_salary_bonus', 'Non-Salary Bonus'),
('incapacity_greater_to_2_days', 'Incapacity greater to 2 days'),
('incapacity_less_to_2_days', 'Incapacity less to 2 days'),
('incapacity_arl', 'Incapacity Arl'),
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
@classmethod
def __register__(cls, module_name):
super(WageType, cls).__register__(module_name)
2022-02-02 17:41:18 +01:00
table_h = cls.__table_handler__(module_name)
if table_h.column_exist('amount_required'):
table_h.drop_column('amount_required')
# cursor = Transaction().connection.cursor()
# cursor.execute(
# 'ALTER TABLE staff_wage_type DROP COLUMN IF EXISTS amount_required'
# )
2021-06-09 18:07:42 +02:00
class WageTypeReport(Report):
__name__ = 'staff.wage_type.report'