mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-02 21:18:27 +00:00
fix: Autoname for customer and supplier (#27505)
* fix: Autoname for customer and supplier (#27398)
(cherry picked from commit 759f2b7920)
# Conflicts:
# erpnext/selling/doctype/selling_settings/selling_settings.json
* fix: Resolve conflicts
Co-authored-by: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com>
This commit is contained in:
@@ -28,7 +28,7 @@
|
|||||||
"fieldname": "supp_master_name",
|
"fieldname": "supp_master_name",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"label": "Supplier Naming By",
|
"label": "Supplier Naming By",
|
||||||
"options": "Supplier Name\nNaming Series"
|
"options": "Supplier Name\nNaming Series\nAuto Name"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "supplier_group",
|
"fieldname": "supplier_group",
|
||||||
@@ -123,7 +123,7 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-06-24 10:38:28.934525",
|
"modified": "2021-09-08 19:26:23.548837",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Buying",
|
"module": "Buying",
|
||||||
"name": "Buying Settings",
|
"name": "Buying Settings",
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ from frappe.contacts.address_and_contact import (
|
|||||||
delete_contact_and_address,
|
delete_contact_and_address,
|
||||||
load_address_and_contact,
|
load_address_and_contact,
|
||||||
)
|
)
|
||||||
from frappe.model.naming import set_name_by_naming_series
|
from frappe.model.naming import set_name_by_naming_series, set_name_from_naming_options
|
||||||
|
|
||||||
from erpnext.accounts.party import get_dashboard_info, validate_party_accounts
|
from erpnext.accounts.party import get_dashboard_info, validate_party_accounts
|
||||||
from erpnext.utilities.transaction_base import TransactionBase
|
from erpnext.utilities.transaction_base import TransactionBase
|
||||||
@@ -40,8 +40,10 @@ class Supplier(TransactionBase):
|
|||||||
supp_master_name = frappe.defaults.get_global_default('supp_master_name')
|
supp_master_name = frappe.defaults.get_global_default('supp_master_name')
|
||||||
if supp_master_name == 'Supplier Name':
|
if supp_master_name == 'Supplier Name':
|
||||||
self.name = self.supplier_name
|
self.name = self.supplier_name
|
||||||
else:
|
elif supp_master_name == 'Naming Series':
|
||||||
set_name_by_naming_series(self)
|
set_name_by_naming_series(self)
|
||||||
|
else:
|
||||||
|
self.name = set_name_from_naming_options(frappe.get_meta(self.doctype).autoname, self)
|
||||||
|
|
||||||
def on_update(self):
|
def on_update(self):
|
||||||
if not self.naming_series:
|
if not self.naming_series:
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ from frappe.contacts.address_and_contact import (
|
|||||||
)
|
)
|
||||||
from frappe.desk.reportview import build_match_conditions, get_filters_cond
|
from frappe.desk.reportview import build_match_conditions, get_filters_cond
|
||||||
from frappe.model.mapper import get_mapped_doc
|
from frappe.model.mapper import get_mapped_doc
|
||||||
from frappe.model.naming import set_name_by_naming_series
|
from frappe.model.naming import set_name_by_naming_series, set_name_from_naming_options
|
||||||
from frappe.model.rename_doc import update_linked_doctypes
|
from frappe.model.rename_doc import update_linked_doctypes
|
||||||
from frappe.utils import cint, cstr, flt, get_formatted_email, today
|
from frappe.utils import cint, cstr, flt, get_formatted_email, today
|
||||||
from frappe.utils.user import get_users_with_role
|
from frappe.utils.user import get_users_with_role
|
||||||
@@ -40,8 +40,10 @@ class Customer(TransactionBase):
|
|||||||
cust_master_name = frappe.defaults.get_global_default('cust_master_name')
|
cust_master_name = frappe.defaults.get_global_default('cust_master_name')
|
||||||
if cust_master_name == 'Customer Name':
|
if cust_master_name == 'Customer Name':
|
||||||
self.name = self.get_customer_name()
|
self.name = self.get_customer_name()
|
||||||
else:
|
elif cust_master_name == 'Naming Series':
|
||||||
set_name_by_naming_series(self)
|
set_name_by_naming_series(self)
|
||||||
|
else:
|
||||||
|
self.name = set_name_from_naming_options(frappe.get_meta(self.doctype).autoname, self)
|
||||||
|
|
||||||
def get_customer_name(self):
|
def get_customer_name(self):
|
||||||
|
|
||||||
|
|||||||
@@ -41,14 +41,14 @@
|
|||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "Customer Naming By",
|
"label": "Customer Naming By",
|
||||||
"options": "Customer Name\nNaming Series"
|
"options": "Customer Name\nNaming Series\nAuto Name"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "campaign_naming_by",
|
"fieldname": "campaign_naming_by",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "Campaign Naming By",
|
"label": "Campaign Naming By",
|
||||||
"options": "Campaign Name\nNaming Series"
|
"options": "Campaign Name\nNaming Series\nAuto Name"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "customer_group",
|
"fieldname": "customer_group",
|
||||||
@@ -205,7 +205,7 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-09-06 22:05:06.139820",
|
"modified": "2021-09-08 19:38:10.175989",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Selling",
|
"module": "Selling",
|
||||||
"name": "Selling Settings",
|
"name": "Selling Settings",
|
||||||
@@ -224,4 +224,4 @@
|
|||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
"sort_order": "DESC",
|
"sort_order": "DESC",
|
||||||
"track_changes": 1
|
"track_changes": 1
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user