fixes in stock reco
This commit is contained in:
parent
c313d662df
commit
9437f39c86
@ -36,6 +36,9 @@ class DocType(DocListController):
|
|||||||
self.delete_stock_ledger_entries()
|
self.delete_stock_ledger_entries()
|
||||||
|
|
||||||
def validate_data(self):
|
def validate_data(self):
|
||||||
|
if not self.doc.reconciliation_json:
|
||||||
|
return
|
||||||
|
|
||||||
data = json.loads(self.doc.reconciliation_json)
|
data = json.loads(self.doc.reconciliation_json)
|
||||||
if self.head_row not in data:
|
if self.head_row not in data:
|
||||||
msgprint(_("""Hey! You seem to be using the wrong template. \
|
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"]
|
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)
|
data = json.loads(self.doc.reconciliation_json)
|
||||||
for row_num, row in enumerate(data[data.index(self.head_row)+1:]):
|
for row_num, row in enumerate(data[data.index(self.head_row)+1:]):
|
||||||
row = webnotes._dict(zip(row_template, row))
|
row = webnotes._dict(zip(row_template, row))
|
||||||
@ -229,13 +235,13 @@ class DocType(DocListController):
|
|||||||
args.update(opts)
|
args.update(opts)
|
||||||
|
|
||||||
# create stock ledger entry
|
# 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
|
# update bin
|
||||||
webnotes.get_obj('Warehouse', row.warehouse).update_bin(args)
|
webnotes.get_obj('Warehouse', row.warehouse).update_bin(args)
|
||||||
|
|
||||||
# update_entries_after(args)
|
|
||||||
|
|
||||||
return sle_wrapper
|
return sle_wrapper
|
||||||
|
|
||||||
def delete_stock_ledger_entries(self):
|
def delete_stock_ledger_entries(self):
|
||||||
|
|||||||
@ -39,7 +39,9 @@ class DocType:
|
|||||||
"doctype": "Bin",
|
"doctype": "Bin",
|
||||||
"item_code": item_code,
|
"item_code": item_code,
|
||||||
"warehouse": warehouse,
|
"warehouse": warehouse,
|
||||||
}]).insert()
|
}])
|
||||||
|
bin_wrapper.ignore_permissions = 1
|
||||||
|
bin_wrapper.insert()
|
||||||
|
|
||||||
bin_obj = bin_wrapper.make_obj()
|
bin_obj = bin_wrapper.make_obj()
|
||||||
else:
|
else:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user