For example, I have created model called delivery.department previously using a custom module, however, in the process of software development, this model named is changed while the module is kept upgraded, the model eventually still left in database as no explicit removal ever.
The best way for programmer I think is directly delete it from database.
— First, delete the records that reference this model
DELETE FROM ir_model_data WHERE model = ‘delivery.department’;
— If there are actual data records in the delivery_department table
DELETE FROM delivery_department;
— Then drop the table if it exists
DROP TABLE IF EXISTS delivery_department CASCADE;
— Remove the model definition
DELETE FROM ir_model WHERE model = ‘delivery.department’;