1
0
forked from test/crm

fix: create quotation

(cherry picked from commit 940e8d24c7e1ded869555cbc326a6927eb68455f)
This commit is contained in:
Pratik Badhe 2025-08-08 08:22:33 +00:00 committed by Mergify
parent 4500595a75
commit 277cebfe7b

View File

@ -128,14 +128,35 @@ def get_quotation_url(crm_deal, organization):
address = address.get("name") if address else None
if not erpnext_crm_settings.is_erpnext_in_different_site:
quotation_url = get_url_to_list("Quotation")
return f"{quotation_url}/new?quotation_to=CRM Deal&crm_deal={crm_deal}&party_name={crm_deal}&company={erpnext_crm_settings.erpnext_company}&contact_person={contact}&customer_address={address}"
base_url = f"{get_url_to_list('Quotation')}/new"
params = {
"quotation_to": "CRM Deal",
"crm_deal": crm_deal,
"party_name": crm_deal,
"company": erpnext_crm_settings.erpnext_company,
"contact_person": contact,
"customer_address": address
}
else:
site_url = erpnext_crm_settings.get("erpnext_site_url")
quotation_url = f"{site_url}/app/quotation"
base_url = f"{site_url}/app/quotation/new"
prospect = create_prospect_in_remote_site(crm_deal, erpnext_crm_settings)
return f"{quotation_url}/new?quotation_to=Prospect&crm_deal={crm_deal}&party_name={prospect}&company={erpnext_crm_settings.erpnext_company}&contact_person={contact}&customer_address={address}"
params = {
"quotation_to": "Prospect",
"crm_deal": crm_deal,
"party_name": prospect,
"company": erpnext_crm_settings.erpnext_company,
"contact_person": contact,
"customer_address": address
}
# Filter out None values and build query string
query_string = "&".join(
f"{key}={value}" for key, value in params.items()
if value is not None
)
return f"{base_url}?{query_string}"
def create_prospect_in_remote_site(crm_deal, erpnext_crm_settings):