Odoo version: 11.0 (community)
DB: PostgreSQL 12
Module Type: Custom Addon
What I had
Two related models:
# models/order_line.py class OrderLine(models. Model): _name = 'x.order.line' _description = 'Order Line' order_id = fields. Many2one('res.partner', string='Customer', required=True) product_id = fields. Many2one('product.product', string='Product', required=True) qty = fields. Float(string='Qty', required=True)
class ResPartner(models. Model):
_inherit = 'res.partner'
line_ids = fields. One2many(
'x.order.line',
inverse_name='order_id',
string='Lines'
)
What I did
I removed this feature from the codebase entirely:
- deleted the model x.order.line
- deleted the field res.partner.line_ids
- removed the related XML views that I knew about
I don't need this data anymore. I want it gone without uninstalling the whole module.
The problem
On server start or when opening Contacts, I get:
KeyError: 'line_ids'
So something in metadata still references the old field.
What I already tried
- Remove ORM metadata for the field
self.env['ir.model.fields'].search([('name', '=', 'line_ids')]).unlink()
- Remove references in views
self.env['ir.ui.view'].search([('arch_db', 'ilike', 'line_ids')]).unlink()
- Drop the DB column/table
-
If any stored column existed, I dropped it with SQL.
(For One2many there is no column on the parent; I dropped the now-orphaned x_order_line table.)
Still getting KeyError: line_ids.
What I'm asking
What is the correct, complete cleanup path to eliminate this error without uninstalling the module, ensuring no leftover data or references to the removed field/model remain?
I'm fine with deleting all related data.