File tree Expand file tree Collapse file tree 1 file changed +18
-5
lines changed
Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -8,12 +8,25 @@ def execute():
88
99
1010def update_delivery_note ():
11- DN = frappe .qb .DocType ("Delivery Note" )
12- DNI = frappe .qb .DocType ("Delivery Note Item" )
11+ # Postgres doesn't support UPDATE ... JOIN. Use UPDATE ... FROM instead.
12+ frappe .db .multisql (
13+ {
14+ "mariadb" : """
15+ UPDATE `tabDelivery Note Item` dni
16+ JOIN `tabDelivery Note` dn ON dn.`name` = dni.`parent`
17+ SET dni.`against_pick_list` = dn.`pick_list`
18+ WHERE COALESCE(dn.`pick_list`, '') <> ''
19+ """ ,
20+ "postgres" : """
21+ UPDATE "tabDelivery Note Item" dni
22+ SET against_pick_list = dn.pick_list
23+ FROM "tabDelivery Note" dn
24+ WHERE dn.name = dni.parent
25+ AND COALESCE(dn.pick_list, '') <> ''
26+ """ ,
27+ }
28+ )
1329
14- frappe .qb .update (DNI ).join (DN ).on (DN .name == DNI .parent ).set (DNI .against_pick_list , DN .pick_list ).where (
15- IfNull (DN .pick_list , "" ) != ""
16- ).run ()
1730
1831
1932def update_pick_list_items ():
You can’t perform that action at this time.
0 commit comments