mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-01 11:19:09 +00:00
feat: enable automatic type annotations (#38452)
(cherry picked from commit 63313eef6f)
Co-authored-by: Ankush Menat <ankush@frappe.io>
This commit is contained in:
@@ -6,4 +6,18 @@ from frappe.model.document import Document
|
||||
|
||||
|
||||
class PortalUser(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
|
||||
|
||||
@@ -10,6 +10,18 @@ from frappe.model.rename_doc import bulk_rename
|
||||
|
||||
|
||||
class RenameTool(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
|
||||
|
||||
file_to_rename: DF.Attach | None
|
||||
select_doctype: DF.Literal
|
||||
# end: auto-generated types
|
||||
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@@ -6,4 +6,21 @@ from frappe.model.document import Document
|
||||
|
||||
|
||||
class SMSLog(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
|
||||
|
||||
message: DF.SmallText | None
|
||||
no_of_requested_sms: DF.Int
|
||||
no_of_sent_sms: DF.Int
|
||||
requested_numbers: DF.Code | None
|
||||
sender_name: DF.Data | None
|
||||
sent_on: DF.Date | None
|
||||
sent_to: DF.Code | None
|
||||
# end: auto-generated types
|
||||
|
||||
pass
|
||||
|
||||
@@ -15,6 +15,28 @@ from pyyoutube import Api
|
||||
|
||||
|
||||
class Video(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_count: DF.Float
|
||||
description: DF.TextEditor
|
||||
dislike_count: DF.Float
|
||||
duration: DF.Duration | None
|
||||
image: DF.AttachImage | None
|
||||
like_count: DF.Float
|
||||
provider: DF.Literal["YouTube", "Vimeo"]
|
||||
publish_date: DF.Date | None
|
||||
title: DF.Data
|
||||
url: DF.Data
|
||||
view_count: DF.Float
|
||||
youtube_video_id: DF.Data | None
|
||||
# end: auto-generated types
|
||||
|
||||
def validate(self):
|
||||
if self.provider == "YouTube" and is_tracking_enabled():
|
||||
self.set_video_id()
|
||||
|
||||
@@ -9,6 +9,19 @@ from frappe.model.document import Document
|
||||
|
||||
|
||||
class VideoSettings(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
|
||||
|
||||
api_key: DF.Data | None
|
||||
enable_youtube_tracking: DF.Check
|
||||
frequency: DF.Literal["30 mins", "1 hr", "6 hrs", "Daily"]
|
||||
# end: auto-generated types
|
||||
|
||||
def validate(self):
|
||||
self.validate_youtube_api_key()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user