mirror of
https://bitbucket.org/presik/trytonpsk-staff_payroll_co.git
synced 2023-12-14 06:42:56 +01:00
modified import employee with contracts
This commit is contained in:
parent
c8e427f914
commit
7da994026b
58
employee.py
58
employee.py
|
@ -8,6 +8,40 @@ from datetime import datetime
|
|||
|
||||
__all__ = ['Employee']
|
||||
|
||||
SEX = {
|
||||
'': '',
|
||||
'hombre': 'male',
|
||||
'mujer': 'female'
|
||||
}
|
||||
|
||||
MARITAL = {
|
||||
'': '',
|
||||
'VIUDO(A)': 'widow',
|
||||
'CASADO(A)': 'married',
|
||||
'SOLTERO(A)': 'single',
|
||||
'UNION_LIBRE': 'free_union',
|
||||
'DIVORCIADO(A)': 'divorced'
|
||||
}
|
||||
|
||||
BLOOD = {
|
||||
'': '',
|
||||
'O+': 'rh_op',
|
||||
'O-': 'rh_on',
|
||||
'A+': 'rh_ap',
|
||||
'A-': 'rh_an',
|
||||
'B+': 'rh_bp',
|
||||
'B-': 'rh_bn',
|
||||
'AB+': 'rh_abp',
|
||||
'AB-': 'rh_abn'
|
||||
}
|
||||
|
||||
KIND_CONT = {
|
||||
'': '',
|
||||
'fijo': 'indefinite',
|
||||
'obra_o_labor': 'job',
|
||||
'termino_indefinido': 'steady'
|
||||
}
|
||||
|
||||
|
||||
class Employee(metaclass=PoolMeta):
|
||||
__name__ = 'company.employee'
|
||||
|
@ -30,6 +64,7 @@ class Employee(metaclass=PoolMeta):
|
|||
'department_not_exists': ('The department with name "%s" not exists!'),
|
||||
'project_not_exists': ('The project with name "%s" not exists!'),
|
||||
'category_not_exists': ('The category with name "%s" not exists!'),
|
||||
'analytic_account_not_exists': ('The analytic account with name "%s" not exists!'),
|
||||
})
|
||||
|
||||
@classmethod
|
||||
|
@ -79,15 +114,26 @@ class Employee(metaclass=PoolMeta):
|
|||
fn = names_[0]
|
||||
ffn = names_[1]
|
||||
|
||||
|
||||
create_party = {
|
||||
'type_document': '13',
|
||||
'id_number': row[0],
|
||||
'name': row[1],
|
||||
'birthday': compute_date(row[23]),
|
||||
'first_name': fn,
|
||||
'second_name': sn,
|
||||
'first_family_name': ffn,
|
||||
'second_family_name': sfn,
|
||||
'id_number': row[0],
|
||||
'type_document': '13',
|
||||
'birthday': compute_date(row[23]),
|
||||
'sex': SEX[row[24]],
|
||||
'marital_status': MARITAL[row[25]],
|
||||
'blood_group': BLOOD[row[31]],
|
||||
'subdivision_born': row[26],
|
||||
'city_born': row[27],
|
||||
'education': row[29],
|
||||
'profession': row[28],
|
||||
'weight': row[30],
|
||||
'health': row[32],
|
||||
'notes': row[33],
|
||||
'addresses': [('create', [{
|
||||
'street': row[3],
|
||||
}])],
|
||||
|
@ -162,6 +208,8 @@ class Employee(metaclass=PoolMeta):
|
|||
accounts = AnalyticAccount.search([
|
||||
('name', '=', row[8]),
|
||||
])
|
||||
if not accounts:
|
||||
cls.raise_user_error('analytic_account_not_exists', row[8])
|
||||
|
||||
mandatory_wages = {
|
||||
'1': 'ARL CLASE I OPERATIVO',
|
||||
|
@ -191,7 +239,7 @@ class Employee(metaclass=PoolMeta):
|
|||
'fix_amount': 0,
|
||||
'party': parties[0].id,
|
||||
'wage_type': wage_id,
|
||||
'analytic_account': accounts[0].id if accounts else None,
|
||||
'analytic_account': accounts[0].id,
|
||||
})
|
||||
|
||||
for wage in employee.category.wages_default:
|
||||
|
@ -244,7 +292,7 @@ class Employee(metaclass=PoolMeta):
|
|||
'position': positions[0].id,
|
||||
'salary': Decimal(row[12]) if row[12] else 0,
|
||||
'transport_bonus': Decimal(row[13]) if row[13] else 0,
|
||||
'kind': 'job',
|
||||
'kind': KIND_CONT[row[11]],
|
||||
'contract_date': compute_date(start_date_contract),
|
||||
'start_date': compute_date(start_date_contract),
|
||||
'end_date': compute_date(end_date_contract) if end_date_contract else None,
|
||||
|
|
Loading…
Reference in a new issue