def execute():
	import webnotes
	from webnotes.model.code import get_obj
	
	sc_obj = get_obj("Sales Common")
	
	si = webnotes.conn.sql("""select distinct 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))
@@ -69,16 +69,17 @@
 _obj%0A%09%0A%09
+#
 sc_obj =
@@ -103,16 +103,71 @@
 ommon%22)%0A
+%09from selling.doctype.sales_common import sales_common%0A
 %09%0A%09si = 
@@ -432,39 +432,34 @@
 %0A%09%09s
-c_obj.update_prevdoc_detail(1, 
+ales_common.StatusUpdater(
 get_
@@ -501,9 +501,35 @@
 ldren=1)
+, %5C%0A%09%09 %091).update_all_qty(
 )

update % delievered and % billed in SO if pos made against that so