con un clic
odoo-inheritance
Extend existing models and views using Python and XML inheritance.
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Menú
Extend existing models and views using Python and XML inheritance.
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Basado en la clasificación ocupacional SOC
A router skill that identifies and recommends the most appropriate Odoo skill for a given user request.
Create HTTP endpoints for Websites and APIs.
Comprehensive guide to Odoo fields, including basic, relational, computed, and robust technical features (indexing, company_dependent, properties).
Master the Odoo ORM for data manipulation, environment management, and CRUD operations.
Configure Access Control Lists (ACLs) using CSV files.
Write automated tests using TransactionCase and Form emulators to ensure code quality.
| name | Odoo Inheritance |
| description | Extend existing models and views using Python and XML inheritance. |
Modify behavior and appearance of existing Odoo applications without touching their source code.
Add fields or methods to an existing model (e.g., res.partner, res.users).
_inherit = 'existing.model.name'_name (unless you want to create a copy/prototype inheritance).Example:
class ResUsers(models.Model):
_inherit = "res.users"
property_ids = fields.One2many("estate.property", "salesperson_id", string="Properties")
super() to maintain existing logic.
create(vals): Modify vals before calling super.write(vals): Modify vals or trigger logic after super.unlink(): typically define @api.ondelete instead.Modify an existing XML view (Actions or Views).
ir.ui.viewinherit_id: Reference to the parent view's XML ID.arch: Use xpath expressions to locate and modify elements.Example:
<record id="view_users_form_inherit_estate" model="ir.ui.view">
<field name="name">res.users.form.inherit.estate</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form"/>
<field name="arch" type="xml">
<!-- Find the notebook and add a page inside it -->
<xpath expr="//notebook" position="inside">
<page string="Real Estate Properties">
<field name="property_ids"/>
</page>
</xpath>
<!-- Or find a specific field and add something after it -->
<!-- <xpath expr="//field[@name='email']" position="after"> ... </xpath> -->
</field>
</record>
expr="//field[@name='description']": Find field by name.expr="//group": Find the first group.expr="//page[@string='Description']": Find page by label.inside: Append to the end of the element's children.after: Add as a sibling after the element.before: Add as a sibling before the element.replace: Replace the element (Use with caution!).attributes: Modify attributes (e.g., make a field invisible).
<xpath expr="//field[@name='phone']" position="attributes">
<attribute name="required">1</attribute>
<attribute name="invisible">1</attribute>
</xpath>