issue with supplier reference and price in purchase order
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Addons (MOVED TO GITHUB) |
Confirmed
|
Low
|
OpenERP R&D Addons Team 2 |
Bug Description
Here is the scenario to reproduce the problem on an up-to-date OpenERP v7.0 :
1. create a new DB with demo data
2. install the "purchase" module
3. Add yourself to the "Purchase pricelist" group
4. Edit the contact "Phillipp Miller" from "Mediapole" and set "supplier" = True
5. Edit the "default purchase pricelist" and, in the first rule, set "Based on" = "Supplier prices on the product form"
6. Edit the product "USB Adapter" : in the procurement tab, open the supplier info with supplier "Mediapole" and set :
- Supplier Product Name : Super USB3 Adapter
- Supplier Product Name SUSB3
- add a price rule : Quantity = 1, Price = 42.0
7. Create a new purchase order with partner = Philipp Miller (from Mediapole). Add a product line and choose product "USB Adapter" :
- the description is set to "[ADPT] USB Adapter" -> that's a bug, the description should be "[SUSB3] Super USB3 Adapter"
- the price is set to 0.0 -> that's a bug, the price should be 42.0.
Cause of the bug :
if you look at the code of purchase/
I propose the following solution to fix the problem :
- in product.
- in the function onchange_product_id of the purchase.
I have implemented the solution in a small module "purchase_
Hi Alexis,
Thanks for reporting. The configuration you describe is a bit unusual because there is little reason to mark a contact as a supplier in most cases. Nevertheless if users do it, then perhaps they actually meant to have that contact always appear as the supplier for a given product. And in that case, they should probably be able to select that supplier on the product form, so the system will automatically select it when a draft PO is created for a procurement.
Based on the above, the fix I would suggest is to correct the supplier matching in purchase. order.line. onchange_ product_ id() so that it will allow matching any supplier that belongs to the same "commercial entity" (comparing `.commercial_ partner_ id.id` of both partners, instead of `id`) . This should be a one-line patch and would give maximum flexibility to the users. The first match would be found in the order in which they defined the suppliers. What do you think?