fix: unlink references from batch on cacnellation of stock transactions
This commit is contained in:
parent
239f0d529e
commit
4f4dbf1996
@ -866,6 +866,7 @@ class PurchaseInvoice(BuyingController):
|
||||
# because updating ordered qty in bin depends upon updated ordered qty in PO
|
||||
if self.update_stock == 1:
|
||||
self.update_stock_ledger()
|
||||
self.unlink_reference_from_batch()
|
||||
|
||||
self.make_gl_entries_on_cancel()
|
||||
self.update_project()
|
||||
|
@ -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),
|
||||
|
@ -195,6 +195,7 @@ class PurchaseReceipt(BuyingController):
|
||||
# because updating ordered qty in bin depends upon updated ordered qty in PO
|
||||
self.update_stock_ledger()
|
||||
self.make_gl_entries_on_cancel()
|
||||
self.unlink_reference_from_batch()
|
||||
|
||||
def get_current_stock(self):
|
||||
for d in self.get('supplied_items'):
|
||||
|
@ -110,6 +110,7 @@ class StockEntry(StockController):
|
||||
self.update_cost_in_project()
|
||||
self.update_transferred_qty()
|
||||
self.update_quality_inspection()
|
||||
self.unlink_reference_from_batch()
|
||||
|
||||
def set_job_card_data(self):
|
||||
if self.job_card and not self.work_order:
|
||||
|
Loading…
x
Reference in New Issue
Block a user