有没有办法在模板odoo中更改t-set设置的变量的值



我需要通过继承模板来更改模板中由 t-set 设置的变量的值,更改变量的值并根据该变量的条件添加一些字段,但找不到如何在不覆盖整个模板代码的情况下做到这一点

我想在下面的模板中更改zip_city的示例:

 <template id="address" name="Address Management">
    <t t-call="website.layout">
       ........... 
       <t t-set='zip_city' t-value='country and [x for x in country.get_address_fields() if x in ["zip", "city"]] or ["city", "zip"]'/>
       <t t-if="'zip' in zip_city and zip_city.index('zip') &lt; zip_city.index('city')">
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template">
    <t t-name="name of your template" t-extend="name of parent template">
        <t t-jquery="field name" t-operation="replace">
            // customization
        </t>
    </t>
</templates>

试试这种方式..

最新更新