Add fields Withholding Tax Deductible and Provision Cancellation

This commit is contained in:
wilson gomez sanchez 2021-02-02 09:02:24 -05:00
parent 22a639b64d
commit 8123a5dc9f
6 changed files with 149 additions and 0 deletions

View File

@ -58,6 +58,7 @@ class Employee(metaclass=PoolMeta):
'get_party_concept')
party_bank = fields.Function(fields.Many2One('party.party', 'Party Bank'),
'get_party_bank')
withholding_tax_deductible = fields.Numeric('Withholding Tax Deductible', digits=(16, 2))
@classmethod
def __setup__(cls):

View File

@ -17,5 +17,11 @@ this repository contains the full copyright notices and license terms. -->
<menuitem parent="staff.menu_configuration" id="menu_assitant_update_employee"
action="wizard_assistant_update_employee" incon='tryton-clock'/>
<record model="ir.ui.view" id="employee_view_form">
<field name="model">company.employee</field>
<field name="inherit" ref="company.employee_view_form"/>
<field name="name">employee_form</field>
</record>
</data>
</tryton>

View File

@ -47,6 +47,10 @@ msgctxt "error:staff.payroll:"
msgid "Error %s !"
msgstr ""
msgctxt "error:staff.payroll:"
msgid "Missing account debit for provision"
msgstr ""
msgctxt "error:staff.payroll:"
msgid "Missing template selection in the configuration"
msgstr ""
@ -91,6 +95,10 @@ msgctxt "field:company.employee,party_risk:"
msgid "Party Risk"
msgstr "ARL"
msgctxt "field:company.employee,withholding_tax_deductible:"
msgid "Withholding Tax Deductible"
msgstr "Base de Retención Fiscal Deducible"
msgctxt "field:staff.configuration,extras_limit:"
msgid "Extras Limit"
msgstr "Límite de Horas Extras"
@ -120,6 +128,20 @@ msgctxt "field:staff.configuration,uvt_value:"
msgid "UVT Value"
msgstr "Valor UVT"
#, fuzzy
msgctxt "field:staff.employee.update_employee.start,company:"
msgid "Company"
msgstr "Empresa"
msgctxt "field:staff.employee.update_employee.start,file:"
msgid "CSV file"
msgstr ""
#, fuzzy
msgctxt "field:staff.employee.update_employee.start,id:"
msgid "ID"
msgstr "UP"
msgctxt "field:staff.event_category,discount_method:"
msgid "Discount Method"
msgstr "Método de Descuento"
@ -504,6 +526,10 @@ msgctxt "field:staff.payroll,last_payroll:"
msgid "Last Payroll"
msgstr "Última Nómina"
msgctxt "field:staff.payroll,move_line_provision:"
msgid "Lines Provision"
msgstr ""
msgctxt "field:staff.payroll,retirement_amount:"
msgid "AFP Amount"
msgstr "Valor AFP"
@ -728,6 +754,10 @@ msgctxt "field:staff.wage_type,party_required:"
msgid "Party Required"
msgstr "Tercero obligatorio"
msgctxt "field:staff.wage_type,provision_cancellation:"
msgid "Cancellation of Provision"
msgstr "Cancelación de Provision"
msgctxt "field:staff.wage_type,round_amounts:"
msgid "Rounds amounts"
msgstr "Redondear Monto"
@ -845,6 +875,10 @@ msgctxt "help:staff.configuration,extras_limit:"
msgid "In hours"
msgstr "En horas"
msgctxt "help:staff.employee.update_employee.start,file:"
msgid "Load file csv separated comma in utf-8 format"
msgstr ""
msgctxt "help:staff.liquidation,number:"
msgid "Secuence"
msgstr "Secuencia"
@ -955,6 +989,10 @@ msgctxt "model:ir.action,name:report_staff_liquidation"
msgid "Liquidation"
msgstr "Liquidación"
msgctxt "model:ir.action,name:wizard_assistant_update_employee"
msgid "Asssitant Update Employee Wizard"
msgstr ""
msgctxt "model:ir.action,name:wizard_create_liquidation_group"
msgid "Create Liquidation Group"
msgstr "Crear Liquidación en Grupo"
@ -999,10 +1037,37 @@ msgctxt "model:ir.action,name:wizard_severance_pay_clearing"
msgid "Severance Pay Clearing"
msgstr "Consolidación de Cesantías"
#, fuzzy
msgctxt ""
"model:ir.action.act_window.domain,name:act_liquidation_form_domain_all"
msgid "All"
msgstr "Todos"
#, fuzzy
msgctxt ""
"model:ir.action.act_window.domain,name:act_liquidation_form_domain_confirmed"
msgid "Confirmed"
msgstr "Confirmado"
#, fuzzy
msgctxt ""
"model:ir.action.act_window.domain,name:act_liquidation_form_domain_draft"
msgid "Draft"
msgstr "Borrador"
#, fuzzy
msgctxt "model:ir.model.button,string:staff_liquidation_post_button"
msgid "Post"
msgstr "Contabilizar"
msgctxt "model:ir.ui.menu,name:"
msgid "Payroll Liquidation Wizard"
msgstr "Liquidación de Contrato"
msgctxt "model:ir.ui.menu,name:menu_assitant_update_employee"
msgid "Asssitant Update Employee Wizard"
msgstr ""
msgctxt "model:ir.ui.menu,name:menu_create_liquidation_group"
msgid "Create Liquidation Group"
msgstr "Crear Liquidación en Grupo"
@ -1064,6 +1129,10 @@ msgctxt "model:ir.ui.menu,name:open_payroll_by_period"
msgid "Open Payroll By Period"
msgstr "Nómina por Período"
msgctxt "model:staff.employee.update_employee.start,name:"
msgid "Update Employee Start"
msgstr ""
msgctxt "model:staff.liquidation,name:"
msgid "Staff Liquidation"
msgstr "Liquidación de Personal"
@ -1398,6 +1467,16 @@ msgctxt "view:staff_payroll_co.payroll_by_period_dynamic:"
msgid "Payroll by Period"
msgstr "Nómina por Período"
#, fuzzy
msgctxt "wizard_button:staff.employee.update_employee,start,end:"
msgid "Cancel"
msgstr "Cancelar"
#, fuzzy
msgctxt "wizard_button:staff.employee.update_employee,start,open_:"
msgid "Update"
msgstr "Actualizar"
msgctxt "wizard_button:staff.liquidation_adjustment,start,accept:"
msgid "Create"
msgstr "Crear"

View File

@ -97,6 +97,11 @@ class Payroll(metaclass=PoolMeta):
department = fields.Many2One('company.department', 'Department',
required=False, depends=['employee'])
sended_mail = fields.Boolean('Sended Email')
# move_line_provision = fields.Function(fields.Many2Many('account.move.lines',
# None, None, 'Lines Provision',
# domain=[
# ('employee', '=', Eval('employee')),
# ],), 'get_lines_provision')
@classmethod
def __setup__(cls):
@ -108,6 +113,7 @@ class Payroll(metaclass=PoolMeta):
'error_report': ('Error %s !'),
'type_concept_not_exists': ('The concept has no type of payment %s'),
'template_not_exist': ('Missing template selection in the configuration'),
'provision_missing_account': ('Missing account debit for provision'),
})
@fields.depends('end', 'date_effective')
@ -178,6 +184,20 @@ class Payroll(metaclass=PoolMeta):
if not self.description and self.period:
self.description = self.period.description
# def get_lines_provision(self, name):
# if not self.party:
# return
# Move_line = Pool().get('account.move.line')
# wage_types = []
# wage_types = [line.wage_type.id for line in self.lines if line.wage_type.provision_cancellation]
# lines = Move_line.search([
# ('account', 'in', wage_types),
# ('reconciliation', '=', None),
# ('party', '=', self.employee.party.id)
# ])
# lines_ids = [line.id for line in lines]
# return lines_ids
def adjust_partial_sunday(self, quantity):
# Factor = 8 hour sunday / 6 days (monday-saturday)
factor = 1.33
@ -315,6 +335,32 @@ class Payroll(metaclass=PoolMeta):
])
return payrolls
def _create_payroll_lines(self, wages, extras, discounts=None):
pool = Pool()
MoveLine = pool.get('account.move.line')
_wages = []
for wage, party, fix_amount in wages:
print(wage.provision_cancellation)
if wage.provision_cancellation:
qty = 1
salary_args = self.get_salary_full(wage)
unit_value = wage.provision_cancellation.compute_unit_price(salary_args)
line = self.get_line(wage, qty, unit_value, party)
amount_line = line['unit_value'] * self.worked_days
if not wage.provision_cancellation.credit_account:
return self.raise_user_error('provision_missing_account', wage.provision_cancellation.name)
lines = MoveLine.search([
('account', '=', wage.provision_cancellation.credit_account.id),
('reconciliation', '=', None),
('party', '=', self.employee.party.id)
])
amount = sum(abs(line.debit - line.credit) for line in lines)
print('line', line)
fix_amount = amount_line + amount
_wages.append([wage, party, fix_amount])
super(Payroll, self)._create_payroll_lines(_wages, extras, discounts=None)
def search_salary_month(self, wage):
res = _ZERO
payrolls = self._get_payrolls_month()
@ -331,6 +377,7 @@ class Payroll(metaclass=PoolMeta):
unit_value = math.floor(float(unit_value) / 100.0) * 100
elif wage.round_amounts == 'automatic':
unit_value = round(unit_value, -2)
res = super(Payroll, self).get_line(wage, qty, unit_value, party)
return res
@ -1364,6 +1411,11 @@ class PayrollGroupStart(metaclass=PoolMeta):
class PayrollGroup(metaclass=PoolMeta):
__name__ = 'staff.payroll_group'
# def transition_open_(self):
# print(self.start.wage_types)
# dom = super(PayrollGroup, self).transition_open_()
# return dom
def get_employees_dom(self, employees_w_payroll):
dom = super(PayrollGroup, self).get_employees_dom(employees_w_payroll)
if self.start.department:

10
view/employee_form.xml Normal file
View File

@ -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="/form/notebook/page[@id='info']/field[@name='contracting_state']" position="after">
<label name="withholding_tax_deductible"/>
<field name="withholding_tax_deductible"/>
</xpath>
</data>

View File

@ -26,6 +26,7 @@ class WageType(metaclass=PoolMeta):
'pay has 16 days')
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')
@classmethod
def __setup__(cls):