How to insert into 2 tables which are dependant on each other
with correction after comment from author:

example of procedure

CREATE DEFINER=`root`@`%` PROCEDURE `udp_insert_company`(`v_id` double, `v_document_type_id` double)
BEGIN
declare v_error_text varchar(200);
set v_error_text = '';

IF NOT EXISTS (SELECT id FROM document_type where id = v_document_type_id) THEN
        SELECT CONCAT('ERROR - id ', CAST(v_id AS CHAR), ' not found') into v_error_text;
    SELECT v_error_text;
ELSE
    INSERT INTO company VALUES (v_id, v_document_type_id);  
END IF; 

END


it just example, You can use any other method for return error code

@call `test_db`.`udp_insert_company`(4, 3);

ERROR - id 4 not found