#59650·erpnext

Opportunity cannot be created from Lead in non-English languages due to translated Opportunity Type

Author: RahaYadegariCreated Sep 30, 2026Updated Sep 30, 2026
Labelsbugmodule scheduled for deprecation

Information about bug

When creating an Opportunity from a Lead while using a non-English language, such as Persian, the Opportunity cannot be saved.

The issue occurs because the Opportunity Type value is translated when the Opportunity is created from the Lead.

For example:

  • Actual Opportunity Type name: Sales
  • Persian translation: فروش

When the Opportunity is created in Persian, opportunity_type is populated with the translated value فروش.

However, when the document is saved, Frappe validates the Link field against the actual name of the Opportunity Type document. Since there is no Opportunity Type record named فروش (the actual record is Sales), the save fails with a LinkValidationError.

Steps to Reproduce

  1. Set the system/user language to a non-English language, for example Persian.
  2. Create and save a new Lead.
  3. Open the Lead.
  4. Click Create → Opportunity.
  5. Create the Opportunity.
  6. Click Save.

Actual Behavior

The Opportunity fails to save with the following error:

frappe.exceptions.LinkValidationError: نوع فرصت: فروش پیدا نشد

The corresponding untranslated error is:

Could not find Opportunity Type: Sales

The opportunity_type field contains the translated value rather than the underlying Opportunity Type name.

For example:

Actual Opportunity Type name: Sales
Translated value: فروش

Expected Behavior

The opportunity_type field should always contain the actual name of the linked Opportunity Type document, regardless of the user's language.

For example:

Stored value: Sales
Displayed value: فروش

The translation should only affect the displayed label/value and should not replace the underlying Link value used for document validation.

Technical Details

In ERPNext v16, the Opportunity Type DocType has:

json
"translated_doctype": 1

Also, the Opportunity controller sets the default opportunity_type using the hard-coded value:

javascript
if (this.frm.is_new() && this.frm.doc.opportunity_type === undefined) {
    this.frm.doc.opportunity_type = "Sales";
}

When creating an Opportunity from a Lead, the Lead mapper creates the Opportunity but does not explicitly map opportunity_type.

This appears to result in an interaction between the hard-coded default value and the translated Opportunity Type DocType, causing the translated value to be used as the Link value.

Error Trace

frappe.exceptions.LinkValidationError: نوع فرصت: فروش پیدا نشد

Full traceback:

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 121, in application
    response = frappe.api.handle(request)
  File "apps/frappe/frappe/api/__init__.py", line 63, in handle
    data = endpoint(**arguments)
  File "apps/frappe/frappe/api/v1.py", line 41, in handle_rpc_call
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 53, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 86, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1147, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/utils/typing_validations.py", line 36, in wrapper
    return func(*args, **kwargs)
  File "apps/frappe/frappe/desk/form/save.py", line 43, in savedocs
    doc.save()
  File "apps/frappe/frappe/model/document.py", line 557, in save
    return self._save(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 579, in _save
    return self.insert()
  File "apps/frappe/frappe/model/document.py", line 479, in insert
    self._validate_links()
  File "apps/frappe/frappe/model/document.py", line 1221, in _validate_links
    frappe.throw(
frappe.exceptions.LinkValidationError: نوع فرصت: فروش پیدا نشد

Module

CRM

Version

ERPNext Version - 16.33.0

Installation method

No response

Relevant log output / Stack trace / Full Error Message.

bash