mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-04 20:59:11 +00:00
feat: Adding support for discarding document (#51316)
Co-authored-by: Nishka Gosalia <nishkagosalia@Nishkas-MacBook-Air.local>
This commit is contained in:
@@ -85,7 +85,7 @@
|
||||
"in_standard_filter": 1,
|
||||
"label": "Status",
|
||||
"no_copy": 1,
|
||||
"options": "Unsigned\nActive\nInactive"
|
||||
"options": "Unsigned\nActive\nInactive\nCancelled"
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 1,
|
||||
@@ -257,11 +257,11 @@
|
||||
"grid_page_length": 50,
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2025-06-19 17:48:45.049007",
|
||||
"modified": "2025-12-24 21:33:51.240497",
|
||||
"modified_by": "Administrator",
|
||||
"module": "CRM",
|
||||
"name": "Contract",
|
||||
"naming_rule": "Expression (old style)",
|
||||
"naming_rule": "Expression",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
|
||||
@@ -43,7 +43,7 @@ class Contract(Document):
|
||||
signed_on: DF.Datetime | None
|
||||
signee: DF.Data | None
|
||||
start_date: DF.Date | None
|
||||
status: DF.Literal["Unsigned", "Active", "Inactive"]
|
||||
status: DF.Literal["Unsigned", "Active", "Inactive", "Cancelled"]
|
||||
# end: auto-generated types
|
||||
|
||||
def validate(self):
|
||||
@@ -61,6 +61,9 @@ class Contract(Document):
|
||||
def before_submit(self):
|
||||
self.signed_by_company = frappe.session.user
|
||||
|
||||
def on_discard(self):
|
||||
self.db_set("status", "Cancelled")
|
||||
|
||||
def before_update_after_submit(self):
|
||||
self.update_contract_status()
|
||||
self.update_fulfilment_status()
|
||||
|
||||
Reference in New Issue
Block a user