一键导入
odoo-actions-and-buttons
Define buttons in views and link them to Python methods or Window Actions.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Define buttons in views and link them to Python methods or Window Actions.
用 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 Actions and Buttons |
| description | Define buttons in views and link them to Python methods or Window Actions. |
Add interactivity to the UI using buttons that trigger Python code or other actions.
Buttons are usually placed in the <header> of a form view or inside the <sheet>/<list>.
Example (Header Button):
<form>
<header>
<button name="action_sold" type="object" string="Sold" class="oe_highlight"/>
<button name="action_cancel" type="object" string="Cancel"/>
</header>
<sheet>
<!-- Fields -->
</sheet>
</form>
string: Label of the button.class="oe_highlight": Highlights the button (primary color).Triggers a Python method on the model.
type="object", name="method_name"Example:
def action_sold(self):
for record in self:
if record.state == 'canceled':
raise UserError("Canceled properties cannot be sold.")
record.state = 'sold'
return True
odoo.exceptions.UserError to stop execution and warn the user.True (or an action dictionary) for public methods.Triggers a specific Window Action (e.g., open a wizard, report, or another view).
type="action", name="%(module_name.action_xml_id)d"Example:
<button type="action" name="%(estate.action_estate_offer)d" string="Offers"/>
You can add buttons to list views (or inside form sheets).
icon="fa-check" (FontAwesome) instead of string for compact buttons.Example:
<list>
<field name="name"/>
<button name="action_confirm" type="object" icon="fa-check" title="Confirm"/>
<button name="action_cancel" type="object" icon="fa-times" title="Cancel"/>
</list>