一键导入
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 页面并帮你完成安装。
| 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).基于 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.