hunk.code_window:             return
           employee = self.employee_id
           date_from = self.date_from
           date_to = self.date_to
           self.company_id = employee.company_id
           if not self.contract_id: # Add a default contract if not already defined
               contracts = employee._get_contracts(date_from, date_to)
  
hunk.labels: keep keep keep keep keep replace keep keep keep keep keep
hunk.file_path: addons/hr_payroll/models/hr_payslip.py
hunk.type: replace
file: <?xml version="1.0" encoding="utf-8"?>
  <odoo>
  <data noupdate="1">
  
      <record id="group_hr_payroll_user" model="res.groups">
          <field name="name">Officer</field>
          <field name="category_id" ref="base.module_category_hr_payroll"/>
          <field name="implied_ids" eval="[(4, ref('hr.group_hr_user')), (4, ref('hr_contract.group_hr_contract_manager'))]"/>
      </record>
  
      <record id="group_hr_payroll_manager" model="res.groups">
          <field name="name">Manager</field>
          <field name="category_id" ref="base.module_category_hr_payroll"/>
          <field name="implied_ids" eval="[(4, ref('hr_payroll.group_hr_payroll_user'))]"/>
          <field name="users" eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"/>
      </record>
  
      <record id="base.default_user" model="res.users">
          <field name="groups_id" eval="[(4,ref('hr_payroll.group_hr_payroll_manager'))]"/>
      </record>
  
      <record id="hr_payroll_rule_officer" model="ir.rule">
          <field name="name">Officer and subordinates Payslip</field>
          <field name="model_id" ref="model_hr_payslip"/>
          <field name="domain_force">['|','|', ('employee_id.user_id', '=', user.id), ('employee_id.department_id', '=', False), ('employee_id.department_id.manager_id.user_id', '=', user.id)]</field>
          <field name="groups" eval="[(4, ref('hr_payroll.group_hr_payroll_user'))]"/>
      </record>
  
      <record id="hr_payslip_rule_manager" model="ir.rule">
          <field name="name">All Payslip</field>
          <field name="model_id" ref="model_hr_payslip"/>
          <field name="domain_force">[(1,'=',1)]</field>
          <field name="groups" eval="[(4, ref('hr_payroll.group_hr_payroll_manager'))]"/>
      </record>
  
      <record id="hr_benefit_validated" model="ir.rule">
          <field name="name">hr.benefit: only non validated benefits updated</field>
          <field name="model_id" ref="model_hr_benefit"/>
          <field name="domain_force">[('state', '!=', 'validated')]</field>
          <field name="groups" eval="[(4, ref('hr_payroll.group_hr_payroll_manager'))]"/>
          <field name="perm_create" eval="0"/>
          <field name="perm_write" eval="1"/>
          <field name="perm_unlink" eval="0"/>
          <field name="perm_read" eval="0"/>
      </record>
  
      <record id="hr_user_benefit_employee" model="ir.rule">
          <field name="name">Benefits/Employee calendar filter: only self</field>
          <field name="model_id" ref="model_hr_user_benefit_employee"/>
          <field name="domain_force">[('user_id', '=', user.id)]</field>
          <field name="groups" eval="[(4, ref('base.group_user'))]"/>
          <field name="perm_create" eval="1"/>
          <field name="perm_write" eval="1"/>
          <field name="perm_unlink" eval="1"/>
          <field name="perm_read" eval="0"/>
      </record>
  
      <record id="ir_rule_hr_payroll_structure_multi_company" model="ir.rule">
          <field name="name">HR Payroll Structure: Multi Company</field>
          <field name="model_id" ref="model_hr_payroll_structure"/>
          <field name="global" eval="True"/>
          <field name="domain_force">['|', ('country_id', '=', False), ('country_id', '=', user.company_id.country_id.id)]</field>
      </record>
  
      <record id="ir_rule_hr_payslip_multi_company" model="ir.rule">
          <field name="name">HR Payslip: Multi Company</field>
          <field name="model_id" ref="model_hr_payslip"/>
          <field name="global" eval="True"/>
          <field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field>
      </record>
  
  </data>
  </odoo>
  