fix: don't add template item in sales/purchase transaction
This commit is contained in:
parent
6b31c27ed6
commit
2c83fff1a1
@ -889,6 +889,11 @@ class TestPurchaseOrder(FrappeTestCase):
|
|||||||
self.assertEqual(po.status, "Completed")
|
self.assertEqual(po.status, "Completed")
|
||||||
self.assertEqual(mr.status, "Received")
|
self.assertEqual(mr.status, "Received")
|
||||||
|
|
||||||
|
def test_variant_item_po(self):
|
||||||
|
po = create_purchase_order(item_code="_Test Variant Item", qty=1, rate=100, do_not_save=1)
|
||||||
|
|
||||||
|
self.assertRaises(frappe.ValidationError, po.save)
|
||||||
|
|
||||||
|
|
||||||
def prepare_data_for_internal_transfer():
|
def prepare_data_for_internal_transfer():
|
||||||
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_internal_supplier
|
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_internal_supplier
|
||||||
@ -994,8 +999,8 @@ def create_purchase_order(**args):
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
po.set_missing_values()
|
|
||||||
if not args.do_not_save:
|
if not args.do_not_save:
|
||||||
|
po.set_missing_values()
|
||||||
po.insert()
|
po.insert()
|
||||||
if not args.do_not_submit:
|
if not args.do_not_submit:
|
||||||
if po.is_subcontracted:
|
if po.is_subcontracted:
|
||||||
|
@ -236,8 +236,10 @@ def validate_item_details(args, item):
|
|||||||
|
|
||||||
validate_end_of_life(item.name, item.end_of_life, item.disabled)
|
validate_end_of_life(item.name, item.end_of_life, item.disabled)
|
||||||
|
|
||||||
if args.transaction_type == "selling" and cint(item.has_variants):
|
if cint(item.has_variants):
|
||||||
throw(_("Item {0} is a template, please select one of its variants").format(item.name))
|
msg = f"Item {item.name} is a template, please select one of its variants"
|
||||||
|
|
||||||
|
throw(_(msg), title=_("Template Item Selected"))
|
||||||
|
|
||||||
elif args.transaction_type == "buying" and args.doctype != "Material Request":
|
elif args.transaction_type == "buying" and args.doctype != "Material Request":
|
||||||
if args.get("is_subcontracted"):
|
if args.get("is_subcontracted"):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user