mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 16:34:46 +00:00
feat: enable automatic type annotations (#38452)
(cherry picked from commit 63313eef6f)
Co-authored-by: Ankush Menat <ankush@frappe.io>
This commit is contained in:
@@ -18,6 +18,50 @@ from frappe.utils.user import is_website_user
|
||||
|
||||
|
||||
class Issue(Document):
|
||||
# begin: auto-generated types
|
||||
# This code is auto-generated. Do not modify anything in this block.
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from frappe.types import DF
|
||||
|
||||
agreement_status: DF.Literal["First Response Due", "Resolution Due", "Fulfilled", "Failed"]
|
||||
attachment: DF.Attach | None
|
||||
avg_response_time: DF.Duration | None
|
||||
company: DF.Link | None
|
||||
contact: DF.Link | None
|
||||
content_type: DF.Data | None
|
||||
customer: DF.Link | None
|
||||
customer_name: DF.Data | None
|
||||
description: DF.TextEditor | None
|
||||
email_account: DF.Link | None
|
||||
first_responded_on: DF.Datetime | None
|
||||
first_response_time: DF.Duration | None
|
||||
issue_split_from: DF.Link | None
|
||||
issue_type: DF.Link | None
|
||||
lead: DF.Link | None
|
||||
naming_series: DF.Literal["ISS-.YYYY.-"]
|
||||
on_hold_since: DF.Datetime | None
|
||||
opening_date: DF.Date | None
|
||||
opening_time: DF.Time | None
|
||||
priority: DF.Link | None
|
||||
project: DF.Link | None
|
||||
raised_by: DF.Data | None
|
||||
resolution_by: DF.Datetime | None
|
||||
resolution_date: DF.Datetime | None
|
||||
resolution_details: DF.TextEditor | None
|
||||
resolution_time: DF.Duration | None
|
||||
response_by: DF.Datetime | None
|
||||
service_level_agreement: DF.Link | None
|
||||
service_level_agreement_creation: DF.Datetime | None
|
||||
status: DF.Literal["Open", "Replied", "On Hold", "Resolved", "Closed"]
|
||||
subject: DF.Data
|
||||
total_hold_time: DF.Duration | None
|
||||
user_resolution_time: DF.Duration | None
|
||||
via_customer_portal: DF.Check
|
||||
# end: auto-generated types
|
||||
|
||||
def validate(self):
|
||||
if self.is_new() and self.via_customer_portal:
|
||||
self.flags.create_communication = True
|
||||
|
||||
@@ -6,4 +6,15 @@ from frappe.model.document import Document
|
||||
|
||||
|
||||
class IssuePriority(Document):
|
||||
# begin: auto-generated types
|
||||
# This code is auto-generated. Do not modify anything in this block.
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from frappe.types import DF
|
||||
|
||||
description: DF.SmallText | None
|
||||
# end: auto-generated types
|
||||
|
||||
pass
|
||||
|
||||
@@ -6,4 +6,15 @@ from frappe.model.document import Document
|
||||
|
||||
|
||||
class IssueType(Document):
|
||||
# begin: auto-generated types
|
||||
# This code is auto-generated. Do not modify anything in this block.
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from frappe.types import DF
|
||||
|
||||
description: DF.SmallText | None
|
||||
# end: auto-generated types
|
||||
|
||||
pass
|
||||
|
||||
@@ -7,4 +7,18 @@ from frappe.model.document import Document
|
||||
|
||||
|
||||
class PauseSLAOnStatus(Document):
|
||||
# begin: auto-generated types
|
||||
# This code is auto-generated. Do not modify anything in this block.
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from frappe.types import DF
|
||||
|
||||
parent: DF.Data
|
||||
parentfield: DF.Data
|
||||
parenttype: DF.Data
|
||||
status: DF.Literal
|
||||
# end: auto-generated types
|
||||
|
||||
pass
|
||||
|
||||
@@ -7,4 +7,20 @@ from frappe.model.document import Document
|
||||
|
||||
|
||||
class ServiceDay(Document):
|
||||
# begin: auto-generated types
|
||||
# This code is auto-generated. Do not modify anything in this block.
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from frappe.types import DF
|
||||
|
||||
end_time: DF.Time
|
||||
parent: DF.Data
|
||||
parentfield: DF.Data
|
||||
parenttype: DF.Data
|
||||
start_time: DF.Time
|
||||
workday: DF.Literal["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
|
||||
# end: auto-generated types
|
||||
|
||||
pass
|
||||
|
||||
@@ -29,6 +29,41 @@ from erpnext.support.doctype.issue.issue import get_holidays
|
||||
|
||||
|
||||
class ServiceLevelAgreement(Document):
|
||||
# begin: auto-generated types
|
||||
# This code is auto-generated. Do not modify anything in this block.
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from frappe.types import DF
|
||||
|
||||
from erpnext.support.doctype.pause_sla_on_status.pause_sla_on_status import PauseSLAOnStatus
|
||||
from erpnext.support.doctype.service_day.service_day import ServiceDay
|
||||
from erpnext.support.doctype.service_level_priority.service_level_priority import (
|
||||
ServiceLevelPriority,
|
||||
)
|
||||
from erpnext.support.doctype.sla_fulfilled_on_status.sla_fulfilled_on_status import (
|
||||
SLAFulfilledOnStatus,
|
||||
)
|
||||
|
||||
apply_sla_for_resolution: DF.Check
|
||||
condition: DF.Code | None
|
||||
default_priority: DF.Link | None
|
||||
default_service_level_agreement: DF.Check
|
||||
document_type: DF.Link
|
||||
enabled: DF.Check
|
||||
end_date: DF.Date | None
|
||||
entity: DF.DynamicLink | None
|
||||
entity_type: DF.Literal["", "Customer", "Customer Group", "Territory"]
|
||||
holiday_list: DF.Link
|
||||
pause_sla_on: DF.Table[PauseSLAOnStatus]
|
||||
priorities: DF.Table[ServiceLevelPriority]
|
||||
service_level: DF.Data
|
||||
sla_fulfilled_on: DF.Table[SLAFulfilledOnStatus]
|
||||
start_date: DF.Date | None
|
||||
support_and_resolution: DF.Table[ServiceDay]
|
||||
# end: auto-generated types
|
||||
|
||||
def validate(self):
|
||||
self.validate_selected_doctype()
|
||||
self.validate_doc()
|
||||
|
||||
@@ -7,4 +7,21 @@ from frappe.model.document import Document
|
||||
|
||||
|
||||
class ServiceLevelPriority(Document):
|
||||
# begin: auto-generated types
|
||||
# This code is auto-generated. Do not modify anything in this block.
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from frappe.types import DF
|
||||
|
||||
default_priority: DF.Check
|
||||
parent: DF.Data
|
||||
parentfield: DF.Data
|
||||
parenttype: DF.Data
|
||||
priority: DF.Link
|
||||
resolution_time: DF.Duration | None
|
||||
response_time: DF.Duration
|
||||
# end: auto-generated types
|
||||
|
||||
pass
|
||||
|
||||
@@ -6,4 +6,18 @@ from frappe.model.document import Document
|
||||
|
||||
|
||||
class SLAFulfilledOnStatus(Document):
|
||||
# begin: auto-generated types
|
||||
# This code is auto-generated. Do not modify anything in this block.
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from frappe.types import DF
|
||||
|
||||
parent: DF.Data
|
||||
parentfield: DF.Data
|
||||
parenttype: DF.Data
|
||||
status: DF.Literal
|
||||
# end: auto-generated types
|
||||
|
||||
pass
|
||||
|
||||
@@ -6,4 +6,31 @@ from frappe.model.document import Document
|
||||
|
||||
|
||||
class SupportSearchSource(Document):
|
||||
# begin: auto-generated types
|
||||
# This code is auto-generated. Do not modify anything in this block.
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from frappe.types import DF
|
||||
|
||||
base_url: DF.Data | None
|
||||
parent: DF.Data
|
||||
parentfield: DF.Data
|
||||
parenttype: DF.Data
|
||||
post_description_key: DF.Data | None
|
||||
post_route: DF.Data | None
|
||||
post_route_key_list: DF.Data | None
|
||||
post_title_key: DF.Data | None
|
||||
query_route: DF.Data | None
|
||||
response_result_key_path: DF.Data | None
|
||||
result_preview_field: DF.Data | None
|
||||
result_route_field: DF.Data | None
|
||||
result_title_field: DF.Data | None
|
||||
search_term_param_name: DF.Data | None
|
||||
source_doctype: DF.Link | None
|
||||
source_name: DF.Data | None
|
||||
source_type: DF.Literal["API", "Link"]
|
||||
# end: auto-generated types
|
||||
|
||||
pass
|
||||
|
||||
@@ -6,4 +6,33 @@ from frappe.model.document import Document
|
||||
|
||||
|
||||
class SupportSettings(Document):
|
||||
# begin: auto-generated types
|
||||
# This code is auto-generated. Do not modify anything in this block.
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from frappe.types import DF
|
||||
|
||||
from erpnext.support.doctype.support_search_source.support_search_source import (
|
||||
SupportSearchSource,
|
||||
)
|
||||
|
||||
allow_resetting_service_level_agreement: DF.Check
|
||||
close_issue_after_days: DF.Int
|
||||
forum_url: DF.Data | None
|
||||
get_latest_query: DF.Data | None
|
||||
get_started_sections: DF.Code | None
|
||||
greeting_subtitle: DF.Data | None
|
||||
greeting_title: DF.Data | None
|
||||
post_description_key: DF.Data | None
|
||||
post_route_key: DF.Data | None
|
||||
post_route_string: DF.Data | None
|
||||
post_title_key: DF.Data | None
|
||||
response_key_list: DF.Data | None
|
||||
search_apis: DF.Table[SupportSearchSource]
|
||||
show_latest_forum_posts: DF.Check
|
||||
track_service_level_agreement: DF.Check
|
||||
# end: auto-generated types
|
||||
|
||||
pass
|
||||
|
||||
@@ -10,6 +10,47 @@ from erpnext.utilities.transaction_base import TransactionBase
|
||||
|
||||
|
||||
class WarrantyClaim(TransactionBase):
|
||||
# begin: auto-generated types
|
||||
# This code is auto-generated. Do not modify anything in this block.
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from frappe.types import DF
|
||||
|
||||
address_display: DF.SmallText | None
|
||||
amc_expiry_date: DF.Date | None
|
||||
amended_from: DF.Link | None
|
||||
company: DF.Link
|
||||
complaint: DF.TextEditor
|
||||
complaint_date: DF.Date
|
||||
complaint_raised_by: DF.Data | None
|
||||
contact_display: DF.SmallText | None
|
||||
contact_email: DF.Data | None
|
||||
contact_mobile: DF.Data | None
|
||||
contact_person: DF.Link | None
|
||||
customer: DF.Link
|
||||
customer_address: DF.Link | None
|
||||
customer_group: DF.Link | None
|
||||
customer_name: DF.Data | None
|
||||
description: DF.SmallText | None
|
||||
from_company: DF.Data | None
|
||||
item_code: DF.Link | None
|
||||
item_name: DF.Data | None
|
||||
naming_series: DF.Literal["SER-WRN-.YYYY.-"]
|
||||
resolution_date: DF.Datetime | None
|
||||
resolution_details: DF.Text | None
|
||||
resolved_by: DF.Link | None
|
||||
serial_no: DF.Link | None
|
||||
service_address: DF.SmallText | None
|
||||
status: DF.Literal["", "Open", "Closed", "Work In Progress", "Cancelled"]
|
||||
territory: DF.Link | None
|
||||
warranty_amc_status: DF.Literal[
|
||||
"", "Under Warranty", "Out of Warranty", "Under AMC", "Out of AMC"
|
||||
]
|
||||
warranty_expiry_date: DF.Date | None
|
||||
# end: auto-generated types
|
||||
|
||||
def validate(self):
|
||||
if session["user"] != "Guest" and not self.customer:
|
||||
frappe.throw(_("Customer is required"))
|
||||
|
||||
Reference in New Issue
Block a user