(
        self, name, code_type, ref, id_pref, parent=None, note=None,
    )
return category
It updates or creates a new Pathology Category for arguments.

        Args:
            name (str): Name of pathology category to create.
            code_type (MedicalPathologyCodeType): Singleton representing
                the code type of the pathology (ICD-10-CM).
            ref (str): External ID reference.
            id_pref (str): External ID prefix for category
            parent (MedicalPathologyCategory): Parent category.
            note (str): Category notes.
        Returns:
            MedicalPathologyCategory: Newly created Pathology Category.
It updates or creates a new Pathology Category for arguments.
It updates or creates a new Pathology Category for arguments .
def _upsert_pathology_category(
        self, name, code_type, ref, id_pref, parent=None, note=None,
    ):
        """ It updates or creates a new Pathology Category for arguments.

        Args:
            name (str): Name of pathology category to create.
            code_type (MedicalPathologyCodeType): Singleton representing
                the code type of the pathology (ICD-10-CM).
            ref (str): External ID reference.
            id_pref (str): External ID prefix for category
            parent (MedicalPathologyCategory): Parent category.
            note (str): Category notes.
        Returns:
            MedicalPathologyCategory: Newly created Pathology Category.
        """
        vals = {
            'name': name,
            'code_type_id': code_type.id,
            'parent_id': parent.id if parent else None,
            'notes': note,
        }
        xml_id = self._get_pathology_category_xml_id(ref)
        try:
            category = self.env['ir.model.data'].get_object(id_pref, xml_id)
            category.update(vals)
            return category
        except ValueError:
            category = self.env['medical.pathology.category'].create(vals)
            self.__create_ir_model_data(xml_id, id_pref, category)
        return category
def _upsert_pathology_category ( self , name , code_type , ref , id_pref , parent = None , note = None , ) : vals = { 'name' : name , 'code_type_id' : code_type . id , 'parent_id' : parent . id if parent else None , 'notes' : note , } xml_id = self . _get_pathology_category_xml_id ( ref ) try : category = self . env [ 'ir.model.data' ] . get_object ( id_pref , xml_id ) category . update ( vals ) return category except ValueError : category = self . env [ 'medical.pathology.category' ] . create ( vals ) self . __create_ir_model_data ( xml_id , id_pref , category ) return category