diff --git a/erpnext/crm/doctype/opportunity/test_opportunity.py b/erpnext/crm/doctype/opportunity/test_opportunity.py index db9866d9b89..99bb18a85d8 100644 --- a/erpnext/crm/doctype/opportunity/test_opportunity.py +++ b/erpnext/crm/doctype/opportunity/test_opportunity.py @@ -31,6 +31,7 @@ class TestOpportunity(ERPNextTestSuite): "opportunity_from": "Lead", "enquiry_type": "Sales", "party_name": cls.leads[0].name, + "company": cls.companies[0].name, "transaction_date": "2013-12-12", "items": [ {"item_name": "Test Item", "description": "Some description", "qty": 5, "rate": 100} @@ -57,7 +58,7 @@ class TestOpportunity(ERPNextTestSuite): self.assertEqual(doc.status, "Quotation") def test_make_new_lead_if_required(self): - opp_doc = make_opportunity_from_lead() + opp_doc = make_opportunity_from_lead(self.companies[0].name) self.assertTrue(opp_doc.party_name) self.assertEqual(opp_doc.opportunity_from, "Lead") @@ -101,7 +102,7 @@ class TestOpportunity(ERPNextTestSuite): create_communication(opp_doc.doctype, opp_doc.name, opp_doc.contact_email) -def make_opportunity_from_lead(): +def make_opportunity_from_lead(company): new_lead_email_id = f"new{random_string(5)}@example.com" args = { "doctype": "Opportunity", @@ -109,6 +110,7 @@ def make_opportunity_from_lead(): "opportunity_type": "Sales", "with_items": 0, "transaction_date": today(), + "company": company, } # new lead should be created against the new.opportunity@example.com opp_doc = frappe.get_doc(args).insert(ignore_permissions=True)