Merge pull request #48151 from khushi8112/duplicate-naming-issue-in-contract-doctype
fix: duplicate naming issue in contract doctype
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
"actions": [],
|
"actions": [],
|
||||||
"allow_import": 1,
|
"allow_import": 1,
|
||||||
"allow_rename": 1,
|
"allow_rename": 1,
|
||||||
|
"autoname": "CON-.YYYY.-.#####",
|
||||||
"creation": "2018-04-12 06:32:04.582486",
|
"creation": "2018-04-12 06:32:04.582486",
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"editable_grid": 1,
|
"editable_grid": 1,
|
||||||
@@ -256,10 +257,11 @@
|
|||||||
"grid_page_length": 50,
|
"grid_page_length": 50,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2025-05-23 13:54:03.346537",
|
"modified": "2025-06-19 17:48:45.049007",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "CRM",
|
"module": "CRM",
|
||||||
"name": "Contract",
|
"name": "Contract",
|
||||||
|
"naming_rule": "Expression (old style)",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [
|
"permissions": [
|
||||||
{
|
{
|
||||||
@@ -324,10 +326,12 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"row_format": "Dynamic",
|
"row_format": "Dynamic",
|
||||||
|
"search_fields": "party_type, party_name, contract_template",
|
||||||
"show_name_in_global_search": 1,
|
"show_name_in_global_search": 1,
|
||||||
"sort_field": "creation",
|
"sort_field": "creation",
|
||||||
"sort_order": "DESC",
|
"sort_order": "DESC",
|
||||||
"states": [],
|
"states": [],
|
||||||
|
"title_field": "party_name",
|
||||||
"track_changes": 1,
|
"track_changes": 1,
|
||||||
"track_seen": 1
|
"track_seen": 1
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,19 +46,6 @@ class Contract(Document):
|
|||||||
status: DF.Literal["Unsigned", "Active", "Inactive"]
|
status: DF.Literal["Unsigned", "Active", "Inactive"]
|
||||||
# end: auto-generated types
|
# end: auto-generated types
|
||||||
|
|
||||||
def autoname(self):
|
|
||||||
name = self.party_name
|
|
||||||
|
|
||||||
if self.contract_template:
|
|
||||||
name += f" - {self.contract_template} Agreement"
|
|
||||||
|
|
||||||
# If identical, append contract name with the next number in the iteration
|
|
||||||
if frappe.db.exists("Contract", name):
|
|
||||||
count = len(frappe.get_all("Contract", filters={"name": ["like", f"%{name}%"]}))
|
|
||||||
name = f"{name} - {count}"
|
|
||||||
|
|
||||||
self.name = _(name)
|
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
self.set_missing_values()
|
self.set_missing_values()
|
||||||
self.validate_dates()
|
self.validate_dates()
|
||||||
|
|||||||
Reference in New Issue
Block a user