This commit is contained in:
Rushabh Mehta 2012-12-05 16:49:58 +05:30
commit 38f19104d8
5 changed files with 39 additions and 2 deletions

View File

@ -46,5 +46,8 @@ class DocType:
@webnotes.whitelist()
def get_approver_list():
return [r[0] for r in webnotes.conn.sql("""select distinct parent from `tabUserRole`
roles = [r[0] for r in webnotes.conn.sql("""select distinct parent from `tabUserRole`
where role='Expense Approver'""")]
if not roles:
webnotes.msgprint("No Expense Approvers. Please assign 'Expense Approver' Role to atleast one user.")
return roles

View File

@ -119,5 +119,9 @@ def get_leave_balance(employee, leave_type, fiscal_year):
@webnotes.whitelist()
def get_approver_list():
return [r[0] for r in webnotes.conn.sql("""select distinct parent from `tabUserRole`
roles = [r[0] for r in webnotes.conn.sql("""select distinct parent from `tabUserRole`
where role='Leave Approver'""")]
if not roles:
webnotes.msgprint("No Leave Approvers. Please assign 'Leave Approver' Role to atleast one user.")
return roles

View 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]))

View File

@ -0,0 +1,5 @@
def execute():
import webnotes
webnotes.conn.sql("""update `tabBin`
set projected_qty = ifnull(actual_qty, 0) + ifnull(indented_qty, 0) +
ifnull(ordered_qty, 0) + ifnull(planned_qty, 0) - ifnull(reserved_qty, 0)""")

View File

@ -713,4 +713,12 @@ patch_list = [
'patch_module': 'patches.december_2012',
'patch_file': 'expense_leave_reload',
},
{
'patch_module': 'patches.december_2012',
'patch_file': 'repost_ordered_qty',
},
{
'patch_module': 'patches.december_2012',
'patch_file': 'repost_projected_qty',
},
]