Help

0

Can Odoo automatically pick the Cheapest Vendor listed in the Purchase tab of a Product when generating an RFQ?

Avatar
Community Question

I have multiple Vendors for several Products.

I would like Odoo to automatically select the Vendor with the cheapest price (the prices change each month) when generating an RFQ (draft Purchase Order). 

Is this possible.

Avatar
Discard
3 Answers
1
Avatar
Ray Carnes (ray)
Best Answer

Note: Right Click the images below and select VIEW IMAGE / OPEN IMAGE IN A NEW TAB to see larger versions.

Yes.

Odoo uses the first Vendor in the list by default.

To have it choose the cheapest, the easiest way is to sort the list by price each time it is edited.  You will also have to remove the drag handle from the list to stop users re-sorting the list.

1. Create an Automated Action that makes sure the list of is always sorted after any edits (also works if you change prices from the Vendor Pricelist menu).



2. Remove the drag handle by creating your own view that inherits and overrides the default:


Avatar
Discard
0
Best Answer

In odoo 13 CE is not possible sort suppliers list from product template, changes will not be saved.

It's possible sort suppliers list from product.supplierlist, changes will be saved.

Can anyone adapt code descripted in this post, for use it in template product.supplierinfo

Below original code:

if record.seller_ids:
  record['seller_ids'] = record.seller_ids.sorted(key = lambda s: s.price)

Thanks

9 Comments
Avatar
Discard
Avatar
Ray Carnes (ray)
-

Make sure base_automation "Automated Action Rules" is installed and visit the Automated Actions menu.

Avatar
Gargano Dok Scarl
-

Hi Ray, thanks for your help. I've do it some days ago, and it work. I've do step 1 only (1. Create an Automated Action) and not step 2. (2. Remove the drag handle). But if I change manually a supplier price, in product template, It not reoder automatic supplier list. Maybe I must to do step 2, for work well? Thanks

Hi, I'm using odoo 13 community, not work! I've do it, both modifies, but not sort supplier list by price.

Avatar
Chris TRINGHAM
-

I think there may be an extra step. As well as removing the "drag handle", existing records on product.supplierinfo need to be updated so that the sequence is 1 (otherwise this overrides the sort done in the Automated Action)

Hi Chris, can you write more details to do, I'm not a developer and I don't know how do. Could you write what I must do? Thanks

Avatar
Chris TRINGHAM
-

Hi Chris, thanks for guide. I've try, and suppliers are sorted by price. But I've look that suppliers are sorted by min_qty first , and by price after. If I have some suppliers with high min_qty and more expensive, they will be sorted before others more cheap end with low min_qty. I don't know if is this correct action, but I needed sort by price first , and by min_qty secondary. Any idea?

Avatar
Chris TRINGHAM
-

I'm not a Python programmer, but a bit of quick research reveals that you can add a second field to the sort:

if record.seller_ids:

record['seller_ids'] = record.seller_ids.sorted(key = lambda s: (s.price,s.min_qty))

Hi Chris I don't know why, but not work anyway. It is sorted by min_qty before, always. Thank you very much. If anyone have any others solution is appreciated, thanks

0
Avatar
Chris Kelley
Best Answer

would this work if you updated by import (i dont think it would)

1 Comment
Avatar
Discard
Avatar
Ray Carnes (ray)
-

Yes. Create and Update are triggered with data imports, and I tested this particular automation.