Přejít na obsah
Menu
This question has been flagged
1 Odpovědět
8241 Zobrazení

In the module of the core 'sale' (sale_views) we can find the line:


<field name="order_line" string="Product" filter_domain="[('order_line.product_id', 'ilike', self)]"/>


When the filter is tested for 'cer' by Product, 60 sales orders appear, but if you export this data, 200 appear on the csv (e.g.).

The results of this csv are correct. Different sales orders also contain 'cert'.


According to https://www.odoo.com/documentation/12.0/reference/views.html#search the difference between filter_domain and domain is that in filter_domain you can use 'self'.


But by changing in the field 'filter_domain' to 'domain' the filter works:

<record id="view_sales_order_filter_fixed" model="ir.ui.view">

        <field name="name">view.sales.order.filter.fixed</field>

        <field name="model">sale.order</field>

        <field name="inherit_id" ref="sale.view_sales_order_filter"/>

        <field name="arch" type="xml">

            <field name="order_line" position="replace">

                <field name="order_line" string="Product" domain="[('order_line.product_id', 'ilike', self)]"/>

            </field>

        </field>

    </record>


Why does this happen? Can you use 'self' with 'domain' or is it a sales module error? 


Avatar
Zrušit
Nejlepší odpověď

I searched the same thing, and this thread showed as 1st result without answer.
Whoever came across this, please, take a look at this answer.
https://www.odoo.com/forum/help-1/what-is-diff-between-domain-domain-filter-and-attr-21145

In short,
Domain are applied on relational fields (Many2one, One2many, Many2many) which restrict available selection when records are viewed in UI.
filter_domain is a search filter to best match given input by user, and it does not affect how records are actually stored.

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
bře 23
3786
2
bře 24
3300
2
srp 21
9772
1
srp 16
5449
0
bře 15
4456