Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
commit
ffe99531e5
17
patches/december_2012/repost_ordered_qty.py
Normal file
17
patches/december_2012/repost_ordered_qty.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
def execute():
|
||||||
|
import webnotes
|
||||||
|
from webnotes.utils import flt
|
||||||
|
bins = webnotes.conn.sql("select item_code, warehouse, name, ordered_qty from `tabBin`")
|
||||||
|
for d in bins:
|
||||||
|
ordered_qty = webnotes.conn.sql("""
|
||||||
|
select sum(ifnull(po_item.qty, 0) - ifnull(po_item.received_qty, 0))
|
||||||
|
from `tabPurchase Order Item` po_item, `tabPurchase Order` po
|
||||||
|
where po_item.parent = po.name and po.docstatus = 1 and po.status != 'Stopped'
|
||||||
|
and po_item.item_code = %s and po_item.warehouse = %s
|
||||||
|
""", (d[0], d[1]))
|
||||||
|
|
||||||
|
if flt(d[3]) != flt(ordered_qty[0][0]):
|
||||||
|
print d[3], ordered_qty[0][0]
|
||||||
|
|
||||||
|
webnotes.conn.sql("""update `tabBin` set ordered_qty = %s where name = %s""",
|
||||||
|
(ordered_qty and ordered_qty[0][0] or 0, d[2]))
|
@ -709,4 +709,8 @@ patch_list = [
|
|||||||
'patch_module': 'patches.december_2012',
|
'patch_module': 'patches.december_2012',
|
||||||
'patch_file': 'deprecate_tds',
|
'patch_file': 'deprecate_tds',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'patch_module': 'patches.december_2012',
|
||||||
|
'patch_file': 'repost_ordered_qty',
|
||||||
|
},
|
||||||
]
|
]
|
Loading…
x
Reference in New Issue
Block a user