feat: enable automatic type annotations (backport #38452) (#38454)

feat: enable automatic type annotations (#38452)

(cherry picked from commit 63313eef6f)

Co-authored-by: Ankush Menat <ankush@frappe.io>
This commit is contained in:
mergify[bot]
2023-11-30 14:43:16 +05:30
committed by GitHub
parent 7f4d2b707a
commit 5e6a4d257e
485 changed files with 12920 additions and 0 deletions

View File

@@ -14,6 +14,26 @@ from frappe.utils.verified_command import get_signed_params
class Appointment(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
appointment_with: DF.Link | None
calendar_event: DF.Link | None
customer_details: DF.LongText | None
customer_email: DF.Data
customer_name: DF.Data
customer_phone_number: DF.Data | None
customer_skype: DF.Data | None
party: DF.DynamicLink | None
scheduled_time: DF.Datetime
status: DF.Literal["Open", "Unverified", "Closed"]
# end: auto-generated types
def find_lead_by_email(self):
lead_list = frappe.get_list(
"Lead", filters={"email_id": self.customer_email}, ignore_permissions=True

View File

@@ -10,6 +10,32 @@ from frappe.model.document import Document
class AppointmentBookingSettings(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.automation.doctype.assignment_rule_user.assignment_rule_user import (
AssignmentRuleUser,
)
from frappe.types import DF
from erpnext.crm.doctype.appointment_booking_slots.appointment_booking_slots import (
AppointmentBookingSlots,
)
advance_booking_days: DF.Int
agent_list: DF.TableMultiSelect[AssignmentRuleUser]
appointment_duration: DF.Int
availability_of_slots: DF.Table[AppointmentBookingSlots]
email_reminders: DF.Check
enable_scheduling: DF.Check
holiday_list: DF.Link
number_of_agents: DF.Int
success_redirect_url: DF.Data | None
# end: auto-generated types
agent_list = [] # Hack
min_date = "01/01/1970 "
format_string = "%d/%m/%Y %H:%M:%S"

View File

@@ -7,4 +7,22 @@ from frappe.model.document import Document
class AppointmentBookingSlots(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
day_of_week: DF.Literal[
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
]
from_time: DF.Time
parent: DF.Data
parentfield: DF.Data
parenttype: DF.Data
to_time: DF.Time
# end: auto-generated types
pass

View File

@@ -7,4 +7,22 @@ from frappe.model.document import Document
class AvailabilityOfSlots(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
day_of_week: DF.Literal[
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
]
from_time: DF.Time
parent: DF.Data
parentfield: DF.Data
parenttype: DF.Data
to_time: DF.Time
# end: auto-generated types
pass

View File

@@ -7,6 +7,24 @@ from frappe.model.naming import set_name_by_naming_series
class Campaign(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.crm.doctype.campaign_email_schedule.campaign_email_schedule import (
CampaignEmailSchedule,
)
campaign_name: DF.Data
campaign_schedules: DF.Table[CampaignEmailSchedule]
description: DF.Text | None
naming_series: DF.Literal["SAL-CAM-.YYYY.-"]
# end: auto-generated types
def autoname(self):
if frappe.defaults.get_global_default("campaign_naming_by") != "Naming Series":
self.name = self.campaign_name

View File

@@ -7,4 +7,19 @@ from frappe.model.document import Document
class CampaignEmailSchedule(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
email_template: DF.Link
parent: DF.Data
parentfield: DF.Data
parenttype: DF.Data
send_after_days: DF.Int
# end: auto-generated types
pass

View File

@@ -6,4 +6,16 @@ from frappe.model.document import Document
class Competitor(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
competitor_name: DF.Data
website: DF.Data | None
# end: auto-generated types
pass

View File

@@ -6,4 +6,18 @@ from frappe.model.document import Document
class CompetitorDetail(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
competitor: DF.Link
parent: DF.Data
parentfield: DF.Data
parenttype: DF.Data
# end: auto-generated types
pass

View File

@@ -9,6 +9,42 @@ from frappe.utils import getdate, nowdate
class Contract(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.crm.doctype.contract_fulfilment_checklist.contract_fulfilment_checklist import (
ContractFulfilmentChecklist,
)
amended_from: DF.Link | None
contract_template: DF.Link | None
contract_terms: DF.TextEditor
document_name: DF.DynamicLink | None
document_type: DF.Literal[
"", "Quotation", "Project", "Sales Order", "Purchase Order", "Sales Invoice", "Purchase Invoice"
]
end_date: DF.Date | None
fulfilment_deadline: DF.Date | None
fulfilment_status: DF.Literal["N/A", "Unfulfilled", "Partially Fulfilled", "Fulfilled", "Lapsed"]
fulfilment_terms: DF.Table[ContractFulfilmentChecklist]
ip_address: DF.Data | None
is_signed: DF.Check
party_name: DF.DynamicLink
party_type: DF.Literal["Customer", "Supplier", "Employee"]
party_user: DF.Link | None
requires_fulfilment: DF.Check
signed_by_company: DF.Link | None
signed_on: DF.Datetime | None
signee: DF.Data | None
start_date: DF.Date | None
status: DF.Literal["Unsigned", "Active", "Inactive"]
# end: auto-generated types
def autoname(self):
name = self.party_name

View File

@@ -6,4 +6,21 @@ from frappe.model.document import Document
class ContractFulfilmentChecklist(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
amended_from: DF.Link | None
fulfilled: DF.Check
notes: DF.Text | None
parent: DF.Data
parentfield: DF.Data
parenttype: DF.Data
requirement: DF.Data | None
# end: auto-generated types
pass

View File

@@ -10,6 +10,24 @@ from frappe.utils.jinja import validate_template
class ContractTemplate(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.crm.doctype.contract_template_fulfilment_terms.contract_template_fulfilment_terms import (
ContractTemplateFulfilmentTerms,
)
contract_terms: DF.TextEditor | None
fulfilment_terms: DF.Table[ContractTemplateFulfilmentTerms]
requires_fulfilment: DF.Check
title: DF.Data | None
# end: auto-generated types
def validate(self):
if self.contract_terms:
validate_template(self.contract_terms)

View File

@@ -6,4 +6,18 @@ from frappe.model.document import Document
class ContractTemplateFulfilmentTerms(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
requirement: DF.Data | None
# end: auto-generated types
pass

View File

@@ -6,4 +6,21 @@ from frappe.model.document import Document
class CRMNote(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
added_by: DF.Link | None
added_on: DF.Datetime | None
name: DF.Int | None
note: DF.TextEditor | None
parent: DF.Data
parentfield: DF.Data
parenttype: DF.Data
# end: auto-generated types
pass

View File

@@ -6,5 +6,21 @@ from frappe.model.document import Document
class CRMSettings(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
allow_lead_duplication_based_on_emails: DF.Check
auto_creation_of_contact: DF.Check
campaign_naming_by: DF.Literal["Campaign Name", "Naming Series"]
carry_forward_communication_and_comments: DF.Check
close_opportunity_after_days: DF.Int
default_valid_till: DF.Data | None
# end: auto-generated types
def validate(self):
frappe.db.set_default("campaign_naming_by", self.get("campaign_naming_by", ""))

View File

@@ -10,6 +10,23 @@ from frappe.utils import add_days, getdate, today
class EmailCampaign(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
campaign_name: DF.Link
email_campaign_for: DF.Literal["", "Lead", "Contact", "Email Group"]
end_date: DF.Date | None
recipient: DF.DynamicLink
sender: DF.Link | None
start_date: DF.Date
status: DF.Literal["", "Scheduled", "In Progress", "Completed", "Unsubscribed"]
# end: auto-generated types
def validate(self):
self.set_date()
# checking if email is set for lead. Not checking for contact as email is a mandatory field for contact.

View File

@@ -17,6 +17,72 @@ from erpnext.crm.utils import CRMNote, copy_comments, link_communications, link_
class Lead(SellingController, CRMNote):
# 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.crm.doctype.crm_note.crm_note import CRMNote
annual_revenue: DF.Currency
blog_subscriber: DF.Check
campaign_name: DF.Link | None
city: DF.Data | None
company: DF.Link | None
company_name: DF.Data | None
country: DF.Link | None
customer: DF.Link | None
disabled: DF.Check
email_id: DF.Data | None
fax: DF.Data | None
first_name: DF.Data | None
gender: DF.Link | None
image: DF.AttachImage | None
industry: DF.Link | None
job_title: DF.Data | None
language: DF.Link | None
last_name: DF.Data | None
lead_name: DF.Data | None
lead_owner: DF.Link | None
market_segment: DF.Link | None
middle_name: DF.Data | None
mobile_no: DF.Data | None
naming_series: DF.Literal["CRM-LEAD-.YYYY.-"]
no_of_employees: DF.Literal["1-10", "11-50", "51-200", "201-500", "501-1000", "1000+"]
notes: DF.Table[CRMNote]
phone: DF.Data | None
phone_ext: DF.Data | None
qualification_status: DF.Literal["Unqualified", "In Process", "Qualified"]
qualified_by: DF.Link | None
qualified_on: DF.Date | None
request_type: DF.Literal[
"", "Product Enquiry", "Request for Information", "Suggestions", "Other"
]
salutation: DF.Link | None
source: DF.Link | None
state: DF.Data | None
status: DF.Literal[
"Lead",
"Open",
"Replied",
"Opportunity",
"Quotation",
"Lost Quotation",
"Interested",
"Converted",
"Do Not Contact",
]
territory: DF.Link | None
title: DF.Data | None
type: DF.Literal["", "Client", "Channel Partner", "Consultant"]
unsubscribed: DF.Check
website: DF.Data | None
whatsapp_no: DF.Data | None
# end: auto-generated types
def onload(self):
customer = frappe.db.get_value("Customer", {"lead_name": self.name})
self.get("__onload").is_customer = customer

View File

@@ -7,4 +7,16 @@ from frappe.model.document import Document
class LeadSource(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
details: DF.TextEditor | None
source_name: DF.Data
# end: auto-generated types
pass

View File

@@ -6,4 +6,18 @@ from frappe.model.document import Document
class LostReasonDetail(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
lost_reason: DF.Link | None
parent: DF.Data
parentfield: DF.Data
parenttype: DF.Data
# end: auto-generated types
pass

View File

@@ -6,4 +6,15 @@ from frappe.model.document import Document
class MarketSegment(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
market_segment: DF.Data | None
# end: auto-generated types
pass

View File

@@ -25,6 +25,72 @@ from erpnext.utilities.transaction_base import TransactionBase
class Opportunity(TransactionBase, CRMNote):
# 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.crm.doctype.competitor_detail.competitor_detail import CompetitorDetail
from erpnext.crm.doctype.crm_note.crm_note import CRMNote
from erpnext.crm.doctype.opportunity_item.opportunity_item import OpportunityItem
from erpnext.crm.doctype.opportunity_lost_reason_detail.opportunity_lost_reason_detail import (
OpportunityLostReasonDetail,
)
address_display: DF.SmallText | None
amended_from: DF.Link | None
annual_revenue: DF.Currency
base_opportunity_amount: DF.Currency
base_total: DF.Currency
campaign: DF.Link | None
city: DF.Data | None
company: DF.Link
competitors: DF.TableMultiSelect[CompetitorDetail]
contact_display: DF.SmallText | None
contact_email: DF.Data | None
contact_mobile: DF.Data | None
contact_person: DF.Link | None
conversion_rate: DF.Float
country: DF.Link | None
currency: DF.Link | None
customer_address: DF.Link | None
customer_group: DF.Link | None
customer_name: DF.Data | None
expected_closing: DF.Date | None
first_response_time: DF.Duration | None
industry: DF.Link | None
items: DF.Table[OpportunityItem]
job_title: DF.Data | None
language: DF.Link | None
lost_reasons: DF.TableMultiSelect[OpportunityLostReasonDetail]
market_segment: DF.Link | None
naming_series: DF.Literal["CRM-OPP-.YYYY.-"]
no_of_employees: DF.Literal["1-10", "11-50", "51-200", "201-500", "501-1000", "1000+"]
notes: DF.Table[CRMNote]
opportunity_amount: DF.Currency
opportunity_from: DF.Link
opportunity_owner: DF.Link | None
opportunity_type: DF.Link | None
order_lost_reason: DF.SmallText | None
party_name: DF.DynamicLink
phone: DF.Data | None
phone_ext: DF.Data | None
probability: DF.Percent
sales_stage: DF.Link | None
source: DF.Link | None
state: DF.Data | None
status: DF.Literal["Open", "Quotation", "Converted", "Lost", "Replied", "Closed"]
territory: DF.Link | None
title: DF.Data | None
total: DF.Currency
transaction_date: DF.Date
website: DF.Data | None
whatsapp: DF.Data | None
# end: auto-generated types
def onload(self):
ref_doc = frappe.get_doc(self.opportunity_from, self.party_name)
load_address_and_contact(ref_doc)

View File

@@ -6,4 +6,29 @@ from frappe.model.document import Document
class OpportunityItem(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
amount: DF.Currency
base_amount: DF.Currency
base_rate: DF.Currency
brand: DF.Link | None
description: DF.TextEditor | None
image: DF.Attach | None
item_code: DF.Link | None
item_group: DF.Link | None
item_name: DF.Data | None
parent: DF.Data
parentfield: DF.Data
parenttype: DF.Data
qty: DF.Float
rate: DF.Currency
uom: DF.Link | None
# end: auto-generated types
pass

View File

@@ -6,4 +6,15 @@ from frappe.model.document import Document
class OpportunityLostReason(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
lost_reason: DF.Data | None
# end: auto-generated types
pass

View File

@@ -7,4 +7,18 @@ from frappe.model.document import Document
class OpportunityLostReasonDetail(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
lost_reason: DF.Link | None
parent: DF.Data
parentfield: DF.Data
parenttype: DF.Data
# end: auto-generated types
pass

View File

@@ -6,4 +6,15 @@ from frappe.model.document import Document
class OpportunityType(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

View File

@@ -12,6 +12,34 @@ from erpnext.crm.utils import CRMNote, copy_comments, link_communications, link_
class Prospect(CRMNote):
# 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.crm.doctype.crm_note.crm_note import CRMNote
from erpnext.crm.doctype.prospect_lead.prospect_lead import ProspectLead
from erpnext.crm.doctype.prospect_opportunity.prospect_opportunity import ProspectOpportunity
annual_revenue: DF.Currency
company: DF.Link
company_name: DF.Data | None
customer_group: DF.Link | None
fax: DF.Data | None
industry: DF.Link | None
leads: DF.Table[ProspectLead]
market_segment: DF.Link | None
no_of_employees: DF.Literal["1-10", "11-50", "51-200", "201-500", "501-1000", "1000+"]
notes: DF.Table[CRMNote]
opportunities: DF.Table[ProspectOpportunity]
prospect_owner: DF.Link | None
territory: DF.Link | None
website: DF.Data | None
# end: auto-generated types
def onload(self):
load_address_and_contact(self)

View File

@@ -6,4 +6,23 @@ from frappe.model.document import Document
class ProspectLead(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
email: DF.Data | None
lead: DF.Link
lead_name: DF.Data | None
lead_owner: DF.Data | None
mobile_no: DF.Data | None
parent: DF.Data
parentfield: DF.Data
parenttype: DF.Data
status: DF.Data | None
# end: auto-generated types
pass

View File

@@ -6,4 +6,26 @@ from frappe.model.document import Document
class ProspectOpportunity(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
amount: DF.Currency
contact_person: DF.Link | None
currency: DF.Link | None
deal_owner: DF.Data | None
expected_closing: DF.Date | None
name: DF.Int | None
opportunity: DF.Link | None
parent: DF.Data
parentfield: DF.Data
parenttype: DF.Data
probability: DF.Percent
stage: DF.Data | None
# end: auto-generated types
pass

View File

@@ -6,4 +6,15 @@ from frappe.model.document import Document
class SalesStage(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
stage_name: DF.Data | None
# end: auto-generated types
pass