patch: update % delievered and % billed in SO if pos made against that so
diff --git a/patches/november_2012/update_delivered_billed_percentage_for_pos.py b/patches/november_2012/update_delivered_billed_percentage_for_pos.py
new file mode 100644
index 0000000..3e9adf4
--- /dev/null
+++ b/patches/november_2012/update_delivered_billed_percentage_for_pos.py
@@ -0,0 +1,15 @@
+def execute():
+ import webnotes
+ from webnotes.model.code import get_obj
+
+ sc_obj = get_obj("Sales Common")
+
+ si = webnotes.conn.sql("""select si.name
+ from `tabSales Invoice` si, `tabSales Invoice Item` si_item
+ where si_item.parent = si.name
+ and si.docstatus = 1
+ and ifnull(si.is_pos, 0) = 1
+ and ifnull(si_item.sales_order, '') != ''
+ """)
+ for d in si:
+ sc_obj.update_prevdoc_detail(1, get_obj("Sales Invoice", d[0], with_children=1))
\ No newline at end of file
diff --git a/patches/patch_list.py b/patches/patch_list.py
index 5cacfb2..55a8bb4 100644
--- a/patches/patch_list.py
+++ b/patches/patch_list.py
@@ -691,4 +691,8 @@
'patch_module': 'patches.november_2012',
'patch_file': 'communication_sender_and_recipient',
},
+ {
+ 'patch_module': 'patches.november_2012',
+ 'patch_file': 'update_delivered_billed_percentage_for_pos',
+ },
]
\ No newline at end of file