diff --git a/erpnext/crm/doctype/opportunity/test_opportunity.py b/erpnext/crm/doctype/opportunity/test_opportunity.py index 4add7c4074a..3a63147f384 100644 --- a/erpnext/crm/doctype/opportunity/test_opportunity.py +++ b/erpnext/crm/doctype/opportunity/test_opportunity.py @@ -29,6 +29,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} @@ -55,7 +56,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") @@ -99,7 +100,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", @@ -107,6 +108,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)