CRM

CRM

Frappe CRM ERPNext Integration

Connect Frappe CRM to ERPNext to create quotations and customers from your deals, and to use your ERPNext items as products in the CRM.

With the integration on, you can:

  • Create a quotation in ERPNext from a deal, with the deal's products already filled in.
  • See every quotation for a deal in the deal's Quotations tab.
  • Create a customer in ERPNext when a deal is won.
  • Use your ERPNext items and prices as products in the CRM.

ERPNext can be installed on the same site as Frappe CRM or on a different site. Everything on this page works when both are on the same site. When ERPNext is on a different site, you can create quotations and customers, but product sync, the Logs tab and the products on quotations don't work.

Before you start

Only Sales Managers and System Managers can see the ERPNext settings in the CRM.

On your ERPNext site, turn on data sync for Frappe CRM:

  1. Go to CRM Settings in ERPNext.
  2. In the Frappe CRM section, check Enable Frappe CRM Data Synchronization.
  3. If ERPNext is on a different site, add the user whose API key you'll use to Allowed Users. If it's on the same site, leave Allowed Users empty.
  4. Save.

If you skip this, the CRM can't create customers in ERPNext.

Turning on Frappe CRM data sync in ERPNext

Connect ERPNext

ERPNext on the same site

  1. In the CRM, click your name at the top left and open Settings.
  2. Under Integrations, click ERPNext, then click Enable.
  3. In Company Name, choose the ERPNext company to connect.
  4. Click Update.

Connecting ERPNext in CRM Settings

Your ERPNext items are added to the CRM as products in the background. To add them right away, click Sync Now.

ERPNext on a different site

  1. In the CRM, click your name at the top left and open Settings.
  2. Under Integrations, click ERPNext, then click Enable.
  3. Enter the Site URL of your ERPNext site, and the API Key and API Secret of a user on that site.
  4. Click Verify Connection.
  5. In Company Name, choose the ERPNext company to connect.
  6. Click Update.

Settings

Clicking Sync Now in the ERPNext settings

  • Company Name: the ERPNext company that quotations and customers are created in.
  • Bidirectional Product Sync: ERPNext items always sync to CRM products. With this on, changes you make to a product in the CRM also go back to its ERPNext item. It's on by default. See Products and prices below.
  • Manual Sync: click Sync Now to sync items and products right away.
  • Auto Create Customer: creates a customer in ERPNext when a deal reaches the status you choose in Deal Status, for example "Won". It's off by default.

The Logs tab shows your recently changed CRM products and ERPNext items. Failed Logs lists CRM products whose ERPNext item was deleted.

Logs tab

Create a quotation

On a deal, click Create Quotation. A new quotation opens in ERPNext in a new tab, with these filled in:

  • Quotation To: the deal's customer if it already has one, otherwise the deal itself. When ERPNext is on a different site, it's a prospect named after the deal's organization.
  • The deal's primary contact and organization address.
  • The deal's products, with their quantity, rate and discount. This only works on the same site, and only for products linked to an ERPNext item.

Check the quotation and save it in ERPNext.

Creating a quotation from a deal

The button only shows if you're allowed to create quotations in ERPNext.

See a deal's quotations

The Quotations tab on a deal lists every quotation made for it, with its status, total and valid-till date. Click a quotation to open it in ERPNext.

Quotations tab on a deal

Create a customer when a deal is won

Turn on Auto Create Customer in the ERPNext settings and choose a Deal Status, such as "Won". When a deal reaches that status, the CRM creates a customer in ERPNext:

  • The customer is named after the deal's organization, with the type Company. If the deal has no organization, it's named after the primary contact, with the type Individual.
  • The deal's contacts and the organization's address are linked to the customer.
  • Territory, currency, industry and website are copied from the deal. Territory and industry are left out if they don't exist in ERPNext.
  • If a customer with the same name already exists, the CRM uses it instead of creating a new one.

Marking a deal as Won creates the customer

The person who changes the status needs permission to create customers in ERPNext. If they don't have it, the deal isn't saved.

After you reload the deal, a View Customer button opens the customer in ERPNext.

View Customer on a won deal

When ERPNext is on the same site, a customer is also created when you make a sales order from the deal's quotation in ERPNext, even if Auto Create Customer is off.

Products and prices

This section only applies when ERPNext is on the same site.

ERPNext items and CRM products stay in sync, with ERPNext as the main copy:

  • When you create an item in ERPNext, a matching CRM product is created.
  • When you edit an item, its CRM product gets the new name, rate, image, description and disabled status.
  • When you rename or delete an item, its CRM product is renamed or deleted too.
  • Permissions and shares on an item are copied to its CRM product, so people see the same products in the CRM as in ERPNext.

With Bidirectional Product Sync on:

  • Editing or renaming a CRM product updates its ERPNext item.
  • New products have to be created as items in ERPNext. If you try to create one in the CRM, it asks you to create an item instead.
  • Deleting a CRM product doesn't delete its item. You can't delete a product whose item is used on a quotation.

When you add a product to a deal, its rate comes from ERPNext. The CRM uses the customer's price list, or the default selling price list if the deal has no customer. If the item has no price there, it uses the product's standard rate.

Adding a product to a deal, priced from ERPNext

Turning on the integration lets the Sales User and Sales Manager roles create and edit items in ERPNext.

Change the deal buttons

The Create Quotation and View Customer buttons come from a standard form script called Create Quotation from CRM Deal. It's added when you turn on the integration.

You can't edit a standard script. To change the buttons, for example to show Create Quotation only at certain deal statuses:

  1. In the desk, go to CRM Form Script and open Create Quotation from CRM Deal.
  2. Click Disable.
  3. From the ... menu, click Duplicate. Name the copy, click Enable, make your changes and save it.

Only System Managers can create and edit form scripts. If you disable the standard script, both buttons disappear unless your copy adds them back. To restore the standard script, click Reset ERPNext Form Script on the ERPNext CRM Settings page in the desk.

Disabling the standard script and duplicating it

This example shows Create Quotation only for deals in Qualification, Proposal/Quotation or Negotiation, and adds a Copy Deal Link button:

class CRMDeal {
	onLoad() {
		if (this.doc.__newDocument) return
		call("frappe.client.get_single_value", {
			doctype: "ERPNext CRM Settings",
			field: "enabled",
		}).then((enabled) => {
			if (enabled) this.doc.trigger("setActions")
		})
	}
	setActions() {
		const allowed = ["Qualification", "Proposal/Quotation", "Negotiation"]
		if (allowed.includes(this.doc.status)) {
			this.actions.push({
				label: __("Create Quotation"),
				onClick: () => {
					call(
						"crm.fcrm.doctype.erpnext_crm_settings.erpnext_crm_settings.get_quotation_url",
						{ crm_deal: this.doc.name, organization: this.doc.organization }
					)
						.then((url) => {
							if (url) window.open(url, "_blank")
							else toast.error(__("Error while creating quotation"))
						})
						.catch((e) => toast.error(e.messages?.[0] || __("Error while creating quotation")))
				},
			})
		}
		this.actions.push({
			label: __("Copy Deal Link"),
			onClick: () => {
				navigator.clipboard.writeText(window.location.href)
				toast.success(__("Deal link copied"))
			},
		})
	}
}

This example doesn't include View Customer. To keep it, copy that part from the standard script.

Last updated 1 week ago
Was this helpful?
Thanks!