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

I want to show only the products on a Purchase Order available from the Vendor I am purchasing from?

Subscribe

Get notified when there's activity on this post

This question has been flagged
purchase_orderproductsfiltering
2 Replies
10318 Views
Avatar
Community Question

If I select "ACME" as the Vendor, I only want products to be shown if I have defined ACME as a Vendor on the product.

0
Avatar
Discard
Avatar
Ray Carnes (ray)
Best Answer

Odoo 18.0 has a Catalog button, which already filters all products by the Vendor.


UPDATED for Odoo 16.0, Odoo 17.0 


You need to modify the domain on the product_id field:

Code:

<!-- for Odoo 16.0 -->
<field name="product_id" position="attributes">
  <attribute name="domain">
      [('purchase_ok', '=', True),
       ('seller_ids.partner_id','=',parent.partner_id),
       '|',('company_id', '=', False),('company_id', '=', parent.company_id)]
  </attribute>   
</field>   


<!-- for Odoo 17.0 -->
<field name="product_id" position="attributes">
  <attribute name="domain">
      [('purchase_ok', '=', True),
      ('seller_ids.partner_id','=',parent.partner_id),
      '|',('company_id', '=', False),('company_id', 'parent_of', parent.company_id)]
  </attribute>   
</field>   



For Odoo 13.0, Odoo 14.0 and Odoo 15.0:


You need to modify the domain on the product_id field:

Code:

<field name="product_id" position="attributes">
<attribute name="domain">[('seller_ids.name','=',parent.partner_id),
('purchase_ok', '=', True), '|',
('company_id', '=', False),
('company_id', '=', parent.company_id)]
</attribute>
</field>


This gives you this user experience:

3
Avatar
Discard
iWesabe Technologies

Nice idea !!!. But seems this will raise error if multiple vendors added.

~ Shameem Babu

Ray Carnes (ray)

There is no problem with having as many Vendors as you need for a product.

Sveng

@Ray, tried this on v15EE no luck, also tried an xpath to select the field ... how can this be debugged? no msg's in the log.

Ray Carnes (ray)

Go back and check your work. I just tried this in v15EE and it worked fine. My guess is you didn't set the View Inheritance Mode.

Sveng

Have finally had some time to look at this again ... managed to get this to work but only when I switch off Settings->Purchase->Variant Grid Entry. Switching Variant Grid Entry on seems to add some code and additional inheritance on the order form which causes a conflict and/or override. Looks like I would have to inherit a different view??

Sveng

When Variant Grid Entry is turned on the product_id field is hidden and replace with product_template_id

<data><xpath expr="//tree/field[@name='product_id']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//tree/field[@name='product_id']" position="after">
<field name="product_template_id" string="Product" attrs="{ 'readonly': [('state', 'in', ('purchase', 'to approve','done', 'cancel'))], 'required': [('display_type', '=', False)], }" options="{'no_open': True}" context="{'partner_id': parent.partner_id}" widget="matrix_configurator"/>
<field name="product_template_attribute_value_ids" invisible="1"/>
<field name="product_no_variant_attribute_value_ids" invisible="1"/>
<field name="is_configurable_product" invisible="1"/>
</xpath>
<field name="partner_id" position="after">
<field name="grid" invisible="1"/>
<field name="grid_product_tmpl_id" invisible="1"/>
<field name="grid_update" invisible="1"/>
</field>
<xpath expr="//group[@name='other_info']" position="inside">
<field name="report_grids" groups="base.group_no_one"/>
</xpath>
</data>

What would be the correct action, inherit the inherited form and add a domain on product_template_id? Will this change be reflected in further inherited purchase.order.form views down stream?

What is / how is the resultant view determined (order?) when there are multiple inheritances and can there be sub-inheritances and what is processing order/result?

Also, is it possible to have conditional processing in an inherited view? Would the purchase.order.form contain the result of all previous inheritance processing and I could test weather product_id is hidden or not, if not hidden apply domain to product_id and if hidden apply to product_template_id?

Mikko

Would it be possible to modify this filter so that also product with no associated vendors could be picked on the RFQ? For example if no vendor is selected the list of products would not be filtered and full list of products would be shown?

Our users would like to have the filtered list 99% of the time, but would need to be able to pick also products with no vendors associated in some special cases. I'm trying to figure out a way to do this.

Sveng

Mikko, this should be possible with conditional domain attributes as listed here https://www.odoo.com/forum/help-1/14-how-to-set-conditional-domain-on-res-partner-based-on-move-type-in-account-move-form-193782 and here https://www.odoo.com/forum/help-1/conditionally-apply-domain-on-a-field-25468

Mikko

Thank you Sven for pointing me in the right direction and valuable links. I think I managed to achieve what we were looking for, just have to verify the result tomorrow. Much appreciated!

Mikko

Ok, so I got this solved, but our dev-server got overwriten along with my modifications. I had some notes, but it seems that I just can't get this to work again.

I had the following code on my notes. When I try to run this I get the following error "ValueError: Invalid leaf (True, '=', 744)". I guess there is something wrong with my syntax, but I just can't figure out what. Any thoughts?

<field name="product_id" position="attributes">
<attribute name="domain">['|', '&amp;', (True, '=',parent.partner_id),
('seller_ids.name','=',parent.partner_id),
('purchase_ok', '=', True), '|',
('company_id', '=', False),
('company_id', '=',parent.company_id),
'&amp;', (False, '=', parent.partner_id),
('purchase_ok', '=', True), '|',
('company_id', '=', False),
('company_id', '=', parent.company_id)]
</attribute>
</field>

Rickard Wallster

Hi Ray

In v17 there seems to be some changes in the parent fields. Do you know how to set the domain to get this code to work in v17?

Ray Carnes (ray)

I updated my answer.
The field on the Vendor Pricelist representing the Vendor was renamed from NAME to PARTNER_ID.

Please select JUST the section of XML relevant to your version if using Odoo 16.0, 17.0. (XML for both versions is shown but this customization will only work with one or the other).

Avatar
Sveng
Best Answer

If you are using Settings->Purchase->Products->Variant Grid Entry as an option then you need to apply this change to product_template_id field and inherit from the  purchase_product_matrix.purchase_order_form_matrix view.

0
Avatar
Discard
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
Purchase order manage for different suppliers
supplier purchase_order products
Avatar
Avatar
1
Feb 19
4747
Multiple color values for one variant
products filtering eCommerce v17
Avatar
Avatar
Avatar
2
May 24
2902
Odoo15 - How To Compare Filter - Purchase Order - Quantity Ordered >= Quantity Received?
purchase_order filtering studio v15
Avatar
0
Jan 23
2571
importing Purchase Order shown as a RFQ Solved
purchase_order
Avatar
Avatar
Avatar
2
May 25
2934
Create products with a sales price including VAT
products
Avatar
Avatar
Avatar
2
May 25
2287
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