fix: unlink references from batch on cacnellation of stock transactions

This commit is contained in:
Rohit Waghchaure
2020-01-23 12:42:42 +05:30
parent 239f0d529e
commit 4f4dbf1996
4 changed files with 10 additions and 0 deletions

View File

@@ -234,6 +234,13 @@ class StockController(AccountsController):
frappe.throw(_("{0} {1}: Cost Center is mandatory for Item {2}").format(
_(self.doctype), self.name, item.get("item_code")))
def unlink_reference_from_batch(self):
frappe.db.sql(""" UPDATE `tabBatch`
SET reference_doctype = NULL, reference_name = NULL
WHERE
reference_doctype = %s and reference_name = %s
""", (self.doctype, self.name))
def get_sl_entries(self, d, args):
sl_dict = frappe._dict({
"item_code": d.get("item_code", None),