Как добавить функцию поиска в выбор значений атрибутов в конфигураторе продукта в odoo 13 - PullRequest
0 голосов
/ 26 апреля 2020

Как добавить функцию поиска к выбору значений атрибутов в конфигураторе продукта в odoo 13? Я пытаюсь это:

<template id="variants" inherit_id="sale.variants">
        <xpath expr="//select[@t-att-data-attribute_id='ptal.attribute_id.id']" position="replace">
            <select
                    t-att-data-attribute_id="ptal.attribute_id.id"
                    t-attf-class="selectpicker form-control js_variant_change #{ptal.attribute_id.create_variant} #{'d-none' if single_and_custom else ''}"
                    t-att-name="'ptal-%s' % ptal.id"
                    data-live-search="true"
            >
                <t t-foreach="ptal.product_template_value_ids._only_active()" t-as="ptav">
                    <option t-att-value="ptav.id"
                            t-att-data-value_id="ptav.id"
                            t-att-data-value_name="ptav.name"
                            t-att-data-attribute_name="ptav.attribute_id.name"
                            t-att-data-is_custom="ptav.is_custom"
                            t-att-selected="ptav in combination"
                            t-att-data-is_single_and_custom="single_and_custom"
                            t-att-data-tokens="ptav.name">
                        <span t-field="ptav.name"/>
                        <span t-if="ptav.price_extra" class="badge badge-pill badge-secondary">
                            <!--
                                price_extra is displayed as catalog price instead of
                                price after pricelist because it is impossible to
                                compute. Indeed, the pricelist rule might depend on the
                                selected variant, so the price_extra will be different
                                depending on the selected combination. The price of an
                                attribute is therefore variable and it's not very
                                accurate to display it.
                                -->
                            <t t-esc="ptav.price_extra > 0 and '+' or '-'"/>
                            <span t-esc="abs(ptav.price_extra)" class="variant_price_extra"
                                  style="white-space: nowrap;"
                                  t-options='{
                                                "widget": "monetary",
                                                "from_currency": product.currency_id,
                                                "display_currency": (pricelist or product).currency_id
                                            }'/>
                        </span>
                    </option>
                </t>
            </select>

        </xpath>
    </template>

Я добавляю атрибут data-live-search = "true" и класс selectpicker для выбора, но не работает ?! Любая помощь ?

#

Product Configurator in odoo13 sale order line

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...