mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-17 16:45:02 +00:00
fix: prohibit consolidated sales invoice return (#47251)
(cherry picked from commit 483c4a3271)
Co-authored-by: Diptanil Saha <diptanil@frappe.io>
This commit is contained in:
@@ -347,6 +347,16 @@ def make_return_doc(doctype: str, source_name: str, target_doc=None, return_agai
|
||||
"Company", company, "default_warehouse_for_sales_return"
|
||||
)
|
||||
|
||||
if doctype == "Sales Invoice":
|
||||
inv_is_consolidated, inv_is_pos = frappe.db.get_value(
|
||||
"Sales Invoice", source_name, ["is_consolidated", "is_pos"]
|
||||
)
|
||||
if inv_is_consolidated and inv_is_pos:
|
||||
frappe.throw(
|
||||
_("Cannot create return for consolidated invoice {0}.").format(source_name),
|
||||
title=_("Cannot Create Return"),
|
||||
)
|
||||
|
||||
def set_missing_values(source, target):
|
||||
doc = frappe.get_doc(target)
|
||||
doc.is_return = 1
|
||||
|
||||
Reference in New Issue
Block a user