[6.1/7.0/trunk][purchase] changing PO partner_id after order is saved keeps corrupted partner_id at order_line level (fields.related)
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
Odoo Addons (MOVED TO GITHUB) |
Confirmed
|
Medium
|
OpenERP R&D Addons Team 2 | |||
OpenERP Community Backports (Addons) | Status tracked in 7.0 | |||||
6.1 |
Fix Committed
|
Medium
|
OpenERP Community Backports | |||
7.0 |
Fix Committed
|
Medium
|
OpenERP Community Backports |
Bug Description
How to reproduce:
on new install with demo data on head v7:
Create a new purchase order with one purchase order line.
Save the purchase order.
Take the purchase order id X from the URL and look at the result of this SQL query:
select partner_id from purchase_order_line where order_id=X;
This gives you Y the partner_id of the purchase order which is expected.
Now edit the purchase order again, change the partner and save it. Run the same SQL query again.
KABOOM! this gives you the old partner_id id which is now corrupted!
I think the problem comes from the fact this is a fields.related with store=True and no proper cache invalidation function. This is a crazy bug because all SQL or ORM using that related field will give corrupted results once you change a purchase order partner, which is something pretty common.
Related branches
- OpenERP Core Team: Pending requested
-
Diff: 28 lines (+10/-1)1 file modifiedpurchase/purchase.py (+10/-1)
- OpenERP Core Team: Pending requested
-
Diff: 28 lines (+10/-1)1 file modifiedpurchase/purchase.py (+10/-1)
- Guewen Baconnier @ Camptocamp: Needs Fixing
- Holger Brunn (Therp): Needs Fixing (code review)
-
Diff: 28 lines (+10/-1)1 file modifiedpurchase/purchase.py (+10/-1)
- Guewen Baconnier @ Camptocamp: Needs Fixing
- Christophe CHAUVET: Needs Fixing
- Holger Brunn (Therp): Needs Fixing (code review)
-
Diff: 28 lines (+10/-1)1 file modifiedpurchase/purchase.py (+10/-1)
SQL Query to fix existing data:
UPDATE purchase_order_line order.partner_ id order_line. order_id = purchase_order.id order_line. partner_ id <> purchase_ order.partner_ id;
SET partner_id = purchase_
FROM purchase_order
WHERE purchase_
AND purchase_