wizard of payroll support dispersion
This commit is contained in:
parent
a923cbfb03
commit
28af255167
|
@ -42,6 +42,7 @@ def register():
|
|||
payroll.IncomeWithholdingsStart,
|
||||
payroll.PayrollExportStart,
|
||||
liquidation.MoveProvisionBonusServiceStart,
|
||||
payroll.PayrollSupportDispersionStart,
|
||||
module='staff_payroll_co', type_='model')
|
||||
Pool.register(
|
||||
payroll.PayrollGlobalReport,
|
||||
|
@ -68,4 +69,5 @@ def register():
|
|||
liquidation.LiquidationAdjustment,
|
||||
liquidation.LiquidationGroup,
|
||||
liquidation.MoveProvisionBonusService,
|
||||
payroll.PayrollSupportDispersion,
|
||||
module='staff_payroll_co', type_='wizard')
|
||||
|
|
|
@ -20,3 +20,4 @@ class Configuration(metaclass=PoolMeta):
|
|||
('kind', '=', 'payable'),
|
||||
], required=True)
|
||||
payment_partial_sunday = fields.Boolean('Payment Partial Sunday')
|
||||
template_email_confirm = fields.Many2One('email.template', 'Template Email of Confirmation')
|
||||
|
|
110
locale/es.po
110
locale/es.po
|
@ -47,6 +47,14 @@ msgctxt "error:staff.payroll:"
|
|||
msgid "Error %s !"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "error:staff.payroll:"
|
||||
msgid "Missing template selection in the configuration"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "error:staff.payroll:"
|
||||
msgid "The concept has no type of payment %s"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "error:staff.payroll:"
|
||||
msgid "The period selected without contract for the employee!"
|
||||
msgstr "El empleado no tiene contrato para el período seleccionado!"
|
||||
|
@ -95,10 +103,19 @@ msgctxt "field:staff.configuration,minimum_salary:"
|
|||
msgid "Minimum Salary"
|
||||
msgstr "Salario Mínimo"
|
||||
|
||||
msgctxt "field:staff.configuration,payment_partial_sunday:"
|
||||
msgid "Payment Partial Sunday"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:staff.configuration,staff_liquidation_sequence:"
|
||||
msgid "Liquidation Sequence"
|
||||
msgstr "Sequencia de Liquidación"
|
||||
|
||||
#, fuzzy
|
||||
msgctxt "field:staff.configuration,template_email_confirm:"
|
||||
msgid "Template Email of Confirmation"
|
||||
msgstr "Plantilla Email de Confirmación"
|
||||
|
||||
msgctxt "field:staff.configuration,uvt_value:"
|
||||
msgid "UVT Value"
|
||||
msgstr "Valor UVT"
|
||||
|
@ -123,30 +140,6 @@ msgctxt "field:staff.event_category,wage_type_discount:"
|
|||
msgid "Wage Type Discount"
|
||||
msgstr "Tipo de Pago a Descontar"
|
||||
|
||||
msgctxt "field:staff.fix_payroll.start,employee:"
|
||||
msgid "Employee"
|
||||
msgstr "Empleado"
|
||||
|
||||
msgctxt "field:staff.fix_payroll.start,end_period:"
|
||||
msgid "End Period"
|
||||
msgstr "Período Final"
|
||||
|
||||
msgctxt "field:staff.fix_payroll.start,id:"
|
||||
msgid "ID"
|
||||
msgstr "ID"
|
||||
|
||||
msgctxt "field:staff.fix_payroll.start,project:"
|
||||
msgid "Project"
|
||||
msgstr "Proyectos"
|
||||
|
||||
msgctxt "field:staff.fix_payroll.start,start_period:"
|
||||
msgid "Start Period"
|
||||
msgstr "Período Inicial"
|
||||
|
||||
msgctxt "field:staff.fix_payroll.start,wage_type:"
|
||||
msgid "Wage Type"
|
||||
msgstr "Tipo de Pago"
|
||||
|
||||
msgctxt "field:staff.liquidation,account:"
|
||||
msgid "Account"
|
||||
msgstr "Cuenta"
|
||||
|
@ -519,6 +512,10 @@ msgctxt "field:staff.payroll,risk_amount:"
|
|||
msgid "ARL Amount"
|
||||
msgstr "Valor ARL"
|
||||
|
||||
msgctxt "field:staff.payroll,sended_mail:"
|
||||
msgid "Sended Email"
|
||||
msgstr "Email Enviado"
|
||||
|
||||
msgctxt "field:staff.payroll.export.start,company:"
|
||||
msgid "Company"
|
||||
msgstr "Empresa"
|
||||
|
@ -579,6 +576,10 @@ msgctxt "field:staff.payroll.uvt_withholding,create_uid:"
|
|||
msgid "Create User"
|
||||
msgstr "Creado por Usuario"
|
||||
|
||||
msgctxt "field:staff.payroll.uvt_withholding,end_range:"
|
||||
msgid "End Range"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:staff.payroll.uvt_withholding,id:"
|
||||
msgid "ID"
|
||||
msgstr "ID"
|
||||
|
@ -591,9 +592,9 @@ msgctxt "field:staff.payroll.uvt_withholding,rec_name:"
|
|||
msgid "Record Name"
|
||||
msgstr "Nombre"
|
||||
|
||||
msgctxt "field:staff.payroll.uvt_withholding,uvt_salary:"
|
||||
msgid "UVT Salary"
|
||||
msgstr "Salario en UVT"
|
||||
msgctxt "field:staff.payroll.uvt_withholding,start_range:"
|
||||
msgid "Start Range"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:staff.payroll.uvt_withholding,write_date:"
|
||||
msgid "Write Date"
|
||||
|
@ -683,6 +684,22 @@ msgctxt "field:staff.payroll_payment.start,period:"
|
|||
msgid "Period"
|
||||
msgstr "Período"
|
||||
|
||||
msgctxt "field:staff.payroll_support_dispersion.start,company:"
|
||||
msgid "Company"
|
||||
msgstr "Empresa"
|
||||
|
||||
msgctxt "field:staff.payroll_support_dispersion.start,department:"
|
||||
msgid "Department"
|
||||
msgstr "Departamento"
|
||||
|
||||
msgctxt "field:staff.payroll_support_dispersion.start,id:"
|
||||
msgid "ID"
|
||||
msgstr "ID"
|
||||
|
||||
msgctxt "field:staff.payroll_support_dispersion.start,period:"
|
||||
msgid "Start Period"
|
||||
msgstr "Período "
|
||||
|
||||
msgctxt "field:staff.position,adjust_days_worked:"
|
||||
msgid "Adjust Days Worked"
|
||||
msgstr "Ajuste Días Trabajados"
|
||||
|
@ -851,7 +868,7 @@ msgstr ""
|
|||
|
||||
msgctxt "help:staff.wage_type,adjust_days_worked:"
|
||||
msgid ""
|
||||
"If is true, rounded month work days on payroll to 30 indeedif month has 31 "
|
||||
"If is true, rounded month work days on payroll to 30 indeed if 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"
|
||||
|
@ -942,6 +959,10 @@ 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_dispersion_payroll_support"
|
||||
msgid "Payroll Support Dispersion Wizard"
|
||||
msgstr "Dispersion Soporte de Nomina"
|
||||
|
||||
msgctxt "model:ir.action,name:wizard_exo2276"
|
||||
msgid "Report Exo2276"
|
||||
msgstr "Reporte Exogena2276"
|
||||
|
@ -986,6 +1007,11 @@ msgctxt "model:ir.ui.menu,name:menu_create_liquidation_group"
|
|||
msgid "Create Liquidation Group"
|
||||
msgstr "Crear Liquidación en Grupo"
|
||||
|
||||
#, fuzzy
|
||||
msgctxt "model:ir.ui.menu,name:menu_dispersion_payroll_support"
|
||||
msgid "Payroll Support Dispersion Wizard"
|
||||
msgstr "Dispersion Soporte de Nomina"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_exo2276"
|
||||
msgid "Report Exo2276"
|
||||
msgstr "Reporte Exogena2276"
|
||||
|
@ -1038,10 +1064,6 @@ msgctxt "model:ir.ui.menu,name:open_payroll_by_period"
|
|||
msgid "Open Payroll By Period"
|
||||
msgstr "Nómina por Período"
|
||||
|
||||
msgctxt "model:staff.fix_payroll.start,name:"
|
||||
msgid "Fix Payroll Start"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:staff.liquidation,name:"
|
||||
msgid "Staff Liquidation"
|
||||
msgstr "Liquidación de Personal"
|
||||
|
@ -1102,6 +1124,10 @@ msgctxt "model:staff.payroll_payment.start,name:"
|
|||
msgid "Payroll Payment Start"
|
||||
msgstr "Pago de Nómina"
|
||||
|
||||
msgctxt "model:staff.payroll_support_dispersion.start,name:"
|
||||
msgid "Payroll Support Dispersion"
|
||||
msgstr "Dispersion Soporte de Nomina"
|
||||
|
||||
msgctxt "model:staff_payroll.severance_pay_clearing.done,name:"
|
||||
msgid "Severance Pay Clearing Done"
|
||||
msgstr "Consolidación de Cesantías"
|
||||
|
@ -1292,10 +1318,6 @@ msgctxt "selection:staff_payroll_co.payroll_by_period_dynamic,state:"
|
|||
msgid "Open"
|
||||
msgstr "Abrir"
|
||||
|
||||
msgctxt "view:staff.fix_payroll.start:"
|
||||
msgid "Fix Payroll Wizard"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "view:staff.liquidation.line:"
|
||||
msgid "Adjustments"
|
||||
msgstr "Ajustes"
|
||||
|
@ -1376,14 +1398,6 @@ msgctxt "view:staff_payroll_co.payroll_by_period_dynamic:"
|
|||
msgid "Payroll by Period"
|
||||
msgstr "Nómina por Período"
|
||||
|
||||
msgctxt "wizard_button:staff.fix_payroll,start,end:"
|
||||
msgid "Cancel"
|
||||
msgstr "Cancelar"
|
||||
|
||||
msgctxt "wizard_button:staff.fix_payroll,start,open_:"
|
||||
msgid "Accept"
|
||||
msgstr "Aceptar"
|
||||
|
||||
msgctxt "wizard_button:staff.liquidation_adjustment,start,accept:"
|
||||
msgid "Create"
|
||||
msgstr "Crear"
|
||||
|
@ -1456,6 +1470,14 @@ msgctxt "wizard_button:staff.payroll.sheet,start,print_:"
|
|||
msgid "Print"
|
||||
msgstr "Imprimir"
|
||||
|
||||
msgctxt "wizard_button:staff.payroll.support_dispersion,start,end:"
|
||||
msgid "Cancel"
|
||||
msgstr "Cancelar"
|
||||
|
||||
msgctxt "wizard_button:staff.payroll.support_dispersion,start,open_:"
|
||||
msgid "Send"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "wizard_button:staff.payroll_exo2276,start,end:"
|
||||
msgid "Cancel"
|
||||
msgstr "Cancelar"
|
||||
|
|
73
payroll.py
73
payroll.py
|
@ -7,7 +7,7 @@ import math
|
|||
from trytond.model import ModelView, fields, Workflow
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.report import Report
|
||||
from trytond.wizard import Wizard, StateView, Button, StateAction, StateReport
|
||||
from trytond.wizard import Wizard, StateView, Button, StateAction, StateReport, StateTransition
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.pyson import Eval
|
||||
from trytond.modules.staff_payroll import Period
|
||||
|
@ -23,7 +23,8 @@ __all__ = [
|
|||
'OpenPayrollByPeriod', 'PayrollGroup', 'Exo2276Start', 'Exo2276',
|
||||
'Exo2276Report', 'IncomeWithholdings', 'IncomeWithholdingsStart',
|
||||
'ExportMovesReport', 'IncomeWithholdingsReport', 'PayrollExportStart',
|
||||
'PayrollExport', 'PayrollExportReport'
|
||||
'PayrollExport', 'PayrollExportReport', 'PayrollSupportDispersionStart',
|
||||
'PayrollSupportDispersion'
|
||||
]
|
||||
|
||||
|
||||
|
@ -90,6 +91,7 @@ class Payroll(metaclass=PoolMeta):
|
|||
absenteeism_days = fields.Integer("Absenteeism Days", states=STATES)
|
||||
department = fields.Many2One('company.department', 'Department',
|
||||
required=False, depends=['employee'])
|
||||
sended_mail = fields.Boolean('Sended Email')
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
|
@ -99,7 +101,8 @@ class Payroll(metaclass=PoolMeta):
|
|||
'The period selected without contract for the employee!'
|
||||
),
|
||||
'error_report': ('Error %s !'),
|
||||
'type_concept_not_exists': ('The concept has no type of payment %s '),
|
||||
'type_concept_not_exists': ('The concept has no type of payment %s'),
|
||||
'template_not_exist': ('Missing template selection in the configuration'),
|
||||
})
|
||||
|
||||
@fields.depends('end', 'date_effective')
|
||||
|
@ -532,6 +535,70 @@ class Payroll(metaclass=PoolMeta):
|
|||
Move.draft([payroll.move.id])
|
||||
#Move.delete([payroll.move])
|
||||
|
||||
def send_payroll_email(self):
|
||||
pool = Pool()
|
||||
config = pool.get('staff.configuration')(1)
|
||||
Template = pool.get('email.template')
|
||||
template = config.template_email_confirm
|
||||
if template:
|
||||
response = Template.send(template, self, self.employee.party.email)
|
||||
# Template.send(template, self, self.employee.party.email)
|
||||
if response.status_code == 202:
|
||||
self.write([self], {'sended_mail': True})
|
||||
else:
|
||||
print('Mails no enviados')
|
||||
else:
|
||||
self.raise_error('template_not_exist')
|
||||
|
||||
|
||||
class PayrollSupportDispersionStart(ModelView):
|
||||
'Payroll Support Dispersion'
|
||||
__name__ = 'staff.payroll_support_dispersion.start'
|
||||
company = fields.Many2One('company.company', 'Company', required=True)
|
||||
department = fields.Many2One('company.department', 'Department')
|
||||
period = fields.Many2One('staff.payroll.period', 'Start Period', required=True)
|
||||
|
||||
@staticmethod
|
||||
def default_company():
|
||||
return Transaction().context.get('company')
|
||||
|
||||
|
||||
class PayrollSupportDispersion(Wizard):
|
||||
'Payroll Support Dispersion'
|
||||
__name__ = 'staff.payroll.support_dispersion'
|
||||
start = StateView('staff.payroll_support_dispersion.start',
|
||||
'staff_payroll_co.payroll_support_dispersion_start_view_form', [
|
||||
Button('Cancel', 'end', 'tryton-cancel'),
|
||||
Button('Send', 'open_', 'tryton-ok', default=True),
|
||||
])
|
||||
|
||||
open_ = StateTransition()
|
||||
|
||||
def transition_open_(self):
|
||||
pool = Pool()
|
||||
Payroll = pool.get('staff.payroll')
|
||||
dom = [
|
||||
('company', '=', self.start.company.id),
|
||||
('period', '=', self.start.period.id),
|
||||
('state', 'in', ['processed', 'posted']),
|
||||
('sended_mail', '=', False)
|
||||
]
|
||||
if self.start.department:
|
||||
dom.append(('department', '=', self.start.department.id))
|
||||
payrolls_period = Payroll.search(dom)
|
||||
no_email = []
|
||||
y_email = []
|
||||
for payroll in payrolls_period:
|
||||
email = payroll.employee.party.email
|
||||
if email:
|
||||
payroll.send_payroll_email()
|
||||
y_email.append(payroll.employee.party.full_name,)
|
||||
else:
|
||||
no_email.append(payroll.employee.party.full_name,)
|
||||
print('email enviado a', y_email)
|
||||
print('email no enviado a', no_email)
|
||||
return 'end'
|
||||
|
||||
|
||||
class PayrollGlobalStart(ModelView):
|
||||
'Payroll Global Start'
|
||||
|
|
17
payroll.xml
17
payroll.xml
|
@ -23,6 +23,18 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<menuitem parent="staff.menu_reporting" id="menu_payroll_global"
|
||||
action="wizard_print_payroll_global"/>
|
||||
|
||||
<record model="ir.ui.view" id="payroll_support_dispersion_start_view_form">
|
||||
<field name="model">staff.payroll_support_dispersion.start</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">payroll_support_dispersion_start_form</field>
|
||||
</record>
|
||||
<record model="ir.action.wizard" id="wizard_dispersion_payroll_support">
|
||||
<field name="name">Payroll Support Dispersion Wizard</field>
|
||||
<field name="wiz_name">staff.payroll.support_dispersion</field>
|
||||
</record>
|
||||
<menuitem parent="staff.menu_reporting" id="menu_dispersion_payroll_support"
|
||||
action="wizard_dispersion_payroll_support"/>
|
||||
|
||||
<record model="ir.action.report" id="report_payroll_payment">
|
||||
<field name="name">Payroll Payment Report</field>
|
||||
<field name="model"></field>
|
||||
|
@ -277,5 +289,10 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<menuitem parent="staff.menu_reporting" id="menu_payroll_export_wizard"
|
||||
action="payroll_export_wizard"/>
|
||||
|
||||
<record model="ir.ui.view" id="payroll_view_tree">
|
||||
<field name="model">staff.payroll</field>
|
||||
<field name="inherit" ref="staff_payroll.payroll_view_tree"/>
|
||||
<field name="name">payroll_tree</field>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
||||
|
|
|
@ -9,6 +9,7 @@ depends:
|
|||
staff_co
|
||||
staff_event
|
||||
staff_payroll
|
||||
email
|
||||
xml:
|
||||
configuration.xml
|
||||
uvt.xml
|
||||
|
|
|
@ -15,4 +15,9 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<label name="payment_partial_sunday"/>
|
||||
<field name="payment_partial_sunday"/>
|
||||
</xpath>
|
||||
<xpath
|
||||
expr="/form/field[@name='minimum_salary']" position="after">
|
||||
<label name="template_email_confirm"/>
|
||||
<field name="template_email_confirm"/>
|
||||
</xpath>
|
||||
</data>
|
||||
|
|
|
@ -5,8 +5,12 @@ this repository contains the full copyright notices and license terms. -->
|
|||
|
||||
<xpath expr="/form/notebook/page[@id='information']/field[@name='kind']"
|
||||
position="after">
|
||||
<group colspan="2">
|
||||
<label name="last_payroll"/>
|
||||
<field name="last_payroll"/>
|
||||
<label name="sended_mail"/>
|
||||
<field name="sended_mail"/>
|
||||
</group>
|
||||
<label name="ibc"/>
|
||||
<field name="ibc"/>
|
||||
<label name="absenteeism_days"/>
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<?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="department"/>
|
||||
<field name="department" widget="selection"/>
|
||||
<label name="company"/>
|
||||
<field name="company" widget="selection"/>
|
||||
<label name="period"/>
|
||||
<field name="period"/>
|
||||
</form>
|
|
@ -0,0 +1,10 @@
|
|||
<?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. -->
|
||||
<data>
|
||||
|
||||
<xpath expr="/tree/field[@name='net_payment']" position="after">
|
||||
<field name="sended_mail"/>
|
||||
</xpath>
|
||||
|
||||
</data>
|
Loading…
Reference in New Issue