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

Get a functionnnal field on advanced research fields option , on the filter [v7]

Odoberať

Get notified when there's activity on this post

This question has been flagged
filterfieldsv7advanced_filterfunctional
2 Replies
6199 Zobrazenia
Avatar
TEIMI Yassine

I added a functionnal field on stock.picking model, I want to have this field, on the list of fields to choose, when you try to filter on fields, using the openerp filter tool. How this can be possible ?

As it's for payed and delivered functionnal fields on sale.order, I want to put my field among the choosable fields on advanced research option, on the filter. 

Many thanks.

0
Avatar
Zrušiť
Avatar
Ivan
Best Answer

This has been discussed numerous times albeit with different context: by default function fields are not stored in the database and cannot be used for filtering/domain/sorting unless if you implement fnct_search or set the store attribute to True.

0
Avatar
Zrušiť
TEIMI Yassine
Autor

I have already values computed for this functionnal field, when I add the store=True parameter, it raises error that the column of this functionnal field does not exist on database. Do I have to add store=True only when there is no values computed for this field ?

TEIMI Yassine
Autor

I'm inheriting with "orm.Model" should I do it with osv.osv so that the field can be stored on database ?

Ivan

orm.Model is just an alias for osv.osv. They are pointing to the same object/class. So, it is not the issue. I don't quite get what you mean by "Do I have to add store=True only when there is no values computed for this field ?". Also by "I have already values computed for this functionnal field, when I add the store=True parameter, it raises error that the column of this functionnal field does not exist on database.". Exact wording of error will help. If you previously already have a field with the same name, it may cause problem, though I'm not sure what it will be exactly.

Ivan

store=True is defined for a column/field. So, it will be applicable whether the function used to calculate the column/field return value or not. In fact they MUST return value, although the value can be NULL or 0.0

TEIMI Yassine
Autor

I mean that I created the functionnal field, without the store=True parameter, and i have data on this field, it means that on the view containing this field, i already created records. and when I add the store=True parameter, for the functionnal field "amount_bl" for example it raises error : ProgrammingError: column stock_picking.amount_bl does not exist LINE 1: ...stock_picking."num_bl",stock_picking."commercial",stock_pick...

Ivan

You need to upgrade the module first.

Avatar
TEIMI Yassine
Autor Best Answer

@Ivan : To Explain more my situation : First of all, I created the functionnal field without the store parameter (i forgot), it's on stock.picking.out model, (stock_picking table). Then, users created "delivery orders", so this functionnal field has computed values. So, right now, when I add the store parameter, into the functionnal field "amount_bl" for example, it raises error : ProgrammingError: column stock_picking.amount_bl does not exist LINE 1: ...stock_picking."num_bl",stock_picking."commercial",stock_pick...

I wonder if that error comes from the fact that users have already created delivery orders, and does not find where to store it.? (a supposition).

                                                            EDITED ANWSER :

@Ivan : When updating the module an error raises : 

File "/opt/openerp/server/openerp/addons/add_bl_valcr/stock.py", line 23, in _amount_order so_record = self.pool.get('sale.order').browse(cr, uid, so_id, context=None) AttributeError: 'NoneType' object has no attribute 'browse'

It's related the function of the field, here is the code : 

class StockPickingOut(orm.Model):

    _inherit = 'stock.picking.out'
    _name = 'stock.picking.out'

    def _amount_order(self, cr, uid, ids, amount_bl, arg, context):

        res = {}
       
        for picking in self.browse(cr, uid, ids, context):

            res[picking.id] =  0.0
            origin = picking.origin
            cr.execute("SELECT ID FROM SALE_ORDER WHERE NAME='%s' AND ID IS NOT NULL" %(origin))
            so = cr.fetchone()
            if so:
                so_id = so[0]
                so_record = self.pool.get('sale.order').browse(cr, uid, so_id, context=None)
                amount = so_record.amount_total
             
                res[picking.id] = amount
        return res

I think it has a relation with the fact that old none stored values have been deleted. 

So what I did, it's ignoring this error, and updating the module, So now the functionnal field is empty.

Just to explain more what the function does, it just pull the amount of the sale order, and put it on the delivery order. I don't know now after putting store=True, it's not working properly (supposition).

I'm now working to improve the code of my functionnal field, I'll let you know of my results.

Many thanks Ivan.

 

 

 

0
Avatar
Zrušiť
Ivan

You need to upgrade the module first.

TEIMI Yassine
Autor

Yes it worked, but I lost all old none stored values for this field. How can I recompute these values again ?

TEIMI Yassine
Autor

@ivan : check my edited answer please.

Ivan

Remove the column from the table (or rename it to something else), the upgrade the module again.

TEIMI Yassine
Autor

In fact, that's what I did, I first renamed the column and add the store parameter as True, same result, The column is created on database, but with empty values for existing records. Secondly, I created other column, with the same function code, but of course renamed, (I passed the correct field_name parameter for the field's function). then, same result.

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
How to use AND / OR operators in advanced filters? Solved
filter v7
Avatar
Avatar
Avatar
Avatar
3
apr 23
35340
Filter last year and last month Solved
filter v7
Avatar
Avatar
Avatar
3
aug 17
24693
How to filter numerical values?
filter v7
Avatar
Avatar
1
jan 16
11919
Date is less than 3 months
filter fields
Avatar
0
júl 15
4350
Why an advanced product search with condition "doesn't contain" doesn't display products with empty searched field?
filter v7
Avatar
0
mar 15
5520
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