更新网站odoo中的值

时间:2018-07-13 10:32:30

标签: javascript python xml controller odoo

我想在更改另一个值后更新一个值 例如,如果有可用的数量,除了在odoo篮之外,它还向我显示一个类似于图像的值 enter image description here

如果我增加数量,希望将其更改为不可用  像这样 enter image description here

这是我的代码源

<template id="assets_frontend" inherit_id="website.assets_frontend" name="Shop">
    <xpath expr="." position="inside">
        <script type="text/javascript" src="/website_sale_available/static/src/js/website_sale_available.js"></script>
        <link rel='stylesheet' href='/website_sale_available/static/src/css/website_sale_available.css'/>
    </xpath>
</template>

<!-- priority 99 for compatibility with sale options, first load sale options view and then this one -->
<template id="cart" inherit_id="website_sale.cart_lines" priority="99">
    <xpath expr="//table[@id='cart_products']//thead/tr" position="inside">
        <th  width="40">Disponibilité</th>
        <th  width="10"></th>
    </xpath>

    <xpath expr="//t[@t-as='line']/tr" position="inside">
        <td width="50" style="color: #0000ff00; font-size: 10px;" class="text-right">

            <t t-if="line.product_id.virtual_available &gt; 0">
              <div class="badge btn stock_label" style="background-color:green;opacity: 0.6;filter: alpha(opacity=60);">
                <span>Disponible</span>
              </div>
            </t>
            <t t-if="line.product_id.virtual_available &lt;= 0" style="background-color:red;">
              <div class="badge btn stock_label" style="background-color:red;opacity: 0.6;filter: alpha(opacity=60);">Epuisé</div>
            </t>
        </td>

        <td  width="10" style="color: #0000ff00; font-size: 0px;" name="virtual_available" >
            <t t-esc="line.product_id.virtual_available"/>
      </td>
    </xpath>
</template>

0 个答案:

没有答案