From 4b8db610627fca6eed776d93caadb1217567e262 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 27 Apr 2023 18:24:54 +0200 Subject: [PATCH] [OU-FIX] purchase: set date_approve in all the confirmed orders If there's no double approval, all the previous orders will be ignored. TT42662 --- addons/purchase/migrations/13.0.1.2/post-migration.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/purchase/migrations/13.0.1.2/post-migration.py b/addons/purchase/migrations/13.0.1.2/post-migration.py index 0fe50e0f8ffb..e591ed26d77f 100644 --- a/addons/purchase/migrations/13.0.1.2/post-migration.py +++ b/addons/purchase/migrations/13.0.1.2/post-migration.py @@ -15,16 +15,16 @@ def move_fields_from_invoice_to_moves(env): def change_type_purchase_order_date_approve(env): - openupgrade.logged_query( - env.cr, """ + query = """ UPDATE purchase_order po SET date_approve = mm.date FROM mail_message mm WHERE mm.subtype_id = %s AND mm.model = 'purchase.order' - AND mm.res_id = po.id""", - (env.ref('purchase.mt_rfq_approved').id, ), - ) + AND mm.res_id = po.id + AND date_approve IS NULL""" + openupgrade.logged_query(env.cr, query, (env.ref('purchase.mt_rfq_approved').id,)) + openupgrade.logged_query(env.cr, query, (env.ref('purchase.mt_rfq_confirmed').id,)) def fill_account_move_purchase_order_rel_table(env):