Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Priemyselné odvetvia
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Reštaurácia
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Reality
    • Real Estate Agency
    • Architecture Firm
    • Konštrukcia
    • Estate Managament
    • Gardening
    • Property Owner Association
    Poradenstvo
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Jedlo
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Iní
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Pomoc

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

Create custom filter for odoo 13 community[SOLVED]

Odoberať

Get notified when there's activity on this post

This question has been flagged
salesfiltercommunity13
2 Replies
3805 Zobrazenia
Avatar
Learning_Odoo

Hi, I'm trying to create a custom filter to divide contacts into 3 categories:
1st is a client
2nd is a prospect
3° It is contact.

This is the code I am using.


is_client = fields.Boolean(compute='_customize_filter', string="Es un cliente")
is_prospect = fields.Boolean(compute='_customize_filter', string="Es un prospecto")
is_contact = fields.Boolean(compute='_customize_filter', string="Es un contacto")

def _customize_filter(self):
for
partner in self:
partner.is_prospect = True
partner.is_client = partner.total_invoiced > 0
partner.is_contact = bool(partner.parent_id)
if
partner.sale_order_count > 0:
if
partner.total_invoiced == 0 and not partner.is_client:
partner.is_prospect = True
else:
partner.is_prospect = False
else:
partner.is_prospect = False

In res.partner there are 3 fields (which are in a bar) called total_invoiced, sale_order_count and parent_id...
What I'm trying to do is the following...
If the contact has sales but no invoices made, the lead boolean will be activated.
2° If the contact has sales and has invoices, the boolean of he is a customer will be activated, but the boolean of is a prospect will be deactivated (because when he already has invoices made, he already becomes a customer).
3° If the contact has a sub-contact, the sub-contact will activate the boolean of that contact.


The condition works perfectly, but where the problem comes from is when doing the filtering.
This is my xml code (just try to do the client filter)

id="filter_register" model="ir.ui.view">
name="name">res.partner
name="model">res.partner
name="inherit_id" ref="base.view_res_partner_filter"/>
name="arch" type="xml">
expr="//search/separator" position="after">
domain="[('is_client','=',True)]" name="is_client" string="Es un cliente PRUEBA"/>



But the filter doesn't work like that...
If I set the store=True to the boolean fields it doesn't work either, since locally at the moment of reloading the page, the log gets stuck and no longer advances...
Is there a way that I can create this filter for the 3 boolean fields?
Or if there is a module that already activates the boolean fields automatically and allows me to make filters...
Since the modules I found do not have a condition in which the fields are automatically activated...
Thank you.

0
Avatar
Zrušiť
Avatar
Jainesh Shah(Aktiv Software)
Best Answer

Hello Learning_Odoo,

Please find code in comment. 

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

1
Avatar
Zrušiť
Jainesh Shah(Aktiv Software)

lease find below code it may help you to resolve this issue,

<record id="inherit_view_res_partner_filter" model="ir.ui.view">
<field name="name">res.partner.select</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//filter[@name='type_company']" position="after">
<filter name="is_client" string="Es un cliente PRUEBA" domain="[('is_client', '!=', False)]"/>
</xpath>
</field>
</record>

Avatar
Niyas Raphy (Walnut Software Solutions)
Best Answer

Hi,

If you are making the field as stored fields, you should add proper dependencies to the compute function, so that the function will get recalculated when the dependencies get changed.  

So you have to check and see, whether proper dependencies can be added so that it can be made as storable field.

If it cannot be made as stored field, other option to define the search functions for the field. See:  Searchable Non Stored Compute Field In Odoo


Thanks

0
Avatar
Zrušiť
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registrácia
Related Posts Replies Zobrazenia Aktivita
Dashboard Same period last year filter
sales filter
Avatar
Avatar
1
mar 25
1431
How to hide the producty internal reference on the printed invoice? (I did it on the SO!) Solved
sales community v11
Avatar
Avatar
Avatar
2
jún 25
10195
How can I know in which sales orders the forecasted products have been used in odoo 13 community
community odoo 13
Avatar
Avatar
2
feb 24
2148
How to exchange Product in Odoo V10C
sales community odoo10
Avatar
Avatar
1
okt 17
3802
Odoo times out when generating an invoice for 2,000 to 8,000 Sales Orders - ie: 40,000 invoice lines
sales community invoice V15
Avatar
Avatar
1
júl 25
2367
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo je sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now