ワンクリックで
odoo-model-relations
Define Many2one, One2many, and Many2many fields to relate models.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Define Many2one, One2many, and Many2many fields to relate models.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
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 Model Relations |
| description | Define Many2one, One2many, and Many2many fields to relate models. |
Link the estate.property model to other models like Property Type, Buyer, Seller, Offers, and Tags.
fields.Many2one)Links a record to a single record in another model (Parent/Foreign Key).
field_id (integer) to the table._id (e.g., partner_id).Example:
# In estate.property model
property_type_id = fields.Many2one("estate.property.type", string="Property Type")
buyer_id = fields.Many2one("res.partner", string="Buyer")
seller_id = fields.Many2one("res.partner", string="Seller", default=lambda self: self.env.user)
fields.Many2many)Bidirectional multiple relationship. A record can be related to multiple records in another model.
estate_property_tag_rel)._ids (e.g., tag_ids).Example:
# In estate.property model
tag_ids = fields.Many2many("estate.property.tag", string="Tags")
widget="many2many_tags" in the view to display as chips.fields.One2many)The inverse of a Many2one. Displays a list of records from the related model that point to the current record.
Many2one field pointing back to this model._ids (e.g., offer_ids).Example:
# In estate.property model
offer_ids = fields.One2many("estate.property.offer", "property_id", string="Offers")
# In estate.property.offer model (The Co-model)
property_id = fields.Many2one("estate.property", required=True)
self.env Environmentself.env: Access to the environment.self.env.user: Current logged-in user record.self.env.ref('xml_id'): Get a record by its XML ID.self.env['model.name']: Access a model registry to search/create records.<notebook> and <page> in Form views to organize relational fields (like lists of offers).