
from odoo import api, fields, models


class HrEmployee(models.Model):
    _inherit = "hr.employee"

    @api.model
    def _get_subcontractor_type(self):
        return [
            ("trainee", "Trainee"),
            ("internal", "Internal"),
            ("external", "External"),
        ]

    subcontractor_company_id = fields.Many2one(
        "res.company", string="Subcontractor Company"
    )
    subcontractor_type = fields.Selection(
        string="Subcontractor Type", selection="_get_subcontractor_type", required=True
    )
    commission_rate = fields.Float(
        help="Rate in % for the commission on subcontractor work", default=10.00
    )


from odoo import api, fields, models


class HrEmployee(models.Model):
    _inherit = "hr.employee"

    @api.model
    def _get_subcontractor_type(self):
        return [
            ("trainee", "Trainee"),
            ("internal", "Internal"),
            ("external", "External"),
        ]

    subcontractor_company_id = fields.Many2one(
        "res.company", string="Subcontractor Company"
    )
    subcontractor_type = fields.Selection(
        string="Subcontractor Type",
        selection="_get_subcontractor_type",
        required=True,
        default="internal",
    )
    commission_rate = fields.Float(
        help="Rate in % for the commission on subcontractor work", default=10.00
    )

FIX set default subcontractor type on employee
FIX set default subcontractor type on employee

  
  from odoo import api, fields, models
  
  
  class HrEmployee(models.Model):
      _inherit = "hr.employee"
  
      @api.model
      def _get_subcontractor_type(self):
          return [
              ("trainee", "Trainee"),
              ("internal", "Internal"),
              ("external", "External"),
          ]
  
      subcontractor_company_id = fields.Many2one(
          "res.company", string="Subcontractor Company"
      )
      subcontractor_type = fields.Selection(
-         string="Subcontractor Type", selection="_get_subcontractor_type", required=True
+         string="Subcontractor Type",
+         selection="_get_subcontractor_type",
+         required=True,
+         default="internal",
      )
      commission_rate = fields.Float(
          help="Rate in % for the commission on subcontractor work", default=10.00
      )
  
FIX set default subcontractor type on employee
## Code Before:

from odoo import api, fields, models


class HrEmployee(models.Model):
    _inherit = "hr.employee"

    @api.model
    def _get_subcontractor_type(self):
        return [
            ("trainee", "Trainee"),
            ("internal", "Internal"),
            ("external", "External"),
        ]

    subcontractor_company_id = fields.Many2one(
        "res.company", string="Subcontractor Company"
    )
    subcontractor_type = fields.Selection(
        string="Subcontractor Type", selection="_get_subcontractor_type", required=True
    )
    commission_rate = fields.Float(
        help="Rate in % for the commission on subcontractor work", default=10.00
    )

## Instruction:
FIX set default subcontractor type on employee
## Code After:

from odoo import api, fields, models


class HrEmployee(models.Model):
    _inherit = "hr.employee"

    @api.model
    def _get_subcontractor_type(self):
        return [
            ("trainee", "Trainee"),
            ("internal", "Internal"),
            ("external", "External"),
        ]

    subcontractor_company_id = fields.Many2one(
        "res.company", string="Subcontractor Company"
    )
    subcontractor_type = fields.Selection(
        string="Subcontractor Type",
        selection="_get_subcontractor_type",
        required=True,
        default="internal",
    )
    commission_rate = fields.Float(
        help="Rate in % for the commission on subcontractor work", default=10.00
    )
