A developer often needs to change an existing Odoo view, not build a new one. View inheritance is how that is done cleanly. This piece is about view inheritance and xpath in Odoo.
The need to change an existing view
Much Odoo development is not building entirely new things but changing existing ones, and that includes views. A developer often needs an existing view, a form view, a list view that Odoo, or another module, already provides, to be changed: a field added to it, something adjusted, something arranged differently. The question is how to make that change, and the answer is the central principle of clean Odoo development: extend, do not replace.
What view inheritance is
View inheritance is the Odoo mechanism for changing an existing view by extending it rather than rewriting it. Instead of taking the existing view and replacing it with a wholly rewritten version, the developer creates an inheriting view that expresses just the changes, the additions, the adjustments, to the existing view. The existing view stays as it is; the inheriting view applies the developer's changes on top of it. View inheritance is, in essence, the way to say "the existing view, but with these changes".
Xpath: pointing at where to change
For an inheriting view to apply a change to the existing view, it has to express where in the existing view the change goes, add this field here, adjust that element there. Xpath is how that "where" is expressed: it is the means by which an inheriting view points at the particular place in the existing view that a change applies to. So view inheritance uses xpath: the inheriting view uses xpath to point at the genuine place in the existing view, and applies its change there. Xpath is the pointing; the inheriting view is the change.
Why extending beats rewriting
View inheritance, extending rather than rewriting, matters for the same reason extending matters throughout Odoo development. An inheriting view that expresses just the genuine changes is clean: the existing view, perhaps Odoo's own, stays intact, and the developer's changes are a clear, separate layer on top. This is maintainable, and, importantly, it is far easier to carry through upgrades: when Odoo's existing view changes in a new version, an inheriting view that just expressed the genuine changes adapts far more easily than a wholly rewritten view would. Rewriting an existing view, by contrast, replaces Odoo's view with the developer's whole version, which is fragile and a burden at upgrade time. Extending through view inheritance is the clean way; rewriting is not.
The takeaway
View inheritance and xpath in Odoo are how a developer changes an existing view cleanly: by extending it rather than rewriting it. An inheriting view expresses just the genuine changes, the additions and adjustments, to an existing view, which stays intact, and xpath is how the inheriting view points at the place in the existing view a change applies to. Extending through view inheritance is clean and maintainable and carries through upgrades far better than rewriting the view would. It is the central principle of clean Odoo development, applied to views. For how we approach Odoo, see our ERP practice.