Skip to Content
Menu
This question has been flagged
2 Replies
3452 Views

Hello everybody!

I am trying to create a search filter for the attribute of "property_product_pricelist" in the model of "res.partner"

At first my module works, but I can write anything in the search and it doesn't filter.


This is what i've done:

<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
    <record id="view_property_product_pricelist_customer_filter" model="ir.ui.view">
        <field name="name">res.partner.search.property.product.pricelist</field>
        <field name="model">res.partner</field>
        <field name="type">search</field>
        <field name="arch" type="xml">
            <xpath expr="//search" position="inside">
                <field name="property_product_pricelist"/>
            </xpath>
        </field>
    </record>
</odoo>

The safest thing is that the error is very silly, but I do not see it.

If anyone knows something I would appreciate it very much!

Thank you very much and have a nice day!

Avatar
Discard
Best Answer

Hi,


<record id="view_property_product_pricelist_customer_filter" model="ir.ui.view">
        <field name="name">res.partner.search.property.product.pricelist</field>
        <field name="model">res.partner</field>       
        <field name="inherit_id" ref="base.view_res_partner_filter"/>
        <field name="arch" type="xml">
            <xpath expr="//search" position="inside">
                <field name="property_product_pricelist"/>
            </xpath>
        </field>
    </record>

Regards
Avatar
Discard

This doesn't work, as the field is not searchable. See https://odoo-community.org/shop/partner-pricelist-search-5823 for a "workaround"

Author Best Answer

 Hi Akshay Babu,

Thank you very much for your answer!!

At first it didn't work but looking closely I saw an attribute called "store" in the field "property_product_pricelist". 

Creating a model with the following:

# -*- coding: utf-8 -*-
from odoo import models, fields, api
class SavePropertyProductPriceLis(models.Model):
    _inherit = 'res.partner'
    property_product_pricelist = fields.Many2one('product.pricelist', store=True)

and restart the odoo service has made the filter work!! :)


Avatar
Discard

This breaks the way Odoo is working with pricelists, so don't do this barbarity. Use https://odoo-community.org/shop/partner-pricelist-search-5823 instead

Author

Thank you very much Pedro for your answer. I will keep it in mind for the next time.

Related Posts Replies Views Activity
0
Apr 23
1217
0
Jul 24
126
2
Nov 23
1210
0
Sep 21
3838
7
Apr 21
18378