fix: disallow mulitple SO with same PO No
This commit is contained in:
parent
b0c79a0467
commit
dbd3fdbb41
@ -108,16 +108,24 @@ class SalesOrder(SellingController):
|
|||||||
and customer = %s",
|
and customer = %s",
|
||||||
(self.po_no, self.name, self.customer),
|
(self.po_no, self.name, self.customer),
|
||||||
)
|
)
|
||||||
if (
|
if so and so[0][0]:
|
||||||
so
|
if cint(
|
||||||
and so[0][0]
|
|
||||||
and not cint(
|
|
||||||
frappe.db.get_single_value("Selling Settings", "allow_against_multiple_purchase_orders")
|
frappe.db.get_single_value("Selling Settings", "allow_against_multiple_purchase_orders")
|
||||||
)
|
|
||||||
):
|
):
|
||||||
frappe.msgprint(
|
frappe.msgprint(
|
||||||
_("Warning: Sales Order {0} already exists against Customer's Purchase Order {1}").format(
|
_("Warning: Sales Order {0} already exists against Customer's Purchase Order {1}").format(
|
||||||
so[0][0], self.po_no
|
frappe.bold(so[0][0]), frappe.bold(self.po_no)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
frappe.throw(
|
||||||
|
_(
|
||||||
|
"Sales Order {0} already exists against Customer's Purchase Order {1}. To allow multiple Sales Orders, Enable {2} in {3}"
|
||||||
|
).format(
|
||||||
|
frappe.bold(so[0][0]),
|
||||||
|
frappe.bold(self.po_no),
|
||||||
|
frappe.bold(_("'Allow Multiple Sales Orders Against a Customer's Purchase Order'")),
|
||||||
|
get_link_to_form("Selling Settings", "Selling Settings"),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user