mirror of
https://bitbucket.org/presik/trytonpsk-staff_payroll_co.git
synced 2023-12-14 06:42:56 +01:00
add create liquidation group
This commit is contained in:
parent
9ed08f8e24
commit
8d39321933
|
@ -10,6 +10,7 @@ import employee
|
|||
import uvt
|
||||
import event_category
|
||||
import account
|
||||
import liquidation
|
||||
|
||||
def register():
|
||||
Pool.register(
|
||||
|
@ -30,6 +31,7 @@ def register():
|
|||
liquidation.LiquidationLineMoveLine,
|
||||
liquidation.LiquidationLineAdjustment,
|
||||
liquidation.LiquidationAdjustmentStart,
|
||||
liquidation.LiquidationGroupStart,
|
||||
payroll.PayrollGroupStart,
|
||||
event_category.EventCategory,
|
||||
payroll.OpenPayrollByPeriodStart,
|
||||
|
@ -62,4 +64,5 @@ def register():
|
|||
payroll.Exo2276,
|
||||
payroll.IncomeWithholdings,
|
||||
liquidation.LiquidationAdjustment,
|
||||
liquidation.LiquidationGroup,
|
||||
module='staff_payroll_co', type_='wizard')
|
||||
|
|
|
@ -647,3 +647,90 @@ class LiquidationAdjustment(Wizard):
|
|||
self.create_adjustment(line)
|
||||
|
||||
return 'end'
|
||||
|
||||
|
||||
class LiquidationGroupStart(ModelView):
|
||||
'Liquidation Group Start'
|
||||
__name__ = 'staff.liquidation_group.start'
|
||||
employees = fields.Many2Many('company.employee', None, None, 'Employee',
|
||||
required=True)
|
||||
start_period = fields.Many2One('staff.payroll.period', 'Start Period',
|
||||
required=True)
|
||||
end_period = fields.Many2One('staff.payroll.period', 'End Period',
|
||||
required=True, depends=['start_period'])
|
||||
kind = fields.Selection([
|
||||
('contract', 'Contract'),
|
||||
('bonus_service', 'Bonus Service'),
|
||||
('interest', 'Interest'),
|
||||
('vacation', 'Vacation'),
|
||||
], 'Kind', required=True)
|
||||
liquidation_date = fields.Date('Liquidation Date', required=True)
|
||||
company = fields.Many2One('company.company', 'Company', required=True)
|
||||
description = fields.Char('Description', required=True)
|
||||
account = fields.Many2One('account.account', 'Account',
|
||||
required=True, domain=[
|
||||
('kind', '!=', 'view'),
|
||||
('company', '=', Eval('company'))
|
||||
])
|
||||
|
||||
@staticmethod
|
||||
def default_company():
|
||||
return Transaction().context.get('company')
|
||||
|
||||
|
||||
class LiquidationGroup(Wizard):
|
||||
'Liquidation Group'
|
||||
__name__ = 'staff.liquidation_group'
|
||||
start = StateView('staff.liquidation_group.start',
|
||||
'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):
|
||||
pool = Pool()
|
||||
Liquidation = pool.get('staff.liquidation')
|
||||
compute_liquidations = []
|
||||
|
||||
start_period = self.start.start_period.id
|
||||
end_period = self.start.end_period.id
|
||||
kind = self.start.kind
|
||||
liquidation_date = self.start.liquidation_date
|
||||
company_id = self.start.company.id
|
||||
description = self.start.description
|
||||
currency_id = self.start.company.currency.id
|
||||
account_id = self.start.account.id
|
||||
employees = self.start.employees
|
||||
employee_ids = [e.id for e in employees]
|
||||
|
||||
contracts = Liquidation.search_read([
|
||||
('employee', 'in', employee_ids)
|
||||
], fields_names=['contract'])
|
||||
contract_ids = [i['contract'] for i in contracts]
|
||||
for employee in employees:
|
||||
|
||||
if employee.contract in contract_ids or not employee.contract:
|
||||
continue
|
||||
lqt_create = {
|
||||
'start_period': start_period,
|
||||
'end_period': end_period,
|
||||
'employee': employee.id,
|
||||
'contract': employee.contract.id,
|
||||
'kind': kind,
|
||||
'liquidation_date': liquidation_date,
|
||||
'time_contracting': None,
|
||||
'state': 'draft',
|
||||
'company': company_id,
|
||||
'description': description,
|
||||
'currency': currency_id,
|
||||
'account': account_id
|
||||
}
|
||||
liquidation, = Liquidation.create([lqt_create])
|
||||
liquidation.on_change_with_time_contracting()
|
||||
liquidation.save()
|
||||
compute_liquidations.append(liquidation)
|
||||
|
||||
Liquidation.compute_liquidation(compute_liquidations)
|
||||
|
||||
return 'end'
|
||||
|
|
|
@ -97,5 +97,17 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<field name="action" ref="act_create_liquidation_adjustment"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="liquidation_group_start_view_form">
|
||||
<field name="model">staff.liquidation_group.start</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">liquidation_create_group_form</field>
|
||||
</record>
|
||||
<record model="ir.action.wizard" id="wizard_create_liquidation_group">
|
||||
<field name="name">Create Liquidation Group</field>
|
||||
<field name="wiz_name">staff.liquidation_group</field>
|
||||
</record>
|
||||
<menuitem parent="staff.menu_staff" id="menu_create_liquidation_group"
|
||||
sequence="11" action="wizard_create_liquidation_group"/>
|
||||
|
||||
</data>
|
||||
</tryton>
|
||||
|
|
82
locale/es.po
82
locale/es.po
|
@ -402,6 +402,42 @@ msgctxt "field:staff.liquidation_adjustment.start,wage_type:"
|
|||
msgid "Wage Type"
|
||||
msgstr "Tipo de Pago"
|
||||
|
||||
msgctxt "field:staff.liquidation_group.start,account:"
|
||||
msgid "Account"
|
||||
msgstr "Cuentas"
|
||||
|
||||
msgctxt "field:staff.liquidation_group.start,company:"
|
||||
msgid "Company"
|
||||
msgstr "Empresa"
|
||||
|
||||
msgctxt "field:staff.liquidation_group.start,description:"
|
||||
msgid "Description"
|
||||
msgstr "Descripción"
|
||||
|
||||
msgctxt "field:staff.liquidation_group.start,employees:"
|
||||
msgid "Employee"
|
||||
msgstr "Empleado"
|
||||
|
||||
msgctxt "field:staff.liquidation_group.start,end_period:"
|
||||
msgid "End Period"
|
||||
msgstr "Período Final"
|
||||
|
||||
msgctxt "field:staff.liquidation_group.start,id:"
|
||||
msgid "ID"
|
||||
msgstr "UP"
|
||||
|
||||
msgctxt "field:staff.liquidation_group.start,kind:"
|
||||
msgid "Kind"
|
||||
msgstr "Tipo"
|
||||
|
||||
msgctxt "field:staff.liquidation_group.start,liquidation_date:"
|
||||
msgid "Liquidation Date"
|
||||
msgstr "Fecha"
|
||||
|
||||
msgctxt "field:staff.liquidation_group.start,start_period:"
|
||||
msgid "Start Period"
|
||||
msgstr "Período Inicial"
|
||||
|
||||
msgctxt "field:staff.payroll,absenteeism_days:"
|
||||
msgid "Absenteeism Days"
|
||||
msgstr "Días de Ausentismo"
|
||||
|
@ -746,8 +782,8 @@ msgstr ""
|
|||
|
||||
msgctxt "help:staff.wage_type,adjust_days_worked:"
|
||||
msgid ""
|
||||
"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 is true, rounded month work days on payroll to 30 indeedif month has 31 "
|
||||
"days, or rounded to 15 indeed the biweeklypay has 16 days"
|
||||
msgstr ""
|
||||
"Si es verdadero, redondeará los dias trabajados en el mes a 30 incluso si el"
|
||||
" mes tiene 31 días, o redondeará a 15 días incluso si es quincena tiene 16 "
|
||||
|
@ -798,7 +834,7 @@ msgid "Income Withholdings Report"
|
|||
msgstr "Certificado Ingresos y Retenciones"
|
||||
|
||||
msgctxt "model:ir.action,name:payroll_export_moves_report"
|
||||
msgid "Exportar Asientos"
|
||||
msgid "Export Move Report"
|
||||
msgstr "Exportar Asientos"
|
||||
|
||||
msgctxt "model:ir.action,name:report_exo_2276"
|
||||
|
@ -825,6 +861,10 @@ msgctxt "model:ir.action,name:report_staff_liquidation"
|
|||
msgid "Liquidation"
|
||||
msgstr "Liquidación"
|
||||
|
||||
msgctxt "model:ir.action,name:wizard_create_liquidation_group"
|
||||
msgid "Create Liquidation Group"
|
||||
msgstr "Crear Liquidación en Grupo"
|
||||
|
||||
msgctxt "model:ir.action,name:wizard_exo2276"
|
||||
msgid "Report Exo2276"
|
||||
msgstr "Reporte Exogena2276"
|
||||
|
@ -861,6 +901,10 @@ msgctxt "model:ir.ui.menu,name:"
|
|||
msgid "Payroll Liquidation Wizard"
|
||||
msgstr "Liquidación de Contrato"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_create_liquidation_group"
|
||||
msgid "Create Liquidation Group"
|
||||
msgstr "Crear Liquidación en Grupo"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_exo2276"
|
||||
msgid "Report Exo2276"
|
||||
msgstr "Reporte Exogena2276"
|
||||
|
@ -929,6 +973,10 @@ msgctxt "model:staff.liquidation_adjustment.start,name:"
|
|||
msgid "Create Liquidation Adjustment Start"
|
||||
msgstr "Crear Ajuste de Liquidación"
|
||||
|
||||
msgctxt "model:staff.liquidation_group.start,name:"
|
||||
msgid "Liquidation Group Start"
|
||||
msgstr "Crear Liquidación en Grupo"
|
||||
|
||||
msgctxt "model:staff.payroll.income_withholdings.start,name:"
|
||||
msgid "Income Withholding Start"
|
||||
msgstr "Certificado Ingresos y Retenciones"
|
||||
|
@ -1135,7 +1183,7 @@ msgstr ""
|
|||
|
||||
msgctxt "report:staff.liquidation.report:"
|
||||
msgid "LIQUIDACION"
|
||||
msgstr ""
|
||||
msgstr "LIQUIDACION"
|
||||
|
||||
msgctxt "report:staff.liquidation.report:"
|
||||
msgid "LIQUIDACION DE"
|
||||
|
@ -4293,7 +4341,7 @@ msgstr ""
|
|||
|
||||
msgctxt "report:staff_payroll.export_moves.report:"
|
||||
msgid "1"
|
||||
msgstr ""
|
||||
msgstr "1"
|
||||
|
||||
msgctxt "report:staff_payroll.export_moves.report:"
|
||||
msgid ":"
|
||||
|
@ -4413,6 +4461,22 @@ msgctxt "selection:staff.liquidation,state:"
|
|||
msgid "Posted"
|
||||
msgstr "Contabilizado"
|
||||
|
||||
msgctxt "selection:staff.liquidation_group.start,kind:"
|
||||
msgid "Bonus Service"
|
||||
msgstr "Prima de Servicio"
|
||||
|
||||
msgctxt "selection:staff.liquidation_group.start,kind:"
|
||||
msgid "Contract"
|
||||
msgstr "Contrato"
|
||||
|
||||
msgctxt "selection:staff.liquidation_group.start,kind:"
|
||||
msgid "Interest"
|
||||
msgstr "Intereses de Cesantias"
|
||||
|
||||
msgctxt "selection:staff.liquidation_group.start,kind:"
|
||||
msgid "Vacation"
|
||||
msgstr "Vacaciones"
|
||||
|
||||
msgctxt "selection:staff.wage_type,round_amounts:"
|
||||
msgid ""
|
||||
msgstr ""
|
||||
|
@ -4625,6 +4689,14 @@ msgctxt "wizard_button:staff.liquidation_adjustment,start,end:"
|
|||
msgid "Cancel"
|
||||
msgstr "Cancelar"
|
||||
|
||||
msgctxt "wizard_button:staff.liquidation_group,start,end:"
|
||||
msgid "Cancel"
|
||||
msgstr "Cancelar"
|
||||
|
||||
msgctxt "wizard_button:staff.liquidation_group,start,open_:"
|
||||
msgid "Accept"
|
||||
msgstr "Aceptar"
|
||||
|
||||
msgctxt "wizard_button:staff.payroll.global,start,end:"
|
||||
msgid "Cancel"
|
||||
msgstr "Cancelar"
|
||||
|
|
20
view/liquidation_create_group_form.xml
Normal file
20
view/liquidation_create_group_form.xml
Normal file
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<form >
|
||||
<label name="start_period"/>
|
||||
<field name="start_period"/>
|
||||
<label name="company"/>
|
||||
<field name="company"/>
|
||||
<label name="end_period"/>
|
||||
<field name="end_period"/>
|
||||
<label name="kind"/>
|
||||
<field name="kind"/>
|
||||
<label name="liquidation_date"/>
|
||||
<field name="liquidation_date"/>
|
||||
<label name="account"/>
|
||||
<field name="account"/>
|
||||
<label name="description"/>
|
||||
<field name="description"/>
|
||||
<field name="employees" colspan="4"/>
|
||||
</form>
|
Loading…
Reference in a new issue