delete hr.payroll.structure.type previous records

pull/2/head
Florian Roger 8 months ago
parent b5bf565e2b
commit 9879f53881

@ -18,7 +18,6 @@
"data/gn_payroll_time.xml",
"data/gn_payroll_universal.xml",
"data/gn_payroll_structure.xml",
"data/init_flag.xml",
"views/gn_payroll_company.xml",
"security/ir.model.access.csv"
],

@ -1,5 +1,27 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<delete model="hr.payroll.structure.type" id="hr_contract.structure_type_employee"/>
<delete model="hr.payroll.structure.type" id="hr_contract.structure_type_worker"/>
<record id="gn_payroll_structure_type_employe" model="hr.payroll.structure.type">
<field name="name">Employé(e)</field>
<field name="country_id" eval="False"/>
</record>
<record id="gn_payroll_structure_type_cadre" model="hr.payroll.structure.type">
<field name="name">Cadre</field>
<field name="country_id" eval="False"/>
</record>
<record id="gn_payroll_structure_type_service_civique" model="hr.payroll.structure.type">
<field name="name">Volontaire en Service civique</field>
<field name="country_id" eval="False"/>
</record>
<record id="gn_payroll_structure_type_intern" model="hr.payroll.structure.type">
<field name="name">Stagiaire</field>
<field name="country_id" eval="False"/>
</record>
<record id="payroll_structure_type_benevolent" model="hr.payroll.structure.type">
<field name="name">Administrateur bénévole</field>
<field name="country_id" eval="False"/>
</record>
<record id="gn_payroll_contract_cae" model="hr.contract.type">
<field name="name">PEC - CAE</field>
</record>

@ -30,6 +30,8 @@ if contract.struct_id.code == "VOLSERVCIV":
else:
dic_days = {0: 0, 1:0, 2: 0, 3: 0, 4:0}
for x in contract.resource_calendar_id.attendance_ids:
if ((not x.date_from) or ( payslip.date_from >= x.date_from )) and \
((not x.date_to) or ( x.date_to >= payslip.date_to )):
dic_days[int(x.dayofweek)] += (x.hour_to - x.hour_from)
# Calculating missed hours when payslip doesn't start / end at the beginning/ end of the month

@ -1,6 +0,0 @@
<odoo>
<function model="ir.config_parameter" name="set_param">
<value eval="'gn_payroll.first_installation'" />
<value eval="'True'" />
</function>
</odoo>

@ -4,4 +4,3 @@
from . import gn_payroll_cc
from . import gn_payroll_company
from . import gn_payroll_employee
#from . import gn_payroll_contract_structure_type

@ -1,14 +0,0 @@
from odoo import models, api
class HrPayrollStructureType(models.Model):
_name = 'hr.payroll.structure.type'
@api.model
def init(self):
super(HrPayrollStructureType, self).init()
first_install = self.env['ir.config_parameter'].sudo().get_param('gn_payroll.first_installation')
if first_install:
# Delete pre-existing records
self.env['hr.payroll.structure.type'].search([]).unlink()
# Reset the flag
self.env['ir.config_parameter'].sudo().set_param('gn_payroll.first_installation', 'False')
Loading…
Cancel
Save