fix: incorrect delink serial no and batch
This commit is contained in:
parent
896b9ef495
commit
0b71801462
@ -247,16 +247,17 @@ class StockController(AccountsController):
|
||||
for d in self.items:
|
||||
if not d.batch_no: continue
|
||||
|
||||
serial_nos = [sr.name for sr in frappe.get_all("Serial No",
|
||||
{'batch_no': d.batch_no, 'status': 'Inactive'})]
|
||||
|
||||
if serial_nos:
|
||||
frappe.db.set_value("Serial No", { 'name': ['in', serial_nos] }, "batch_no", None)
|
||||
|
||||
d.batch_no = None
|
||||
d.db_set("batch_no", None)
|
||||
|
||||
for data in frappe.get_all("Batch",
|
||||
{'reference_name': self.name, 'reference_doctype': self.doctype}):
|
||||
|
||||
serial_nos = [sr.name for sr in frappe.get_all("Serial No", {'batch_no': data.name})]
|
||||
if serial_nos:
|
||||
frappe.db.set_value("Serial No", { 'name': ['in', serial_nos] }, "batch_no", None)
|
||||
|
||||
frappe.delete_doc("Batch", data.name)
|
||||
|
||||
def get_sl_entries(self, d, args):
|
||||
|
Loading…
Reference in New Issue
Block a user