mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-22 14:39:19 +00:00
fix: system was allowing credit notes with serial numbers for any customer
This commit is contained in:
@@ -409,6 +409,10 @@ class SerialBatchBundle:
|
||||
]:
|
||||
status = "Consumed"
|
||||
|
||||
customer = None
|
||||
if sle.voucher_type in ["Sales Invoice", "Delivery Note"] and sle.actual_qty < 0:
|
||||
customer = frappe.get_cached_value(sle.voucher_type, sle.voucher_no, "customer")
|
||||
|
||||
sn_table = frappe.qb.DocType("Serial No")
|
||||
|
||||
query = (
|
||||
@@ -419,10 +423,11 @@ class SerialBatchBundle:
|
||||
"Active"
|
||||
if warehouse
|
||||
else status
|
||||
if (sn_table.purchase_document_no != sle.voucher_no and sle.is_cancelled != 1)
|
||||
if (sn_table.purchase_document_no != sle.voucher_no or sle.is_cancelled != 1)
|
||||
else "Inactive",
|
||||
)
|
||||
.set(sn_table.company, sle.company)
|
||||
.set(sn_table.customer, customer)
|
||||
.where(sn_table.name.isin(serial_nos))
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user