Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

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

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

How to open these 2 stock.picking action with 2 differents default filters?

Subscribe

Get notified when there's activity on this post

This question has been flagged
filterdefaultstock_picking
4 Replies
7331 Views
Avatar
Pascal Tremblay

Hello guys,

There is something I can't manage... Once again... Grrr. 

I have 2 different filters. I have 2 different actions. 

These 2 actions open the same model : stock.picking


Importation of filters :

<record id="stock_lapagept.all_delivery_orders_pt" model="ir.filters">

<field name="name">all_delivery_orders_pt</field>

<field name="model_id">stock.picking</field>

<field name="user_id" eval="False" />

<field name="domain">[['company_id', 'ilike', 'Page'], ['name', 'ilike', 'OUT']]</field>

<field name="context">{}</field>

<field name="is_default">False</field>

</record>

<record id="stock_lapagept.all_pos_orders_pt" model="ir.filters">

<field name="name">all_pos_orders_pt</field>

<field name="model_id">stock.picking</field>

<field name="user_id" eval="False" />

<field name="domain">[['company_id', 'ilike', 'Page'], ['name', 'ilike', 'PICKPOS']]</field>

<field name="context">{}</field>

<field name="is_default">False</field>

</record>


Filters are imported :



Importation of new actions :

<record id="stock.action_delivery_orders" model="ir.actions.act_window">

<field name="name">Delivery orders - PT action</field>

<field name="res_model">stock.picking</field>

<field name="type">ir.actions.act_window</field>

<field name="context">{'search_default_all_delivery_orders_pt': 1,'default_all_delivery_orders_pt': 1}</field>

</record>

<record id="stock.action_pos_orders" model="ir.actions.act_window">

<field name="name">Point of sale orders - PT action</field>

<field name="res_model">stock.picking</field>

<field name="type">ir.actions.act_window</field>  

<field name="context">{'search_default_all_pos_orders_pt': 1,'default_all_pos_orders_pt': 1}</field>

</record>



Here, it is always impossible to get the default filter in the search field at the top right (like on image below). If I click on Delivery orders - PT, I want to open WITH THE RIGHT FILTER : all_delivery_orders_pt




UPDATE #1

With this update, both filters get is_default to true in the Settings->Usder-defined filters. So, I always get the first one ('search_default_all_delivery_orders_pt') in the search field at the top right of my custom view. May be I should create 2 different search views? Don't forget, both filters are applied to the same model...


<record id="stock.action_delivery_orders" model="ir.actions.act_window">

<field name="name">Delivery orders - PT action</field>

<field name="res_model">stock.picking</field>

<field name="type">ir.actions.act_window</field>

<field name="context">{'search_default_all_delivery_orders_pt': True}</field>

<field name="search_view_id" ref="stock.view_picking_internal_search" />

</record>

<record id="stock.action_pos_orders" model="ir.actions.act_window">

<field name="name">Point of sale orders - PT action</field>

<field name="res_model">stock.picking</field>

<field name="type">ir.actions.act_window</field>

<field name="context">{'search_default_all_pos_orders_pt': True}</field>

<field name="search_view_id" ref="stock.view_picking_internal_search" />

</record>


 

0
Avatar
Discard
Pascal Tremblay
Author

may be I should use filter_domain in the search view...

Avatar
Cyril Gaspard (GEM)
Best Answer


<record id="stock.action_delivery_orders" model="ir.actions.act_window">

<field name="name">Delivery orders - PT action</field>

<field name="res_model">stock.picking</field>

<field name="type">ir.actions.act_window</field>

<field name="context">{'search_default_all_delivery_orders_pt': True}</field>

</record>


<record id="stock.action_pos_orders" model="ir.actions.act_window">

<field name="name">Point of sale orders - PT action</field>

<field name="res_model">stock.picking</field>

<field name="type">ir.actions.act_window</field>

<field name="context">{'search_default_all_pos_orders_pt': True}</field>

</record>


and add to your 2 actions:

<field name="search_view_id" ref="module_name.id_of_view_search"/>

should be but to verify:

<field name="search_view_id" ref="stock.view_picking_internal_search"/>

1
Avatar
Discard
Pascal Tremblay
Author

I updated my question. Still something missing. Thanks.

Avatar
Pascal Tremblay
Author Best Answer

Thanks a lot mister Gaspard.

I have found this post : https://www.odoo.com/fr_FR/forum/help-1/question/how-can-i-assgin-two-different-filters-two-same-model-but-with-different-menu-75272

Conclusion : I think we should create filters in the search view and NOT in ir.filters.

CODE :

<record id="stock.view_picking_internal_search" model="ir.ui.view">

<field name="name">stock.picking.internal.search</field>

<field name="model">stock.picking</field>

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

<search string="Picking Lists">

<filter string="all_delivery_orders_pt" name="all_delivery_orders_pt" domain="[['company_id', 'ilike', 'Page'], ['name', 'ilike', 'OUT']]"/>

<filter string="all_receipts_pt" name="all_receipts_pt" domain="[['company_id', 'ilike', 'Page'], ['name', 'ilike', 'IN']]"/>

<filter string="all_internal_transfers_pt" name="all_internal_transfers_pt" domain="[['company_id', 'ilike', 'Page'], ['name', 'ilike', 'INT']]"/>

<filter string="all_pos_orders_pt" name="all_pos_orders_pt" domain="[['company_id', 'ilike', 'Page'], ['name', 'ilike', 'PICKPOS']]"/>

<filter string="all_dropship_pt" name="all_dropship_pt" domain="[['company_id', 'ilike', 'Page'], ['name', 'ilike', 'DS']]"/>

<field name="name" string="Picking List" filter_domain="['|',('name','ilike', self),('origin','ilike',self)]"/>

<filter icon="terp-check" name="draft" string="Draft" domain="[('state','=','draft')]" help="Draft Moves"/>

<filter icon="terp-check" name="available" string="Ready" domain="[('state','in',('assigned', 'partially_available'))]" help="Assigned Moves"/>

<filter icon="terp-check" name="waiting" string="Waiting Availability" domain="[('state','=', 'confirmed')]" help="Waiting Moves"/>

<filter icon="terp-camera_test" name="confirmed" string="Confirmed" domain="[('state','in', ('confirmed', 'waiting', 'assigned'))]" help="Confirmed Moves"/>

<filter icon="terp-dialog-close" name="done" string="Done" domain="[('state','=','done')]" help="Pickings already processed"/>

<separator/>

<filter name="late" string="Late" domain="[('min_date','<', time.strftime('%%Y-%%m-%%d %%H:%%M:%%S'))]" help="Pickings that are late on scheduled time"/>

<separator/>

<filter name="backorder" string="Backorders" domain="[('backorder_id','<>', False)]" help="Remaining parts of picking partially processed"/>

<field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>

<field name="product_id"/>

<field name="picking_type_id"/>

<field name="group_id"/>

<group expand="0" string="Group By">

<filter string="Status" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>

<filter string="Order Date" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>

<filter string="Expected Date" icon="terp-go-month" domain="[]" context="{'group_by':'min_date'}"/>

<filter string="Origin" domain="[]" context="{'group_by':'origin'}"/>

<filter string="Picking Type" domain="[]" context="{'group_by':'picking_type_id'}"/>

<filter string="Procurement Group" domain="[]" context="{'group_by':'group_id'}"/>

</group>

</search>

</field>

</record>

0
Avatar
Discard
Cyril Gaspard (GEM)

Yes I think too, I never do ir_filter like you. for the rest, what I done should be good, bye

Cyril Gaspard (GEM)

you can keep same view, add just in context a value 'your_variable': True or False depending the case , and use it to display or not in search view your filter with attrs="{'invisible': [('your_variable': True)]}"

Pascal Tremblay
Author

Thanks for all

Enjoying the discussion? Don't just read, join in!

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

Sign up
Related Posts Replies Views Activity
Set default filter value for company of logged-in user in search view
filter default
Avatar
0
Mar 15
4832
How to set a field as default for the Add Custom Filter option in Odoo 17 or 18 ?
filter default 17.0
Avatar
Avatar
1
Jan 25
2149
Dynamic Domain Filter Solved
filter stock_picking odoo11
Avatar
Avatar
Avatar
2
May 24
5793
Difference between Late and Is Late filter in 'stock.picking' model in Odoo Solved
filter stock_picking late
Avatar
Avatar
1
Mar 23
2570
How to get different default value in different view Solved
filter default odoo
Avatar
Avatar
2
Oct 22
5014
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة 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 is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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