fixes in stock reco
diff --git a/stock/doctype/stock_reconciliation/stock_reconciliation.py b/stock/doctype/stock_reconciliation/stock_reconciliation.py
index 3a8ffcd..8afe1d2 100644
--- a/stock/doctype/stock_reconciliation/stock_reconciliation.py
+++ b/stock/doctype/stock_reconciliation/stock_reconciliation.py
@@ -36,6 +36,9 @@
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 @@
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 @@
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):
diff --git a/stock/doctype/warehouse/warehouse.py b/stock/doctype/warehouse/warehouse.py
index 8d6065c..7c3cbd6 100644
--- a/stock/doctype/warehouse/warehouse.py
+++ b/stock/doctype/warehouse/warehouse.py
@@ -39,7 +39,9 @@
"doctype": "Bin",
"item_code": item_code,
"warehouse": warehouse,
- }]).insert()
+ }])
+ bin_wrapper.ignore_permissions = 1
+ bin_wrapper.insert()
bin_obj = bin_wrapper.make_obj()
else: