You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过扩展修改Odoo字段属性:取消网站报价订单描述字段可翻译性

How to Disable Translation for Sale Order's website_description Field in Odoo

No need to modify the original website_quote module code—you can easily fix this by creating a small custom module that inherits and overrides the field. Here's a step-by-step guide:

Step 1: Create a Custom Module

First, set up a new module (let's name it website_quote_disable_translate). Your module structure should look like this:

website_quote_disable_translate/
├── __init__.py
├── __manifest__.py
└── models/
    ├── __init__.py
    └── sale_order.py

Step 2: Override the Field in the Model

In models/sale_order.py, inherit the sale.order model and redefine the website_description field with translate=False (keeping all other original field attributes intact):

from odoo import models, fields

class SaleOrder(models.Model):
    _inherit = 'sale.order'

    website_description = fields.Html(
        'Description',
        sanitize_attributes=False,  # Preserve original sanitization behavior
        translate=False             # Disable translation to eliminate the prompt
    )

Step 3: Configure the Module Manifest

Update __manifest__.py to declare dependencies and basic module details:

{
    'name': 'Disable Website Quote Description Translation',
    'version': '1.0',
    'category': 'Website',
    'depends': ['website_quote'],  # Ensure our module loads after the original
    'data': [],
    'installable': True,
    'auto_install': False,
}

Step 4: Install the Module

  • Place your module folder in Odoo's addons directory (or zip it for upload).
  • Go to Odoo's Apps menu, click "Update Apps List".
  • Search for your module name and install it.

Once installed, the website_description field will no longer trigger the "Update translations" prompt when saving sale orders, as we've explicitly disabled translation for this field.


内容的提问来源于stack exchange,提问作者Developer Marius Žilėnas

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 09:33:30