Merge pull request #21776 from ankush/typess
feat(DX): auto generate python type annotations
This commit is contained in:
commit
4b0990c736
254 changed files with 5643 additions and 0 deletions
|
|
@ -12,6 +12,32 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class AssignmentRule(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_day.assignment_rule_day import AssignmentRuleDay
|
||||
from frappe.automation.doctype.assignment_rule_user.assignment_rule_user import (
|
||||
AssignmentRuleUser,
|
||||
)
|
||||
from frappe.types import DF
|
||||
|
||||
assign_condition: DF.Code
|
||||
assignment_days: DF.Table[AssignmentRuleDay]
|
||||
close_condition: DF.Code | None
|
||||
description: DF.SmallText
|
||||
disabled: DF.Check
|
||||
document_type: DF.Link
|
||||
due_date_based_on: DF.Literal
|
||||
field: DF.Literal
|
||||
last_user: DF.Link | None
|
||||
priority: DF.Int
|
||||
rule: DF.Literal["Round Robin", "Load Balancing", "Based on Field"]
|
||||
unassign_condition: DF.Code | None
|
||||
users: DF.TableMultiSelect[AssignmentRuleUser] | None
|
||||
# end: auto-generated types
|
||||
def validate(self):
|
||||
self.validate_document_types()
|
||||
self.validate_assignment_days()
|
||||
|
|
|
|||
|
|
@ -6,4 +6,17 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class AssignmentRuleDay(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: DF.Literal["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
|
||||
parent: DF.Data
|
||||
parentfield: DF.Data
|
||||
parenttype: DF.Data
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -6,4 +6,17 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class AssignmentRuleUser(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
|
||||
user: DF.Link
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -42,6 +42,34 @@ week_map = {
|
|||
|
||||
|
||||
class AutoRepeat(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.auto_repeat_day.auto_repeat_day import AutoRepeatDay
|
||||
from frappe.types import DF
|
||||
|
||||
disabled: DF.Check
|
||||
end_date: DF.Date | None
|
||||
frequency: DF.Literal["", "Daily", "Weekly", "Monthly", "Quarterly", "Half-yearly", "Yearly"]
|
||||
message: DF.Text | None
|
||||
next_schedule_date: DF.Date | None
|
||||
notify_by_email: DF.Check
|
||||
print_format: DF.Link | None
|
||||
recipients: DF.SmallText | None
|
||||
reference_doctype: DF.Link
|
||||
reference_document: DF.DynamicLink
|
||||
repeat_on_day: DF.Int
|
||||
repeat_on_days: DF.Table[AutoRepeatDay]
|
||||
repeat_on_last_day: DF.Check
|
||||
start_date: DF.Date
|
||||
status: DF.Literal["", "Active", "Disabled", "Completed"]
|
||||
subject: DF.Data | None
|
||||
submit_on_creation: DF.Check
|
||||
template: DF.Link | None
|
||||
# end: auto-generated types
|
||||
def validate(self):
|
||||
self.update_status()
|
||||
self.validate_reference_doctype()
|
||||
|
|
|
|||
|
|
@ -6,4 +6,17 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class AutoRepeatDay(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: DF.Literal["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
|
||||
parent: DF.Data
|
||||
parentfield: DF.Data
|
||||
parenttype: DF.Data
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -6,6 +6,20 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class Milestone(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
|
||||
|
||||
milestone_tracker: DF.Link | None
|
||||
reference_name: DF.Data
|
||||
reference_type: DF.Link
|
||||
track_field: DF.Data
|
||||
value: DF.Data
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,18 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class MilestoneTracker(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
|
||||
|
||||
disabled: DF.Check
|
||||
document_type: DF.Link
|
||||
track_field: DF.Literal
|
||||
# end: auto-generated types
|
||||
def on_update(self):
|
||||
frappe.cache_manager.clear_doctype_map("Milestone Tracker", self.document_type)
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,21 @@ from frappe.utils.data import add_to_date, get_datetime, now_datetime
|
|||
|
||||
|
||||
class Reminder(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
|
||||
notified: DF.Check
|
||||
remind_at: DF.Datetime
|
||||
reminder_docname: DF.DynamicLink | None
|
||||
reminder_doctype: DF.Link | None
|
||||
user: DF.Link
|
||||
# end: auto-generated types
|
||||
@staticmethod
|
||||
def clear_old_logs(days=30):
|
||||
from frappe.query_builder import Interval
|
||||
|
|
|
|||
|
|
@ -15,6 +15,45 @@ from frappe.utils import cstr
|
|||
|
||||
|
||||
class Address(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.core.doctype.dynamic_link.dynamic_link import DynamicLink
|
||||
from frappe.types import DF
|
||||
|
||||
address_line1: DF.Data
|
||||
address_line2: DF.Data | None
|
||||
address_title: DF.Data | None
|
||||
address_type: DF.Literal[
|
||||
"Billing",
|
||||
"Shipping",
|
||||
"Office",
|
||||
"Personal",
|
||||
"Plant",
|
||||
"Postal",
|
||||
"Shop",
|
||||
"Subsidiary",
|
||||
"Warehouse",
|
||||
"Current",
|
||||
"Permanent",
|
||||
"Other",
|
||||
]
|
||||
city: DF.Data
|
||||
country: DF.Link
|
||||
county: DF.Data | None
|
||||
disabled: DF.Check
|
||||
email_id: DF.Data | None
|
||||
fax: DF.Data | None
|
||||
is_primary_address: DF.Check
|
||||
is_shipping_address: DF.Check
|
||||
links: DF.Table[DynamicLink]
|
||||
phone: DF.Data | None
|
||||
pincode: DF.Data | None
|
||||
state: DF.Data | None
|
||||
# end: auto-generated types
|
||||
def __setup__(self):
|
||||
self.flags.linked = False
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,18 @@ from frappe.utils.jinja import validate_template
|
|||
|
||||
|
||||
class AddressTemplate(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
|
||||
|
||||
country: DF.Link
|
||||
is_default: DF.Check
|
||||
template: DF.Code | None
|
||||
# end: auto-generated types
|
||||
def validate(self):
|
||||
validate_template(self.template)
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,43 @@ from frappe.utils import cstr, has_gravatar
|
|||
|
||||
|
||||
class Contact(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.contacts.doctype.contact_email.contact_email import ContactEmail
|
||||
from frappe.contacts.doctype.contact_phone.contact_phone import ContactPhone
|
||||
from frappe.core.doctype.dynamic_link.dynamic_link import DynamicLink
|
||||
from frappe.types import DF
|
||||
|
||||
address: DF.Link | None
|
||||
company_name: DF.Data | None
|
||||
department: DF.Data | None
|
||||
designation: DF.Data | None
|
||||
email_id: DF.Data | None
|
||||
email_ids: DF.Table[ContactEmail]
|
||||
first_name: DF.Data | None
|
||||
full_name: DF.Data | None
|
||||
gender: DF.Link | None
|
||||
google_contacts: DF.Link | None
|
||||
google_contacts_id: DF.Data | None
|
||||
image: DF.AttachImage | None
|
||||
is_primary_contact: DF.Check
|
||||
last_name: DF.Data | None
|
||||
links: DF.Table[DynamicLink]
|
||||
middle_name: DF.Data | None
|
||||
mobile_no: DF.Data | None
|
||||
phone: DF.Data | None
|
||||
phone_nos: DF.Table[ContactPhone]
|
||||
pulled_from_google_contacts: DF.Check
|
||||
salutation: DF.Link | None
|
||||
status: DF.Literal["Passive", "Open", "Replied"]
|
||||
sync_with_google_contacts: DF.Check
|
||||
unsubscribed: DF.Check
|
||||
user: DF.Link | None
|
||||
# end: auto-generated types
|
||||
def autoname(self):
|
||||
self.name = self._get_full_name()
|
||||
|
||||
|
|
|
|||
|
|
@ -6,4 +6,18 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class ContactEmail(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_id: DF.Data
|
||||
is_primary: DF.Check
|
||||
parent: DF.Data
|
||||
parentfield: DF.Data
|
||||
parenttype: DF.Data
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -6,4 +6,19 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class ContactPhone(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
|
||||
|
||||
is_primary_mobile_no: DF.Check
|
||||
is_primary_phone: DF.Check
|
||||
parent: DF.Data
|
||||
parentfield: DF.Data
|
||||
parenttype: DF.Data
|
||||
phone: DF.Data
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -5,4 +5,14 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class Gender(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
|
||||
|
||||
gender: DF.Data | None
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -5,4 +5,14 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class Salutation(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
|
||||
|
||||
salutation: DF.Data | None
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -8,6 +8,25 @@ from frappe.utils import cstr
|
|||
|
||||
|
||||
class AccessLog(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
|
||||
|
||||
columns: DF.HTMLEditor | None
|
||||
export_from: DF.Data | None
|
||||
file_type: DF.Data | None
|
||||
filters: DF.Code | None
|
||||
method: DF.Data | None
|
||||
page: DF.HTMLEditor | None
|
||||
reference_document: DF.Data | None
|
||||
report_name: DF.Data | None
|
||||
timestamp: DF.Datetime | None
|
||||
user: DF.Link | None
|
||||
# end: auto-generated types
|
||||
@staticmethod
|
||||
def clear_old_logs(days=30):
|
||||
from frappe.query_builder import Interval
|
||||
|
|
|
|||
|
|
@ -10,6 +10,29 @@ from frappe.utils import get_fullname, now
|
|||
|
||||
|
||||
class ActivityLog(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
|
||||
|
||||
communication_date: DF.Datetime | None
|
||||
content: DF.TextEditor | None
|
||||
full_name: DF.Data | None
|
||||
link_doctype: DF.Link | None
|
||||
link_name: DF.DynamicLink | None
|
||||
operation: DF.Literal["", "Login", "Logout"]
|
||||
reference_doctype: DF.Link | None
|
||||
reference_name: DF.DynamicLink | None
|
||||
reference_owner: DF.ReadOnly | None
|
||||
status: DF.Literal["", "Success", "Failed", "Linked", "Closed"]
|
||||
subject: DF.SmallText
|
||||
timeline_doctype: DF.Link | None
|
||||
timeline_name: DF.DynamicLink | None
|
||||
user: DF.Link | None
|
||||
# end: auto-generated types
|
||||
def before_insert(self):
|
||||
self.full_name = get_fullname(self.user)
|
||||
self.date = now()
|
||||
|
|
|
|||
|
|
@ -6,4 +6,18 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class AmendedDocumentNamingSettings(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
|
||||
|
||||
action: DF.Literal["Amend Counter", "Default Naming"]
|
||||
document_type: DF.Link
|
||||
parent: DF.Data
|
||||
parentfield: DF.Data
|
||||
parenttype: DF.Data
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -5,4 +5,17 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class BlockModule(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
|
||||
|
||||
module: DF.Data
|
||||
parent: DF.Data
|
||||
parentfield: DF.Data
|
||||
parenttype: DF.Data
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -12,6 +12,48 @@ from frappe.website.utils import clear_cache
|
|||
|
||||
|
||||
class Comment(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
|
||||
|
||||
comment_by: DF.Data | None
|
||||
comment_email: DF.Data | None
|
||||
comment_type: DF.Literal[
|
||||
"Comment",
|
||||
"Like",
|
||||
"Info",
|
||||
"Label",
|
||||
"Workflow",
|
||||
"Created",
|
||||
"Submitted",
|
||||
"Cancelled",
|
||||
"Updated",
|
||||
"Deleted",
|
||||
"Assigned",
|
||||
"Assignment Completed",
|
||||
"Attachment",
|
||||
"Attachment Removed",
|
||||
"Shared",
|
||||
"Unshared",
|
||||
"Bot",
|
||||
"Relinked",
|
||||
"Edit",
|
||||
]
|
||||
content: DF.HTMLEditor | None
|
||||
ip_address: DF.Data | None
|
||||
link_doctype: DF.Link | None
|
||||
link_name: DF.DynamicLink | None
|
||||
published: DF.Check
|
||||
reference_doctype: DF.Link | None
|
||||
reference_name: DF.DynamicLink | None
|
||||
reference_owner: DF.Data | None
|
||||
seen: DF.Check
|
||||
subject: DF.Text | None
|
||||
# end: auto-generated types
|
||||
def after_insert(self):
|
||||
notify_mentions(self.reference_doctype, self.reference_name, self.content)
|
||||
self.notify_change("add")
|
||||
|
|
|
|||
|
|
@ -32,6 +32,91 @@ exclude_from_linked_with = True
|
|||
|
||||
|
||||
class Communication(Document, CommunicationEmailMixin):
|
||||
# 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.core.doctype.communication_link.communication_link import CommunicationLink
|
||||
from frappe.types import DF
|
||||
|
||||
_user_tags: DF.Data | None
|
||||
bcc: DF.Code | None
|
||||
cc: DF.Code | None
|
||||
comment_type: DF.Literal[
|
||||
"",
|
||||
"Comment",
|
||||
"Like",
|
||||
"Info",
|
||||
"Label",
|
||||
"Workflow",
|
||||
"Created",
|
||||
"Submitted",
|
||||
"Cancelled",
|
||||
"Updated",
|
||||
"Deleted",
|
||||
"Assigned",
|
||||
"Assignment Completed",
|
||||
"Attachment",
|
||||
"Attachment Removed",
|
||||
"Shared",
|
||||
"Unshared",
|
||||
"Relinked",
|
||||
]
|
||||
communication_date: DF.Datetime | None
|
||||
communication_medium: DF.Literal[
|
||||
"", "Email", "Chat", "Phone", "SMS", "Event", "Meeting", "Visit", "Other"
|
||||
]
|
||||
communication_type: DF.Literal[
|
||||
"Communication", "Comment", "Chat", "Notification", "Feedback", "Automated Message"
|
||||
]
|
||||
content: DF.TextEditor | None
|
||||
delivery_status: DF.Literal[
|
||||
"",
|
||||
"Sent",
|
||||
"Bounced",
|
||||
"Opened",
|
||||
"Marked As Spam",
|
||||
"Rejected",
|
||||
"Delayed",
|
||||
"Soft-Bounced",
|
||||
"Clicked",
|
||||
"Recipient Unsubscribed",
|
||||
"Error",
|
||||
"Expired",
|
||||
"Sending",
|
||||
"Read",
|
||||
]
|
||||
email_account: DF.Link | None
|
||||
email_status: DF.Literal["Open", "Spam", "Trash"]
|
||||
email_template: DF.Link | None
|
||||
feedback_request: DF.Data | None
|
||||
has_attachment: DF.Check
|
||||
imap_folder: DF.Data | None
|
||||
in_reply_to: DF.Link | None
|
||||
message_id: DF.SmallText | None
|
||||
phone_no: DF.Data | None
|
||||
rating: DF.Int
|
||||
read_by_recipient: DF.Check
|
||||
read_by_recipient_on: DF.Datetime | None
|
||||
read_receipt: DF.Check
|
||||
recipients: DF.Code | None
|
||||
reference_doctype: DF.Link | None
|
||||
reference_name: DF.DynamicLink | None
|
||||
reference_owner: DF.ReadOnly | None
|
||||
seen: DF.Check
|
||||
sender: DF.Data | None
|
||||
sender_full_name: DF.Data | None
|
||||
sent_or_received: DF.Literal["Sent", "Received"]
|
||||
status: DF.Literal["Open", "Replied", "Closed", "Linked"]
|
||||
subject: DF.SmallText
|
||||
text_content: DF.Code | None
|
||||
timeline_links: DF.Table[CommunicationLink]
|
||||
uid: DF.Int
|
||||
unread_notification_sent: DF.Check
|
||||
user: DF.Link | None
|
||||
# end: auto-generated types
|
||||
"""Communication represents an external communication like Email."""
|
||||
|
||||
no_feed_on_delete = True
|
||||
|
|
|
|||
|
|
@ -6,6 +6,21 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class CommunicationLink(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
|
||||
|
||||
link_doctype: DF.Link
|
||||
link_name: DF.DynamicLink
|
||||
link_title: DF.ReadOnly | None
|
||||
parent: DF.Data
|
||||
parentfield: DF.Data
|
||||
parenttype: DF.Data
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -6,5 +6,31 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class CustomDocPerm(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
|
||||
|
||||
amend: DF.Check
|
||||
cancel: DF.Check
|
||||
create: DF.Check
|
||||
delete: DF.Check
|
||||
email: DF.Check
|
||||
export: DF.Check
|
||||
if_owner: DF.Check
|
||||
parent: DF.Data | None
|
||||
permlevel: DF.Int
|
||||
print: DF.Check
|
||||
read: DF.Check
|
||||
report: DF.Check
|
||||
role: DF.Link
|
||||
select: DF.Check
|
||||
share: DF.Check
|
||||
submit: DF.Check
|
||||
write: DF.Check
|
||||
# end: auto-generated types
|
||||
def on_update(self):
|
||||
frappe.clear_cache(doctype=self.parent)
|
||||
|
|
|
|||
|
|
@ -6,6 +6,20 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class CustomRole(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.core.doctype.has_role.has_role import HasRole
|
||||
from frappe.types import DF
|
||||
|
||||
page: DF.Link | None
|
||||
ref_doctype: DF.Data | None
|
||||
report: DF.Link | None
|
||||
roles: DF.Table[HasRole]
|
||||
# end: auto-generated types
|
||||
def validate(self):
|
||||
if self.report and not self.ref_doctype:
|
||||
self.ref_doctype = frappe.db.get_value("Report", self.report, "ref_doctype")
|
||||
|
|
|
|||
|
|
@ -5,4 +5,16 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class DataExport(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
|
||||
|
||||
export_without_main_header: DF.Check
|
||||
file_type: DF.Literal["Excel", "CSV"]
|
||||
reference_doctype: DF.Link
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -17,6 +17,26 @@ BLOCKED_DOCTYPES = set(core_doctypes_list) - {"User", "Role"}
|
|||
|
||||
|
||||
class DataImport(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
|
||||
|
||||
google_sheets_url: DF.Data | None
|
||||
import_file: DF.Attach | None
|
||||
import_type: DF.Literal["", "Insert New Records", "Update Existing Records"]
|
||||
mute_emails: DF.Check
|
||||
payload_count: DF.Int
|
||||
reference_doctype: DF.Link
|
||||
show_failed_logs: DF.Check
|
||||
status: DF.Literal["Pending", "Success", "Partial Success", "Error"]
|
||||
submit_after_import: DF.Check
|
||||
template_options: DF.Code | None
|
||||
template_warnings: DF.Code | None
|
||||
# end: auto-generated types
|
||||
def validate(self):
|
||||
doc_before_save = self.get_doc_before_save()
|
||||
if (
|
||||
|
|
|
|||
|
|
@ -6,4 +6,20 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class DataImportLog(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
|
||||
|
||||
data_import: DF.Link | None
|
||||
docname: DF.Data | None
|
||||
exception: DF.Text | None
|
||||
log_index: DF.Int
|
||||
messages: DF.Code | None
|
||||
row_indexes: DF.Code | None
|
||||
success: DF.Check
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -6,6 +6,20 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class DefaultValue(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
|
||||
|
||||
defkey: DF.Data
|
||||
defvalue: DF.Text | None
|
||||
parent: DF.Data
|
||||
parentfield: DF.Data
|
||||
parenttype: DF.Data
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,20 @@ from frappe.model.workflow import get_workflow_name
|
|||
|
||||
|
||||
class DeletedDocument(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
|
||||
|
||||
data: DF.Code | None
|
||||
deleted_doctype: DF.Data | None
|
||||
deleted_name: DF.Data | None
|
||||
new_name: DF.ReadOnly | None
|
||||
restored: DF.Check
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,115 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class DocField(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_bulk_edit: DF.Check
|
||||
allow_in_quick_entry: DF.Check
|
||||
allow_on_submit: DF.Check
|
||||
bold: DF.Check
|
||||
collapsible: DF.Check
|
||||
collapsible_depends_on: DF.Code | None
|
||||
columns: DF.Int
|
||||
default: DF.SmallText | None
|
||||
depends_on: DF.Code | None
|
||||
description: DF.SmallText | None
|
||||
documentation_url: DF.Data | None
|
||||
fetch_from: DF.SmallText | None
|
||||
fetch_if_empty: DF.Check
|
||||
fieldname: DF.Data | None
|
||||
fieldtype: DF.Literal[
|
||||
"Autocomplete",
|
||||
"Attach",
|
||||
"Attach Image",
|
||||
"Barcode",
|
||||
"Button",
|
||||
"Check",
|
||||
"Code",
|
||||
"Color",
|
||||
"Column Break",
|
||||
"Currency",
|
||||
"Data",
|
||||
"Date",
|
||||
"Datetime",
|
||||
"Duration",
|
||||
"Dynamic Link",
|
||||
"Float",
|
||||
"Fold",
|
||||
"Geolocation",
|
||||
"Heading",
|
||||
"HTML",
|
||||
"HTML Editor",
|
||||
"Icon",
|
||||
"Image",
|
||||
"Int",
|
||||
"JSON",
|
||||
"Link",
|
||||
"Long Text",
|
||||
"Markdown Editor",
|
||||
"Password",
|
||||
"Percent",
|
||||
"Phone",
|
||||
"Read Only",
|
||||
"Rating",
|
||||
"Section Break",
|
||||
"Select",
|
||||
"Signature",
|
||||
"Small Text",
|
||||
"Tab Break",
|
||||
"Table",
|
||||
"Table MultiSelect",
|
||||
"Text",
|
||||
"Text Editor",
|
||||
"Time",
|
||||
]
|
||||
hidden: DF.Check
|
||||
hide_border: DF.Check
|
||||
hide_days: DF.Check
|
||||
hide_seconds: DF.Check
|
||||
ignore_user_permissions: DF.Check
|
||||
ignore_xss_filter: DF.Check
|
||||
in_filter: DF.Check
|
||||
in_global_search: DF.Check
|
||||
in_list_view: DF.Check
|
||||
in_preview: DF.Check
|
||||
in_standard_filter: DF.Check
|
||||
is_virtual: DF.Check
|
||||
label: DF.Data | None
|
||||
length: DF.Int
|
||||
mandatory_depends_on: DF.Code | None
|
||||
max_height: DF.Data | None
|
||||
no_copy: DF.Check
|
||||
non_negative: DF.Check
|
||||
oldfieldname: DF.Data | None
|
||||
oldfieldtype: DF.Data | None
|
||||
options: DF.SmallText | None
|
||||
parent: DF.Data
|
||||
parentfield: DF.Data
|
||||
parenttype: DF.Data
|
||||
permlevel: DF.Int
|
||||
precision: DF.Literal["", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
|
||||
print_hide: DF.Check
|
||||
print_hide_if_no_value: DF.Check
|
||||
print_width: DF.Data | None
|
||||
read_only: DF.Check
|
||||
read_only_depends_on: DF.Code | None
|
||||
remember_last_selected_value: DF.Check
|
||||
report_hide: DF.Check
|
||||
reqd: DF.Check
|
||||
search_index: DF.Check
|
||||
set_only_once: DF.Check
|
||||
show_dashboard: DF.Check
|
||||
sort_options: DF.Check
|
||||
translatable: DF.Check
|
||||
unique: DF.Check
|
||||
width: DF.Data | None
|
||||
# end: auto-generated types
|
||||
def get_link_doctype(self):
|
||||
"""Returns the Link doctype for the docfield (if applicable)
|
||||
if fieldtype is Link: Returns "options"
|
||||
|
|
|
|||
|
|
@ -5,4 +5,32 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class DocPerm(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
|
||||
|
||||
amend: DF.Check
|
||||
cancel: DF.Check
|
||||
create: DF.Check
|
||||
delete: DF.Check
|
||||
email: DF.Check
|
||||
export: DF.Check
|
||||
if_owner: DF.Check
|
||||
parent: DF.Data
|
||||
parentfield: DF.Data
|
||||
parenttype: DF.Data
|
||||
permlevel: DF.Int
|
||||
print: DF.Check
|
||||
read: DF.Check
|
||||
report: DF.Check
|
||||
role: DF.Link
|
||||
select: DF.Check
|
||||
share: DF.Check
|
||||
submit: DF.Check
|
||||
write: DF.Check
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -10,6 +10,24 @@ exclude_from_linked_with = True
|
|||
|
||||
|
||||
class DocShare(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
|
||||
|
||||
everyone: DF.Check
|
||||
notify_by_email: DF.Check
|
||||
read: DF.Check
|
||||
share: DF.Check
|
||||
share_doctype: DF.Link
|
||||
share_name: DF.DynamicLink
|
||||
submit: DF.Check
|
||||
user: DF.Link | None
|
||||
write: DF.Check
|
||||
# end: auto-generated types
|
||||
no_feed_on_delete = True
|
||||
|
||||
def validate(self):
|
||||
|
|
|
|||
|
|
@ -86,6 +86,94 @@ form_grid_templates = {"fields": "templates/form_grid/fields.html"}
|
|||
|
||||
|
||||
class DocType(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.core.doctype.docfield.docfield import DocField
|
||||
from frappe.core.doctype.docperm.docperm import DocPerm
|
||||
from frappe.core.doctype.doctype_action.doctype_action import DocTypeAction
|
||||
from frappe.core.doctype.doctype_link.doctype_link import DocTypeLink
|
||||
from frappe.core.doctype.doctype_state.doctype_state import DocTypeState
|
||||
from frappe.types import DF
|
||||
|
||||
actions: DF.Table[DocTypeAction]
|
||||
allow_auto_repeat: DF.Check
|
||||
allow_copy: DF.Check
|
||||
allow_events_in_timeline: DF.Check
|
||||
allow_guest_to_view: DF.Check
|
||||
allow_import: DF.Check
|
||||
allow_rename: DF.Check
|
||||
autoname: DF.Data | None
|
||||
beta: DF.Check
|
||||
color: DF.Data | None
|
||||
custom: DF.Check
|
||||
default_email_template: DF.Link | None
|
||||
default_print_format: DF.Data | None
|
||||
default_view: DF.Literal
|
||||
description: DF.SmallText | None
|
||||
document_type: DF.Literal["", "Document", "Setup", "System", "Other"]
|
||||
documentation: DF.Data | None
|
||||
editable_grid: DF.Check
|
||||
email_append_to: DF.Check
|
||||
engine: DF.Literal["InnoDB", "MyISAM"]
|
||||
fields: DF.Table[DocField]
|
||||
force_re_route_to_default_view: DF.Check
|
||||
has_web_view: DF.Check
|
||||
hide_toolbar: DF.Check
|
||||
icon: DF.Data | None
|
||||
image_field: DF.Data | None
|
||||
in_create: DF.Check
|
||||
index_web_pages_for_search: DF.Check
|
||||
is_calendar_and_gantt: DF.Check
|
||||
is_published_field: DF.Data | None
|
||||
is_submittable: DF.Check
|
||||
is_tree: DF.Check
|
||||
is_virtual: DF.Check
|
||||
issingle: DF.Check
|
||||
istable: DF.Check
|
||||
links: DF.Table[DocTypeLink]
|
||||
make_attachments_public: DF.Check
|
||||
max_attachments: DF.Int
|
||||
migration_hash: DF.Data | None
|
||||
module: DF.Link
|
||||
naming_rule: DF.Literal[
|
||||
"",
|
||||
"Set by user",
|
||||
"Autoincrement",
|
||||
"By fieldname",
|
||||
'By "Naming Series" field',
|
||||
"Expression",
|
||||
"Expression (old style)",
|
||||
"Random",
|
||||
"By script",
|
||||
]
|
||||
nsm_parent_field: DF.Data | None
|
||||
permissions: DF.Table[DocPerm]
|
||||
queue_in_background: DF.Check
|
||||
quick_entry: DF.Check
|
||||
read_only: DF.Check
|
||||
restrict_to_domain: DF.Link | None
|
||||
route: DF.Data | None
|
||||
search_fields: DF.Data | None
|
||||
sender_field: DF.Data | None
|
||||
show_name_in_global_search: DF.Check
|
||||
show_preview_popup: DF.Check
|
||||
show_title_field_in_link: DF.Check
|
||||
sort_field: DF.Data | None
|
||||
sort_order: DF.Literal["ASC", "DESC"]
|
||||
states: DF.Table[DocTypeState]
|
||||
subject_field: DF.Data | None
|
||||
timeline_field: DF.Data | None
|
||||
title_field: DF.Data | None
|
||||
track_changes: DF.Check
|
||||
track_seen: DF.Check
|
||||
track_views: DF.Check
|
||||
translated_doctype: DF.Check
|
||||
website_search_field: DF.Data | None
|
||||
# end: auto-generated types
|
||||
def validate(self):
|
||||
"""Validate DocType before saving.
|
||||
|
||||
|
|
@ -409,6 +497,7 @@ class DocType(Document):
|
|||
self.export_doc()
|
||||
self.make_controller_template()
|
||||
self.set_base_class_for_controller()
|
||||
self.export_types_to_controller()
|
||||
|
||||
# update index
|
||||
if not self.custom:
|
||||
|
|
@ -719,6 +808,18 @@ class DocType(Document):
|
|||
make_boilerplate("templates/controller.html", self.as_dict())
|
||||
make_boilerplate("templates/controller_row.html", self.as_dict())
|
||||
|
||||
def export_types_to_controller(self):
|
||||
from frappe.modules.utils import get_module_app
|
||||
from frappe.types.exporter import TypeExporter
|
||||
|
||||
try:
|
||||
app = get_module_app(self.module)
|
||||
except frappe.DoesNotExistError:
|
||||
return
|
||||
|
||||
if any(frappe.get_hooks("export_python_type_annotations", app_name=app)):
|
||||
TypeExporter(self).export_types()
|
||||
|
||||
def make_amendable(self):
|
||||
"""If is_submittable is set, add amended_from docfields."""
|
||||
if self.is_submittable:
|
||||
|
|
|
|||
|
|
@ -648,6 +648,44 @@ class TestDocType(FrappeTestCase):
|
|||
def test_no_delete_doc(self):
|
||||
self.assertRaises(frappe.ValidationError, frappe.delete_doc, "DocType", "Address")
|
||||
|
||||
@patch.dict(frappe.conf, {"developer_mode": 1})
|
||||
def test_export_types(self):
|
||||
"""Export python types."""
|
||||
import ast
|
||||
|
||||
from frappe.types.exporter import TypeExporter
|
||||
|
||||
def validate(code):
|
||||
ast.parse(code)
|
||||
|
||||
doctype = new_doctype(custom=0).insert()
|
||||
|
||||
exporter = TypeExporter(doctype)
|
||||
code = exporter.controller_path.read_text()
|
||||
validate(code)
|
||||
|
||||
# regenerate and verify and file is same word to word.
|
||||
exporter.export_types()
|
||||
new_code = exporter.controller_path.read_text()
|
||||
validate(new_code)
|
||||
|
||||
self.assertEqual(code, new_code)
|
||||
|
||||
# Add fields and save
|
||||
|
||||
fieldname = "test_type"
|
||||
doctype.append("fields", {"fieldname": fieldname, "fieldtype": "Int"})
|
||||
doctype.save()
|
||||
|
||||
new_field_code = exporter.controller_path.read_text()
|
||||
validate(new_field_code)
|
||||
|
||||
self.assertIn(fieldname, new_field_code)
|
||||
self.assertIn("Int", new_field_code)
|
||||
|
||||
doctype.delete()
|
||||
frappe.db.commit()
|
||||
|
||||
@patch.dict(frappe.conf, {"developer_mode": 1})
|
||||
def test_custom_field_deletion(self):
|
||||
"""Custom child tables whose doctype doesn't exist should be auto deleted."""
|
||||
|
|
|
|||
|
|
@ -6,4 +6,22 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class DocTypeAction(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
|
||||
|
||||
action: DF.SmallText
|
||||
action_type: DF.Literal["Server Action", "Route"]
|
||||
custom: DF.Check
|
||||
group: DF.Data | None
|
||||
hidden: DF.Check
|
||||
label: DF.Data
|
||||
parent: DF.Data
|
||||
parentfield: DF.Data
|
||||
parenttype: DF.Data
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -6,4 +6,24 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class DocTypeLink(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
|
||||
|
||||
custom: DF.Check
|
||||
group: DF.Data | None
|
||||
hidden: DF.Check
|
||||
is_child_table: DF.Check
|
||||
link_doctype: DF.Link
|
||||
link_fieldname: DF.Data
|
||||
parent: DF.Data
|
||||
parent_doctype: DF.Link | None
|
||||
parentfield: DF.Data
|
||||
parenttype: DF.Data
|
||||
table_fieldname: DF.Data | None
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -6,4 +6,21 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class DocTypeState(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
|
||||
|
||||
color: DF.Literal[
|
||||
"Blue", "Cyan", "Gray", "Green", "Light Blue", "Orange", "Pink", "Purple", "Red", "Yellow"
|
||||
]
|
||||
custom: DF.Check
|
||||
parent: DF.Data
|
||||
parentfield: DF.Data
|
||||
parenttype: DF.Data
|
||||
title: DF.Data
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -9,6 +9,25 @@ from frappe.utils.data import evaluate_filters
|
|||
|
||||
|
||||
class DocumentNamingRule(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.core.doctype.document_naming_rule_condition.document_naming_rule_condition import (
|
||||
DocumentNamingRuleCondition,
|
||||
)
|
||||
from frappe.types import DF
|
||||
|
||||
conditions: DF.Table[DocumentNamingRuleCondition]
|
||||
counter: DF.Int
|
||||
disabled: DF.Check
|
||||
document_type: DF.Link
|
||||
prefix: DF.Data
|
||||
prefix_digits: DF.Int
|
||||
priority: DF.Int
|
||||
# end: auto-generated types
|
||||
def validate(self):
|
||||
self.validate_fields_in_conditions()
|
||||
|
||||
|
|
|
|||
|
|
@ -6,4 +6,19 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class DocumentNamingRuleCondition(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
|
||||
|
||||
condition: DF.Literal["=", "!=", ">", "<", ">=", "<="]
|
||||
field: DF.Literal
|
||||
parent: DF.Data
|
||||
parentfield: DF.Data
|
||||
parenttype: DF.Data
|
||||
value: DF.Data
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -15,6 +15,27 @@ class NamingSeriesNotSetError(frappe.ValidationError):
|
|||
|
||||
|
||||
class DocumentNamingSettings(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.core.doctype.amended_document_naming_settings.amended_document_naming_settings import (
|
||||
AmendedDocumentNamingSettings,
|
||||
)
|
||||
from frappe.types import DF
|
||||
|
||||
amend_naming_override: DF.Table[AmendedDocumentNamingSettings]
|
||||
current_value: DF.Int
|
||||
default_amend_naming: DF.Literal["Amend Counter", "Default Naming"]
|
||||
naming_series_options: DF.Text | None
|
||||
prefix: DF.Autocomplete | None
|
||||
series_preview: DF.Text | None
|
||||
transaction_type: DF.Autocomplete | None
|
||||
try_naming_series: DF.Data | None
|
||||
user_must_always_select: DF.Check
|
||||
# end: auto-generated types
|
||||
@frappe.whitelist()
|
||||
def get_transactions_and_prefixes(self):
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,19 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class DocumentShareKey(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
|
||||
|
||||
expires_on: DF.Date | None
|
||||
key: DF.Data | None
|
||||
reference_docname: DF.DynamicLink | None
|
||||
reference_doctype: DF.Link | None
|
||||
# end: auto-generated types
|
||||
def before_insert(self):
|
||||
self.key = frappe.generate_hash(length=randrange(25, 35))
|
||||
if not self.expires_on and not self.flags.no_expiry:
|
||||
|
|
|
|||
|
|
@ -7,6 +7,16 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class Domain(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
|
||||
|
||||
domain: DF.Data
|
||||
# end: auto-generated types
|
||||
"""Domain documents are created automatically when DocTypes
|
||||
with "Restricted" domains are imported during
|
||||
installation or migration"""
|
||||
|
|
|
|||
|
|
@ -6,6 +6,17 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class DomainSettings(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.core.doctype.has_domain.has_domain import HasDomain
|
||||
from frappe.types import DF
|
||||
|
||||
active_domains: DF.Table[HasDomain]
|
||||
# end: auto-generated types
|
||||
def set_active_domains(self, domains):
|
||||
active_domains = [d.domain for d in self.active_domains]
|
||||
added = False
|
||||
|
|
|
|||
|
|
@ -6,6 +6,21 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class DynamicLink(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
|
||||
|
||||
link_doctype: DF.Link
|
||||
link_name: DF.DynamicLink
|
||||
link_title: DF.ReadOnly | None
|
||||
parent: DF.Data
|
||||
parentfield: DF.Data
|
||||
parenttype: DF.Data
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,20 @@ from frappe.query_builder.functions import Now
|
|||
|
||||
|
||||
class ErrorLog(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
|
||||
|
||||
error: DF.Code | None
|
||||
method: DF.Data | None
|
||||
reference_doctype: DF.Link | None
|
||||
reference_name: DF.Data | None
|
||||
seen: DF.Check
|
||||
# end: auto-generated types
|
||||
def onload(self):
|
||||
if not self.seen and not frappe.flags.read_only:
|
||||
self.db_set("seen", 1, update_modified=0)
|
||||
|
|
|
|||
|
|
@ -30,6 +30,31 @@ URL_PREFIXES = ("http://", "https://")
|
|||
|
||||
|
||||
class File(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
|
||||
|
||||
attached_to_doctype: DF.Link | None
|
||||
attached_to_field: DF.Data | None
|
||||
attached_to_name: DF.Data | None
|
||||
content_hash: DF.Data | None
|
||||
file_name: DF.Data | None
|
||||
file_size: DF.Int
|
||||
file_url: DF.Code | None
|
||||
folder: DF.Link | None
|
||||
is_attachments_folder: DF.Check
|
||||
is_folder: DF.Check
|
||||
is_home_folder: DF.Check
|
||||
is_private: DF.Check
|
||||
old_parent: DF.Data | None
|
||||
thumbnail_url: DF.SmallText | None
|
||||
uploaded_to_dropbox: DF.Check
|
||||
uploaded_to_google_drive: DF.Check
|
||||
# end: auto-generated types
|
||||
no_feed_on_delete = True
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
|
|
|||
|
|
@ -5,4 +5,17 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class HasDomain(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
|
||||
|
||||
domain: DF.Link | None
|
||||
parent: DF.Data
|
||||
parentfield: DF.Data
|
||||
parenttype: DF.Data
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -6,6 +6,19 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class HasRole(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
|
||||
role: DF.Link | None
|
||||
# end: auto-generated types
|
||||
def before_insert(self):
|
||||
if frappe.db.exists("Has Role", {"parent": self.parent, "role": self.role}):
|
||||
frappe.throw(frappe._("User '{0}' already has the role '{1}'").format(self.parent, self.role))
|
||||
|
|
|
|||
|
|
@ -6,4 +6,19 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class InstalledApplication(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
|
||||
|
||||
app_name: DF.Data
|
||||
app_version: DF.Data
|
||||
git_branch: DF.Data
|
||||
parent: DF.Data
|
||||
parentfield: DF.Data
|
||||
parenttype: DF.Data
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -13,6 +13,17 @@ class InvalidAppOrder(frappe.ValidationError):
|
|||
|
||||
|
||||
class InstalledApplications(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.core.doctype.installed_application.installed_application import InstalledApplication
|
||||
from frappe.types import DF
|
||||
|
||||
installed_applications: DF.Table[InstalledApplication]
|
||||
# end: auto-generated types
|
||||
def update_versions(self):
|
||||
self.delete_key("installed_applications")
|
||||
for app in frappe.utils.get_installed_apps_info():
|
||||
|
|
|
|||
|
|
@ -10,6 +10,20 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class Language(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
|
||||
|
||||
based_on: DF.Link | None
|
||||
enabled: DF.Check
|
||||
flag: DF.Data | None
|
||||
language_code: DF.Data
|
||||
language_name: DF.Data
|
||||
# end: auto-generated types
|
||||
def validate(self):
|
||||
validate_with_regex(self.language_code, "Language Code")
|
||||
|
||||
|
|
|
|||
|
|
@ -6,4 +6,17 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class LogSettingUser(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
|
||||
user: DF.Link
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -43,6 +43,17 @@ def _supports_log_clearing(doctype: str) -> bool:
|
|||
|
||||
|
||||
class LogSettings(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.core.doctype.logs_to_clear.logs_to_clear import LogsToClear
|
||||
from frappe.types import DF
|
||||
|
||||
logs_to_clear: DF.Table[LogsToClear]
|
||||
# end: auto-generated types
|
||||
def validate(self):
|
||||
self.remove_unsupported_doctypes()
|
||||
self._deduplicate_entries()
|
||||
|
|
|
|||
|
|
@ -6,4 +6,18 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class LogsToClear(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
|
||||
|
||||
days: DF.Int
|
||||
parent: DF.Data
|
||||
parentfield: DF.Data
|
||||
parenttype: DF.Data
|
||||
ref_doctype: DF.Link
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -9,6 +9,20 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class ModuleDef(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
|
||||
|
||||
app_name: DF.Literal
|
||||
custom: DF.Check
|
||||
module_name: DF.Data
|
||||
package: DF.Link | None
|
||||
restrict_to_domain: DF.Link | None
|
||||
# end: auto-generated types
|
||||
def on_update(self):
|
||||
"""If in `developer_mode`, create folder for module and
|
||||
add in `modules.txt` of app if missing."""
|
||||
|
|
|
|||
|
|
@ -5,6 +5,18 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class ModuleProfile(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.core.doctype.block_module.block_module import BlockModule
|
||||
from frappe.types import DF
|
||||
|
||||
block_modules: DF.Table[BlockModule]
|
||||
module_profile_name: DF.Data
|
||||
# end: auto-generated types
|
||||
def onload(self):
|
||||
from frappe.config import get_modules_from_all_apps
|
||||
|
||||
|
|
|
|||
|
|
@ -6,4 +6,22 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class NavbarItem(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
|
||||
|
||||
action: DF.Data | None
|
||||
hidden: DF.Check
|
||||
is_standard: DF.Check
|
||||
item_label: DF.Data | None
|
||||
item_type: DF.Literal["Route", "Action", "Separator"]
|
||||
parent: DF.Data
|
||||
parentfield: DF.Data
|
||||
parenttype: DF.Data
|
||||
route: DF.Data | None
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -7,6 +7,20 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class NavbarSettings(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.core.doctype.navbar_item.navbar_item import NavbarItem
|
||||
from frappe.types import DF
|
||||
|
||||
app_logo: DF.AttachImage | None
|
||||
help_dropdown: DF.Table[NavbarItem]
|
||||
logo_width: DF.Int
|
||||
settings_dropdown: DF.Table[NavbarItem]
|
||||
# end: auto-generated types
|
||||
def validate(self):
|
||||
self.validate_standard_navbar_items()
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,21 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class Package(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
|
||||
|
||||
license: DF.MarkdownEditor | None
|
||||
license_type: DF.Literal[
|
||||
"", "MIT License", "GNU General Public License", "GNU Affero General Public License"
|
||||
]
|
||||
package_name: DF.Data
|
||||
readme: DF.MarkdownEditor | None
|
||||
# end: auto-generated types
|
||||
def validate(self):
|
||||
if not self.package_name:
|
||||
self.package_name = self.name.lower().replace(" ", "-")
|
||||
|
|
|
|||
|
|
@ -14,6 +14,19 @@ from frappe.utils import get_files_path
|
|||
|
||||
|
||||
class PackageImport(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
|
||||
|
||||
activate: DF.Check
|
||||
attach_package: DF.Attach | None
|
||||
force: DF.Check
|
||||
log: DF.Code | None
|
||||
# end: auto-generated types
|
||||
def validate(self):
|
||||
if self.activate:
|
||||
self.import_package()
|
||||
|
|
|
|||
|
|
@ -11,6 +11,22 @@ from frappe.query_builder.functions import Max
|
|||
|
||||
|
||||
class PackageRelease(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
|
||||
|
||||
major: DF.Int
|
||||
minor: DF.Int
|
||||
package: DF.Link
|
||||
patch: DF.Int
|
||||
path: DF.SmallText | None
|
||||
publish: DF.Check
|
||||
release_notes: DF.MarkdownEditor | None
|
||||
# end: auto-generated types
|
||||
def set_version(self):
|
||||
# set the next patch release by default
|
||||
doctype = frappe.qb.DocType("Package Release")
|
||||
|
|
|
|||
|
|
@ -14,6 +14,24 @@ from frappe.model.utils import render_include
|
|||
|
||||
|
||||
class Page(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.core.doctype.has_role.has_role import HasRole
|
||||
from frappe.types import DF
|
||||
|
||||
icon: DF.Data | None
|
||||
module: DF.Link
|
||||
page_name: DF.Data
|
||||
restrict_to_domain: DF.Link | None
|
||||
roles: DF.Table[HasRole]
|
||||
standard: DF.Literal["Yes", "No"]
|
||||
system_page: DF.Check
|
||||
title: DF.Data | None
|
||||
# end: auto-generated types
|
||||
def autoname(self):
|
||||
"""
|
||||
Creates a url friendly name for this page.
|
||||
|
|
|
|||
|
|
@ -9,6 +9,18 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class PatchLog(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
|
||||
|
||||
patch: DF.Code | None
|
||||
skipped: DF.Check
|
||||
traceback: DF.Code | None
|
||||
# end: auto-generated types
|
||||
@frappe.whitelist()
|
||||
def rerun_patch(self):
|
||||
from frappe.modules.patch_handler import run_single
|
||||
|
|
|
|||
|
|
@ -22,6 +22,23 @@ REPORT_TIMEOUT = 25 * 60
|
|||
|
||||
|
||||
class PreparedReport(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
|
||||
|
||||
error_message: DF.Text | None
|
||||
filters: DF.SmallText | None
|
||||
job_id: DF.Link | None
|
||||
queued_at: DF.Datetime | None
|
||||
queued_by: DF.Data | None
|
||||
report_end_time: DF.Datetime | None
|
||||
report_name: DF.Data
|
||||
status: DF.Literal["Error", "Queued", "Completed", "Started"]
|
||||
# end: auto-generated types
|
||||
@property
|
||||
def queued_by(self):
|
||||
return self.owner
|
||||
|
|
|
|||
|
|
@ -17,6 +17,35 @@ from frappe.utils.safe_exec import check_safe_sql_query, safe_exec
|
|||
|
||||
|
||||
class Report(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.core.doctype.has_role.has_role import HasRole
|
||||
from frappe.core.doctype.report_column.report_column import ReportColumn
|
||||
from frappe.core.doctype.report_filter.report_filter import ReportFilter
|
||||
from frappe.types import DF
|
||||
|
||||
add_total_row: DF.Check
|
||||
columns: DF.Table[ReportColumn]
|
||||
disabled: DF.Check
|
||||
filters: DF.Table[ReportFilter]
|
||||
is_standard: DF.Literal["No", "Yes"]
|
||||
javascript: DF.Code | None
|
||||
json: DF.Code | None
|
||||
letter_head: DF.Link | None
|
||||
module: DF.Link | None
|
||||
prepared_report: DF.Check
|
||||
query: DF.Code | None
|
||||
ref_doctype: DF.Link
|
||||
reference_report: DF.Data | None
|
||||
report_name: DF.Data
|
||||
report_script: DF.Code | None
|
||||
report_type: DF.Literal["Report Builder", "Query Report", "Script Report", "Custom Report"]
|
||||
roles: DF.Table[HasRole]
|
||||
# end: auto-generated types
|
||||
def validate(self):
|
||||
"""only administrator can save standard report"""
|
||||
if not self.module:
|
||||
|
|
|
|||
|
|
@ -6,4 +6,35 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class ReportColumn(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
|
||||
|
||||
fieldname: DF.Data
|
||||
fieldtype: DF.Literal[
|
||||
"Check",
|
||||
"Currency",
|
||||
"Data",
|
||||
"Date",
|
||||
"Datetime",
|
||||
"Duration",
|
||||
"Dynamic Link",
|
||||
"Float",
|
||||
"Fold",
|
||||
"Int",
|
||||
"Link",
|
||||
"Select",
|
||||
"Time",
|
||||
]
|
||||
label: DF.Data
|
||||
options: DF.Data | None
|
||||
parent: DF.Data
|
||||
parentfield: DF.Data
|
||||
parenttype: DF.Data
|
||||
width: DF.Int
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -6,4 +6,36 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class ReportFilter(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: DF.SmallText | None
|
||||
fieldname: DF.Data
|
||||
fieldtype: DF.Literal[
|
||||
"Check",
|
||||
"Currency",
|
||||
"Data",
|
||||
"Date",
|
||||
"Datetime",
|
||||
"Dynamic Link",
|
||||
"Float",
|
||||
"Fold",
|
||||
"Int",
|
||||
"Link",
|
||||
"Select",
|
||||
"Time",
|
||||
]
|
||||
label: DF.Data
|
||||
mandatory: DF.Check
|
||||
options: DF.SmallText | None
|
||||
parent: DF.Data
|
||||
parentfield: DF.Data
|
||||
parenttype: DF.Data
|
||||
wildcard_filter: DF.Check
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -19,6 +19,30 @@ STANDARD_ROLES = ("Administrator", "System Manager", "Script Manager", "All", "G
|
|||
|
||||
|
||||
class Role(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
|
||||
|
||||
bulk_actions: DF.Check
|
||||
dashboard: DF.Check
|
||||
desk_access: DF.Check
|
||||
disabled: DF.Check
|
||||
form_sidebar: DF.Check
|
||||
home_page: DF.Data | None
|
||||
is_custom: DF.Check
|
||||
list_sidebar: DF.Check
|
||||
notifications: DF.Check
|
||||
restrict_to_domain: DF.Link | None
|
||||
role_name: DF.Data
|
||||
search_bar: DF.Check
|
||||
timeline: DF.Check
|
||||
two_factor_auth: DF.Check
|
||||
view_switcher: DF.Check
|
||||
# end: auto-generated types
|
||||
def before_rename(self, old, new, merge=False):
|
||||
if old in STANDARD_ROLES:
|
||||
frappe.throw(frappe._("Standard roles cannot be renamed"))
|
||||
|
|
|
|||
|
|
@ -8,6 +8,21 @@ from frappe.utils import cint
|
|||
|
||||
|
||||
class RolePermissionforPageandReport(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.core.doctype.has_role.has_role import HasRole
|
||||
from frappe.types import DF
|
||||
|
||||
enable_prepared_report: DF.Check
|
||||
page: DF.Link | None
|
||||
report: DF.Link | None
|
||||
roles: DF.Table[HasRole]
|
||||
set_role_for: DF.Literal["", "Page", "Report"]
|
||||
# end: auto-generated types
|
||||
@frappe.whitelist()
|
||||
def set_report_page_data(self):
|
||||
self.set_custom_roles()
|
||||
|
|
|
|||
|
|
@ -6,6 +6,18 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class RoleProfile(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.core.doctype.has_role.has_role import HasRole
|
||||
from frappe.types import DF
|
||||
|
||||
role_profile: DF.Data
|
||||
roles: DF.Table[HasRole]
|
||||
# end: auto-generated types
|
||||
def autoname(self):
|
||||
"""set name as Role Profile name"""
|
||||
self.name = self.role_profile
|
||||
|
|
|
|||
|
|
@ -39,6 +39,27 @@ def check_permissions(method):
|
|||
|
||||
|
||||
class RQJob(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
|
||||
|
||||
arguments: DF.Code | None
|
||||
ended_at: DF.Datetime | None
|
||||
exc_info: DF.Code | None
|
||||
job_id: DF.Data | None
|
||||
job_name: DF.Data | None
|
||||
queue: DF.Literal["default", "short", "long"]
|
||||
started_at: DF.Datetime | None
|
||||
status: DF.Literal[
|
||||
"queued", "started", "finished", "failed", "deferred", "scheduled", "canceled"
|
||||
]
|
||||
time_taken: DF.Duration | None
|
||||
timeout: DF.Duration | None
|
||||
# end: auto-generated types
|
||||
def load_from_db(self):
|
||||
try:
|
||||
job = Job.fetch(self.name, connection=get_redis_conn())
|
||||
|
|
|
|||
|
|
@ -13,6 +13,27 @@ from frappe.utils.background_jobs import get_workers
|
|||
|
||||
|
||||
class RQWorker(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
|
||||
|
||||
birth_date: DF.Datetime | None
|
||||
current_job_id: DF.Link | None
|
||||
failed_job_count: DF.Int
|
||||
last_heartbeat: DF.Datetime | None
|
||||
pid: DF.Data | None
|
||||
queue: DF.Data | None
|
||||
queue_type: DF.Literal["default", "long", "short"]
|
||||
status: DF.Data | None
|
||||
successful_job_count: DF.Int
|
||||
total_working_time: DF.Duration | None
|
||||
utilization_percent: DF.Percent
|
||||
worker_name: DF.Data | None
|
||||
# end: auto-generated types
|
||||
def load_from_db(self):
|
||||
|
||||
all_workers = get_workers()
|
||||
|
|
|
|||
|
|
@ -8,6 +8,18 @@ from frappe.query_builder.functions import Now
|
|||
|
||||
|
||||
class ScheduledJobLog(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.Code | None
|
||||
scheduled_job_type: DF.Link
|
||||
status: DF.Literal["Scheduled", "Complete", "Failed"]
|
||||
# end: auto-generated types
|
||||
@staticmethod
|
||||
def clear_old_logs(days=90):
|
||||
table = frappe.qb.DocType("Scheduled Job Log")
|
||||
|
|
|
|||
|
|
@ -14,6 +14,36 @@ from frappe.utils.background_jobs import enqueue, is_job_enqueued
|
|||
|
||||
|
||||
class ScheduledJobType(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
|
||||
|
||||
create_log: DF.Check
|
||||
cron_format: DF.Data | None
|
||||
frequency: DF.Literal[
|
||||
"All",
|
||||
"Hourly",
|
||||
"Hourly Long",
|
||||
"Daily",
|
||||
"Daily Long",
|
||||
"Weekly",
|
||||
"Weekly Long",
|
||||
"Monthly",
|
||||
"Monthly Long",
|
||||
"Cron",
|
||||
"Yearly",
|
||||
"Annual",
|
||||
]
|
||||
last_execution: DF.Datetime | None
|
||||
method: DF.Data
|
||||
next_execution: DF.Datetime | None
|
||||
server_script: DF.Link | None
|
||||
stopped: DF.Check
|
||||
# end: auto-generated types
|
||||
def autoname(self):
|
||||
self.name = ".".join(self.method.split(".")[-2:])
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,55 @@ from frappe.utils.safe_exec import NamespaceDict, get_safe_globals, safe_exec
|
|||
|
||||
|
||||
class ServerScript(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_guest: DF.Check
|
||||
api_method: DF.Data | None
|
||||
cron_format: DF.Data | None
|
||||
disabled: DF.Check
|
||||
doctype_event: DF.Literal[
|
||||
"Before Insert",
|
||||
"Before Validate",
|
||||
"Before Save",
|
||||
"After Insert",
|
||||
"After Save",
|
||||
"Before Submit",
|
||||
"After Submit",
|
||||
"Before Cancel",
|
||||
"After Cancel",
|
||||
"Before Delete",
|
||||
"After Delete",
|
||||
"Before Save (Submitted Document)",
|
||||
"After Save (Submitted Document)",
|
||||
"On Payment Authorization",
|
||||
]
|
||||
enable_rate_limit: DF.Check
|
||||
event_frequency: DF.Literal[
|
||||
"All",
|
||||
"Hourly",
|
||||
"Daily",
|
||||
"Weekly",
|
||||
"Monthly",
|
||||
"Yearly",
|
||||
"Hourly Long",
|
||||
"Daily Long",
|
||||
"Weekly Long",
|
||||
"Monthly Long",
|
||||
"Cron",
|
||||
]
|
||||
module: DF.Link | None
|
||||
rate_limit_count: DF.Int
|
||||
rate_limit_seconds: DF.Int
|
||||
reference_doctype: DF.Link | None
|
||||
script: DF.Code
|
||||
script_type: DF.Literal["DocType Event", "Scheduler Event", "Permission Query", "API"]
|
||||
# end: auto-generated types
|
||||
def validate(self):
|
||||
frappe.only_for("Script Manager", True)
|
||||
self.sync_scheduled_jobs()
|
||||
|
|
|
|||
|
|
@ -6,4 +6,17 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class SessionDefault(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
|
||||
ref_doctype: DF.Link | None
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -9,6 +9,17 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class SessionDefaultSettings(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.core.doctype.session_default.session_default import SessionDefault
|
||||
from frappe.types import DF
|
||||
|
||||
session_defaults: DF.Table[SessionDefault]
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -5,4 +5,19 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class SMSParameter(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
|
||||
|
||||
header: DF.Check
|
||||
parameter: DF.Data
|
||||
parent: DF.Data
|
||||
parentfield: DF.Data
|
||||
parenttype: DF.Data
|
||||
value: DF.Data
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -8,6 +8,21 @@ from frappe.utils import nowdate
|
|||
|
||||
|
||||
class SMSSettings(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.core.doctype.sms_parameter.sms_parameter import SMSParameter
|
||||
from frappe.types import DF
|
||||
|
||||
message_parameter: DF.Data
|
||||
parameters: DF.Table[SMSParameter]
|
||||
receiver_parameter: DF.Data
|
||||
sms_gateway_url: DF.SmallText
|
||||
use_post: DF.Check
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,23 @@ from frappe.utils.data import cint
|
|||
|
||||
|
||||
class SubmissionQueue(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
|
||||
|
||||
created_at: DF.Datetime | None
|
||||
ended_at: DF.Datetime | None
|
||||
enqueued_by: DF.Data | None
|
||||
exception: DF.LongText | None
|
||||
job_id: DF.Link | None
|
||||
ref_docname: DF.DynamicLink | None
|
||||
ref_doctype: DF.Link | None
|
||||
status: DF.Literal["Queued", "Finished", "Failed"]
|
||||
# end: auto-generated types
|
||||
@property
|
||||
def created_at(self):
|
||||
return self.creation
|
||||
|
|
|
|||
|
|
@ -5,4 +5,18 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class SuccessAction(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
|
||||
|
||||
action_timeout: DF.Int
|
||||
first_success_message: DF.Data
|
||||
message: DF.Data
|
||||
next_actions: DF.Data | None
|
||||
ref_doctype: DF.Link
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -9,6 +9,88 @@ from frappe.utils import cint, today
|
|||
|
||||
|
||||
class SystemSettings(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_consecutive_login_attempts: DF.Int
|
||||
allow_error_traceback: DF.Check
|
||||
allow_guests_to_upload_files: DF.Check
|
||||
allow_login_after_fail: DF.Int
|
||||
allow_login_using_mobile_number: DF.Check
|
||||
allow_login_using_user_name: DF.Check
|
||||
allow_older_web_view_links: DF.Check
|
||||
app_name: DF.Data | None
|
||||
apply_strict_user_permissions: DF.Check
|
||||
attach_view_link: DF.Check
|
||||
backup_limit: DF.Int
|
||||
bypass_2fa_for_retricted_ip_users: DF.Check
|
||||
bypass_restrict_ip_check_if_2fa_enabled: DF.Check
|
||||
country: DF.Link | None
|
||||
currency_precision: DF.Literal["", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
|
||||
date_format: DF.Literal[
|
||||
"yyyy-mm-dd", "dd-mm-yyyy", "dd/mm/yyyy", "dd.mm.yyyy", "mm/dd/yyyy", "mm-dd-yyyy"
|
||||
]
|
||||
deny_multiple_sessions: DF.Check
|
||||
disable_change_log_notification: DF.Check
|
||||
disable_document_sharing: DF.Check
|
||||
disable_standard_email_footer: DF.Check
|
||||
disable_system_update_notification: DF.Check
|
||||
disable_user_pass_login: DF.Check
|
||||
document_share_key_expiry: DF.Int
|
||||
dormant_days: DF.Int
|
||||
email_footer_address: DF.SmallText | None
|
||||
email_retry_limit: DF.Int
|
||||
enable_onboarding: DF.Check
|
||||
enable_password_policy: DF.Check
|
||||
enable_scheduler: DF.Check
|
||||
enable_telemetry: DF.Check
|
||||
enable_two_factor_auth: DF.Check
|
||||
encrypt_backup: DF.Check
|
||||
first_day_of_the_week: DF.Literal[
|
||||
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
|
||||
]
|
||||
float_precision: DF.Literal["", "2", "3", "4", "5", "6", "7", "8", "9"]
|
||||
force_user_to_reset_password: DF.Int
|
||||
hide_footer_in_auto_email_reports: DF.Check
|
||||
language: DF.Link
|
||||
lifespan_qrcode_image: DF.Int
|
||||
login_with_email_link: DF.Check
|
||||
login_with_email_link_expiry: DF.Int
|
||||
logout_on_password_reset: DF.Check
|
||||
max_auto_email_report_per_user: DF.Int
|
||||
minimum_password_score: DF.Literal["2", "3", "4"]
|
||||
number_format: DF.Literal[
|
||||
"#,###.##",
|
||||
"#.###,##",
|
||||
"# ###.##",
|
||||
"# ###,##",
|
||||
"#'###.##",
|
||||
"#, ###.##",
|
||||
"#,##,###.##",
|
||||
"#,###.###",
|
||||
"#.###",
|
||||
"#,###",
|
||||
]
|
||||
otp_issuer_name: DF.Data | None
|
||||
password_reset_limit: DF.Int
|
||||
reset_password_link_expiry_duration: DF.Duration | None
|
||||
reset_password_template: DF.Link | None
|
||||
rounding_method: DF.Literal[
|
||||
"Banker's Rounding (legacy)", "Banker's Rounding", "Commercial Rounding"
|
||||
]
|
||||
session_expiry: DF.Data | None
|
||||
setup_complete: DF.Check
|
||||
strip_exif_metadata_from_uploaded_images: DF.Check
|
||||
time_format: DF.Literal["HH:mm:ss", "HH:mm"]
|
||||
time_zone: DF.Literal
|
||||
two_factor_method: DF.Literal["OTP App", "SMS", "Email"]
|
||||
welcome_email_template: DF.Link | None
|
||||
# end: auto-generated types
|
||||
def validate(self):
|
||||
from frappe.twofactor import toggle_two_factor_auth
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,25 @@ from frappe.utils import cint, now_datetime
|
|||
|
||||
|
||||
class TransactionLog(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
|
||||
chaining_hash: DF.SmallText | None
|
||||
checksum_version: DF.Data | None
|
||||
data: DF.LongText | None
|
||||
document_name: DF.Data | None
|
||||
previous_hash: DF.SmallText | None
|
||||
reference_doctype: DF.Data | None
|
||||
row_index: DF.Data | None
|
||||
timestamp: DF.Datetime | None
|
||||
transaction_hash: DF.SmallText | None
|
||||
# end: auto-generated types
|
||||
def before_insert(self):
|
||||
index = get_current_index()
|
||||
self.row_index = index
|
||||
|
|
|
|||
|
|
@ -10,6 +10,22 @@ from frappe.utils import is_html, strip_html_tags
|
|||
|
||||
|
||||
class Translation(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
|
||||
|
||||
context: DF.Data | None
|
||||
contributed: DF.Check
|
||||
contribution_docname: DF.Data | None
|
||||
contribution_status: DF.Literal["", "Pending", "Verified", "Rejected"]
|
||||
language: DF.Link
|
||||
source_text: DF.Code
|
||||
translated_text: DF.Code
|
||||
# end: auto-generated types
|
||||
def validate(self):
|
||||
if is_html(self.source_text):
|
||||
self.remove_html_from_source()
|
||||
|
|
|
|||
|
|
@ -37,6 +37,80 @@ from frappe.website.utils import is_signup_disabled
|
|||
|
||||
|
||||
class User(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.core.doctype.block_module.block_module import BlockModule
|
||||
from frappe.core.doctype.defaultvalue.defaultvalue import DefaultValue
|
||||
from frappe.core.doctype.has_role.has_role import HasRole
|
||||
from frappe.core.doctype.user_email.user_email import UserEmail
|
||||
from frappe.core.doctype.user_social_login.user_social_login import UserSocialLogin
|
||||
from frappe.types import DF
|
||||
|
||||
allowed_in_mentions: DF.Check
|
||||
api_key: DF.Data | None
|
||||
api_secret: DF.Password | None
|
||||
banner_image: DF.AttachImage | None
|
||||
bio: DF.Text | None
|
||||
birth_date: DF.Date | None
|
||||
block_modules: DF.Table[BlockModule]
|
||||
bypass_restrict_ip_check_if_2fa_enabled: DF.Check
|
||||
defaults: DF.Table[DefaultValue]
|
||||
desk_theme: DF.Literal["Light", "Dark", "Automatic"]
|
||||
document_follow_frequency: DF.Literal["Hourly", "Daily", "Weekly"]
|
||||
document_follow_notify: DF.Check
|
||||
email: DF.Data
|
||||
email_signature: DF.SmallText | None
|
||||
enabled: DF.Check
|
||||
first_name: DF.Data
|
||||
follow_assigned_documents: DF.Check
|
||||
follow_commented_documents: DF.Check
|
||||
follow_created_documents: DF.Check
|
||||
follow_liked_documents: DF.Check
|
||||
follow_shared_documents: DF.Check
|
||||
full_name: DF.Data | None
|
||||
gender: DF.Link | None
|
||||
home_settings: DF.Code | None
|
||||
interest: DF.SmallText | None
|
||||
language: DF.Link | None
|
||||
last_active: DF.Datetime | None
|
||||
last_ip: DF.ReadOnly | None
|
||||
last_known_versions: DF.Text | None
|
||||
last_login: DF.ReadOnly | None
|
||||
last_name: DF.Data | None
|
||||
last_password_reset_date: DF.Date | None
|
||||
last_reset_password_key_generated_on: DF.Datetime | None
|
||||
location: DF.Data | None
|
||||
login_after: DF.Int
|
||||
login_before: DF.Int
|
||||
logout_all_sessions: DF.Check
|
||||
middle_name: DF.Data | None
|
||||
mobile_no: DF.Data | None
|
||||
module_profile: DF.Link | None
|
||||
mute_sounds: DF.Check
|
||||
new_password: DF.Password | None
|
||||
onboarding_status: DF.SmallText | None
|
||||
phone: DF.Data | None
|
||||
redirect_url: DF.SmallText | None
|
||||
reset_password_key: DF.Data | None
|
||||
restrict_ip: DF.SmallText | None
|
||||
role_profile_name: DF.Link | None
|
||||
roles: DF.Table[HasRole]
|
||||
send_me_a_copy: DF.Check
|
||||
send_welcome_email: DF.Check
|
||||
simultaneous_sessions: DF.Int
|
||||
social_logins: DF.Table[UserSocialLogin]
|
||||
thread_notify: DF.Check
|
||||
time_zone: DF.Literal
|
||||
unsubscribed: DF.Check
|
||||
user_emails: DF.Table[UserEmail]
|
||||
user_image: DF.AttachImage | None
|
||||
user_type: DF.Link | None
|
||||
username: DF.Data | None
|
||||
# end: auto-generated types
|
||||
__new_password = None
|
||||
|
||||
def __setup__(self):
|
||||
|
|
|
|||
|
|
@ -6,4 +6,25 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class UserDocumentType(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
|
||||
|
||||
amend: DF.Check
|
||||
cancel: DF.Check
|
||||
create: DF.Check
|
||||
delete: DF.Check
|
||||
document_type: DF.Link
|
||||
is_custom: DF.Check
|
||||
parent: DF.Data
|
||||
parentfield: DF.Data
|
||||
parenttype: DF.Data
|
||||
read: DF.Check
|
||||
submit: DF.Check
|
||||
write: DF.Check
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -5,4 +5,21 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class UserEmail(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
|
||||
|
||||
awaiting_password: DF.Check
|
||||
email_account: DF.Link
|
||||
email_id: DF.Data | None
|
||||
enable_outgoing: DF.Check
|
||||
parent: DF.Data
|
||||
parentfield: DF.Data
|
||||
parenttype: DF.Data
|
||||
used_oauth: DF.Check
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -8,6 +8,17 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class UserGroup(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.core.doctype.user_group_member.user_group_member import UserGroupMember
|
||||
from frappe.types import DF
|
||||
|
||||
user_group_members: DF.TableMultiSelect[UserGroupMember]
|
||||
# end: auto-generated types
|
||||
def after_insert(self):
|
||||
frappe.cache.delete_key("user_groups")
|
||||
|
||||
|
|
|
|||
|
|
@ -6,4 +6,17 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class UserGroupMember(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
|
||||
user: DF.Link
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -12,6 +12,22 @@ from frappe.utils import cstr
|
|||
|
||||
|
||||
class UserPermission(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: DF.Link
|
||||
applicable_for: DF.Link | None
|
||||
apply_to_all_doctypes: DF.Check
|
||||
for_value: DF.DynamicLink
|
||||
hide_descendants: DF.Check
|
||||
is_default: DF.Check
|
||||
user: DF.Link
|
||||
# end: auto-generated types
|
||||
def validate(self):
|
||||
self.validate_user_permission()
|
||||
self.validate_default_permission()
|
||||
|
|
|
|||
|
|
@ -6,4 +6,17 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class UserSelectDocumentType(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
|
||||
|
||||
document_type: DF.Link
|
||||
parent: DF.Data
|
||||
parentfield: DF.Data
|
||||
parenttype: DF.Data
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -5,4 +5,19 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class UserSocialLogin(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
|
||||
provider: DF.Data | None
|
||||
userid: DF.Data | None
|
||||
username: DF.Data | None
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -10,6 +10,28 @@ from frappe.utils import get_link_to_form
|
|||
|
||||
|
||||
class UserType(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.core.doctype.user_document_type.user_document_type import UserDocumentType
|
||||
from frappe.core.doctype.user_select_document_type.user_select_document_type import (
|
||||
UserSelectDocumentType,
|
||||
)
|
||||
from frappe.core.doctype.user_type_module.user_type_module import UserTypeModule
|
||||
from frappe.types import DF
|
||||
|
||||
apply_user_permission_on: DF.Link | None
|
||||
custom_select_doctypes: DF.Table[UserSelectDocumentType]
|
||||
is_standard: DF.Check
|
||||
role: DF.Link | None
|
||||
select_doctypes: DF.Table[UserSelectDocumentType]
|
||||
user_doctypes: DF.Table[UserDocumentType]
|
||||
user_id_field: DF.Literal
|
||||
user_type_modules: DF.Table[UserTypeModule]
|
||||
# end: auto-generated types
|
||||
def validate(self):
|
||||
self.set_modules()
|
||||
self.add_select_perm_doctypes()
|
||||
|
|
|
|||
|
|
@ -6,4 +6,17 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class UserTypeModule(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
|
||||
|
||||
module: DF.Link
|
||||
parent: DF.Data
|
||||
parentfield: DF.Data
|
||||
parenttype: DF.Data
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -9,6 +9,18 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class Version(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
|
||||
|
||||
data: DF.Code | None
|
||||
docname: DF.Data
|
||||
ref_doctype: DF.Link
|
||||
# end: auto-generated types
|
||||
def update_version_info(self, old: Document | None, new: Document) -> bool:
|
||||
"""Update changed info and return true if change contains useful data."""
|
||||
if not old:
|
||||
|
|
|
|||
|
|
@ -6,6 +6,18 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class ViewLog(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
|
||||
|
||||
reference_doctype: DF.Link | None
|
||||
reference_name: DF.DynamicLink | None
|
||||
viewed_by: DF.Data | None
|
||||
# end: auto-generated types
|
||||
@staticmethod
|
||||
def clear_old_logs(days=180):
|
||||
from frappe.query_builder import Interval
|
||||
|
|
|
|||
|
|
@ -5,6 +5,20 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class ClientScript(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
|
||||
|
||||
dt: DF.Link
|
||||
enabled: DF.Check
|
||||
module: DF.Link | None
|
||||
script: DF.Code | None
|
||||
view: DF.Literal["List", "Form"]
|
||||
# end: auto-generated types
|
||||
def on_update(self):
|
||||
frappe.clear_cache(doctype=self.dt)
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,107 @@ from frappe.utils import cstr, random_string
|
|||
|
||||
|
||||
class CustomField(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_in_quick_entry: DF.Check
|
||||
allow_on_submit: DF.Check
|
||||
bold: DF.Check
|
||||
collapsible: DF.Check
|
||||
collapsible_depends_on: DF.Code | None
|
||||
columns: DF.Int
|
||||
default: DF.Text | None
|
||||
depends_on: DF.Code | None
|
||||
description: DF.Text | None
|
||||
dt: DF.Link
|
||||
fetch_from: DF.SmallText | None
|
||||
fetch_if_empty: DF.Check
|
||||
fieldname: DF.Data | None
|
||||
fieldtype: DF.Literal[
|
||||
"Autocomplete",
|
||||
"Attach",
|
||||
"Attach Image",
|
||||
"Barcode",
|
||||
"Button",
|
||||
"Check",
|
||||
"Code",
|
||||
"Color",
|
||||
"Column Break",
|
||||
"Currency",
|
||||
"Data",
|
||||
"Date",
|
||||
"Datetime",
|
||||
"Duration",
|
||||
"Dynamic Link",
|
||||
"Float",
|
||||
"Fold",
|
||||
"Geolocation",
|
||||
"Heading",
|
||||
"HTML",
|
||||
"HTML Editor",
|
||||
"Icon",
|
||||
"Image",
|
||||
"Int",
|
||||
"JSON",
|
||||
"Link",
|
||||
"Long Text",
|
||||
"Markdown Editor",
|
||||
"Password",
|
||||
"Percent",
|
||||
"Phone",
|
||||
"Read Only",
|
||||
"Rating",
|
||||
"Section Break",
|
||||
"Select",
|
||||
"Signature",
|
||||
"Small Text",
|
||||
"Tab Break",
|
||||
"Table",
|
||||
"Table MultiSelect",
|
||||
"Text",
|
||||
"Text Editor",
|
||||
"Time",
|
||||
]
|
||||
hidden: DF.Check
|
||||
hide_border: DF.Check
|
||||
hide_days: DF.Check
|
||||
hide_seconds: DF.Check
|
||||
ignore_user_permissions: DF.Check
|
||||
ignore_xss_filter: DF.Check
|
||||
in_global_search: DF.Check
|
||||
in_list_view: DF.Check
|
||||
in_preview: DF.Check
|
||||
in_standard_filter: DF.Check
|
||||
insert_after: DF.Literal
|
||||
is_system_generated: DF.Check
|
||||
is_virtual: DF.Check
|
||||
label: DF.Data | None
|
||||
length: DF.Int
|
||||
mandatory_depends_on: DF.Code | None
|
||||
module: DF.Link | None
|
||||
no_copy: DF.Check
|
||||
non_negative: DF.Check
|
||||
options: DF.SmallText | None
|
||||
permlevel: DF.Int
|
||||
precision: DF.Literal["", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
|
||||
print_hide: DF.Check
|
||||
print_hide_if_no_value: DF.Check
|
||||
print_width: DF.Data | None
|
||||
read_only: DF.Check
|
||||
read_only_depends_on: DF.Code | None
|
||||
report_hide: DF.Check
|
||||
reqd: DF.Check
|
||||
search_index: DF.Check
|
||||
sort_options: DF.Check
|
||||
translatable: DF.Check
|
||||
unique: DF.Check
|
||||
width: DF.Data | None
|
||||
# end: auto-generated types
|
||||
def autoname(self):
|
||||
self.set_fieldname()
|
||||
self.name = self.dt + "-" + self.fieldname
|
||||
|
|
|
|||
|
|
@ -25,6 +25,63 @@ from frappe.utils import cint
|
|||
|
||||
|
||||
class CustomizeForm(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.core.doctype.doctype_action.doctype_action import DocTypeAction
|
||||
from frappe.core.doctype.doctype_link.doctype_link import DocTypeLink
|
||||
from frappe.core.doctype.doctype_state.doctype_state import DocTypeState
|
||||
from frappe.custom.doctype.customize_form_field.customize_form_field import CustomizeFormField
|
||||
from frappe.types import DF
|
||||
|
||||
actions: DF.Table[DocTypeAction]
|
||||
allow_auto_repeat: DF.Check
|
||||
allow_copy: DF.Check
|
||||
allow_import: DF.Check
|
||||
autoname: DF.Data | None
|
||||
default_email_template: DF.Link | None
|
||||
default_print_format: DF.Link | None
|
||||
default_view: DF.Literal
|
||||
doc_type: DF.Link | None
|
||||
editable_grid: DF.Check
|
||||
email_append_to: DF.Check
|
||||
fields: DF.Table[CustomizeFormField]
|
||||
force_re_route_to_default_view: DF.Check
|
||||
image_field: DF.Data | None
|
||||
is_calendar_and_gantt: DF.Check
|
||||
istable: DF.Check
|
||||
label: DF.Data | None
|
||||
links: DF.Table[DocTypeLink]
|
||||
make_attachments_public: DF.Check
|
||||
max_attachments: DF.Int
|
||||
naming_rule: DF.Literal[
|
||||
"",
|
||||
"Set by user",
|
||||
"By fieldname",
|
||||
'By "Naming Series" field',
|
||||
"Expression",
|
||||
"Expression (old style)",
|
||||
"Random",
|
||||
"By script",
|
||||
]
|
||||
queue_in_background: DF.Check
|
||||
quick_entry: DF.Check
|
||||
search_fields: DF.Data | None
|
||||
sender_field: DF.Data | None
|
||||
show_preview_popup: DF.Check
|
||||
show_title_field_in_link: DF.Check
|
||||
sort_field: DF.Literal
|
||||
sort_order: DF.Literal["ASC", "DESC"]
|
||||
states: DF.Table[DocTypeState]
|
||||
subject_field: DF.Data | None
|
||||
title_field: DF.Data | None
|
||||
track_changes: DF.Check
|
||||
track_views: DF.Check
|
||||
translated_doctype: DF.Check
|
||||
# end: auto-generated types
|
||||
def on_update(self):
|
||||
frappe.db.delete("Singles", {"doctype": "Customize Form"})
|
||||
frappe.db.delete("Customize Form Field")
|
||||
|
|
|
|||
|
|
@ -5,4 +5,108 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class CustomizeFormField(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_bulk_edit: DF.Check
|
||||
allow_in_quick_entry: DF.Check
|
||||
allow_on_submit: DF.Check
|
||||
bold: DF.Check
|
||||
collapsible: DF.Check
|
||||
collapsible_depends_on: DF.Code | None
|
||||
columns: DF.Int
|
||||
default: DF.SmallText | None
|
||||
depends_on: DF.Code | None
|
||||
description: DF.Text | None
|
||||
fetch_from: DF.SmallText | None
|
||||
fetch_if_empty: DF.Check
|
||||
fieldname: DF.Data | None
|
||||
fieldtype: DF.Literal[
|
||||
"Autocomplete",
|
||||
"Attach",
|
||||
"Attach Image",
|
||||
"Barcode",
|
||||
"Button",
|
||||
"Check",
|
||||
"Code",
|
||||
"Color",
|
||||
"Column Break",
|
||||
"Currency",
|
||||
"Data",
|
||||
"Date",
|
||||
"Datetime",
|
||||
"Duration",
|
||||
"Dynamic Link",
|
||||
"Float",
|
||||
"Fold",
|
||||
"Geolocation",
|
||||
"Heading",
|
||||
"HTML",
|
||||
"HTML Editor",
|
||||
"Icon",
|
||||
"Image",
|
||||
"Int",
|
||||
"Link",
|
||||
"Long Text",
|
||||
"Markdown Editor",
|
||||
"Password",
|
||||
"Percent",
|
||||
"Phone",
|
||||
"Rating",
|
||||
"Read Only",
|
||||
"Section Break",
|
||||
"Select",
|
||||
"Signature",
|
||||
"Small Text",
|
||||
"Tab Break",
|
||||
"Table",
|
||||
"Table MultiSelect",
|
||||
"Text",
|
||||
"Text Editor",
|
||||
"Time",
|
||||
]
|
||||
hidden: DF.Check
|
||||
hide_border: DF.Check
|
||||
hide_days: DF.Check
|
||||
hide_seconds: DF.Check
|
||||
ignore_user_permissions: DF.Check
|
||||
ignore_xss_filter: DF.Check
|
||||
in_filter: DF.Check
|
||||
in_global_search: DF.Check
|
||||
in_list_view: DF.Check
|
||||
in_preview: DF.Check
|
||||
in_standard_filter: DF.Check
|
||||
is_custom_field: DF.Check
|
||||
is_system_generated: DF.Check
|
||||
is_virtual: DF.Check
|
||||
label: DF.Data | None
|
||||
length: DF.Int
|
||||
mandatory_depends_on: DF.Code | None
|
||||
no_copy: DF.Check
|
||||
non_negative: DF.Check
|
||||
options: DF.SmallText | None
|
||||
parent: DF.Data
|
||||
parentfield: DF.Data
|
||||
parenttype: DF.Data
|
||||
permlevel: DF.Int
|
||||
precision: DF.Literal["", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
|
||||
print_hide: DF.Check
|
||||
print_hide_if_no_value: DF.Check
|
||||
print_width: DF.Data | None
|
||||
read_only: DF.Check
|
||||
read_only_depends_on: DF.Code | None
|
||||
remember_last_selected_value: DF.Check
|
||||
report_hide: DF.Check
|
||||
reqd: DF.Check
|
||||
show_dashboard: DF.Check
|
||||
sort_options: DF.Check
|
||||
translatable: DF.Check
|
||||
unique: DF.Check
|
||||
width: DF.Data | None
|
||||
# end: auto-generated types
|
||||
pass
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue