Skip to content

Commit

Permalink
[MIG]purchase_requisition_stock: add mig script v15
Browse files Browse the repository at this point in the history
  • Loading branch information
hieu1211 committed Jun 20, 2022
1 parent 2aa22ab commit 074a843
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docsource/modules140-150.rst
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ Module coverage 14.0 -> 15.0
+-------------------------------------------------+----------------------+-------------------------------------------------+
| purchase_requisition | | |
+-------------------------------------------------+----------------------+-------------------------------------------------+
| purchase_requisition_stock | | |
| purchase_requisition_stock |Done | |
+-------------------------------------------------+----------------------+-------------------------------------------------+
| |new| purchase_requisition_stock_dropshipping | | |
+-------------------------------------------------+----------------------+-------------------------------------------------+
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
openupgrade.logged_query(
env.cr,
"""
WITH subquery as (
SELECT op.name as origin, p.id as pid
FROM stock_warehouse_orderpoint AS op
LEFT JOIN procurement_group AS p ON op.group_id = p.id
)
UPDATE purchase_requisition as requisition
SET procurement_group_id = subquery.pid
FROM subquery
WHERE requisition.origin = subquery.origin;
""",
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---Models in module 'purchase_requisition_stock'---
---Fields in module 'purchase_requisition_stock'---
purchase_requisition_stock / purchase.requisition / procurement_group_id (many2one): NEW relation: procurement.group
# DONE: post-migration: fill data from stock.warehouse.orderpoint

---XML records in module 'purchase_requisition_stock'---

0 comments on commit 074a843

Please sign in to comment.