Merge branch 'master' of github.com:webnotes/erpnext

This commit is contained in:
Rushabh Mehta 2013-01-14 16:11:30 +05:30
commit 1cfde3ed41
2 changed files with 12 additions and 4 deletions

View File

@ -36,6 +36,9 @@ class DocType(DocListController):
self.delete_stock_ledger_entries()
def validate_data(self):
if not self.doc.reconciliation_json:
return
data = json.loads(self.doc.reconciliation_json)
if self.head_row not in data:
msgprint(_("""Hey! You seem to be using the wrong template. \
@ -118,6 +121,9 @@ class DocType(DocListController):
row_template = ["item_code", "warehouse", "qty", "valuation_rate"]
if not self.doc.reconciliation_json:
msgprint(_("""Stock Reconciliation file not uploaded"""), raise_exception=1)
data = json.loads(self.doc.reconciliation_json)
for row_num, row in enumerate(data[data.index(self.head_row)+1:]):
row = webnotes._dict(zip(row_template, row))
@ -229,13 +235,13 @@ class DocType(DocListController):
args.update(opts)
# create stock ledger entry
sle_wrapper = webnotes.model_wrapper([args]).insert()
sle_wrapper = webnotes.model_wrapper([args])
sle_wrapper.ignore_permissions = 1
sle_wrapper.insert()
# update bin
webnotes.get_obj('Warehouse', row.warehouse).update_bin(args)
# update_entries_after(args)
return sle_wrapper
def delete_stock_ledger_entries(self):

View File

@ -39,7 +39,9 @@ class DocType:
"doctype": "Bin",
"item_code": item_code,
"warehouse": warehouse,
}]).insert()
}])
bin_wrapper.ignore_permissions = 1
bin_wrapper.insert()
bin_obj = bin_wrapper.make_obj()
else: