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

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

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