mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-05 21:29:11 +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:
@@ -8,6 +8,24 @@ from frappe.website.utils import delete_page_cache
|
||||
|
||||
|
||||
class Homepage(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
|
||||
|
||||
company: DF.Link
|
||||
description: DF.Text
|
||||
hero_image: DF.AttachImage | None
|
||||
hero_section: DF.Link | None
|
||||
hero_section_based_on: DF.Literal["Default", "Slideshow", "Homepage Section"]
|
||||
slideshow: DF.Link | None
|
||||
tag_line: DF.Data
|
||||
title: DF.Data | None
|
||||
# end: auto-generated types
|
||||
|
||||
def validate(self):
|
||||
if not self.description:
|
||||
self.description = frappe._("This is an example website auto-generated from ERPNext")
|
||||
|
||||
@@ -7,6 +7,25 @@ from frappe.utils import cint
|
||||
|
||||
|
||||
class HomepageSection(Document):
|
||||
# begin: auto-generated types
|
||||
# This code is auto-generated. Do not modify anything in this block.
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from frappe.types import DF
|
||||
|
||||
from erpnext.portal.doctype.homepage_section_card.homepage_section_card import (
|
||||
HomepageSectionCard,
|
||||
)
|
||||
|
||||
no_of_columns: DF.Literal["1", "2", "3", "4", "6"]
|
||||
section_based_on: DF.Literal["Cards", "Custom HTML"]
|
||||
section_cards: DF.Table[HomepageSectionCard]
|
||||
section_html: DF.Code | None
|
||||
section_order: DF.Int
|
||||
# end: auto-generated types
|
||||
|
||||
@property
|
||||
def column_value(self):
|
||||
return cint(12 / cint(self.no_of_columns or 3))
|
||||
|
||||
@@ -6,4 +6,22 @@ from frappe.model.document import Document
|
||||
|
||||
|
||||
class HomepageSectionCard(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
|
||||
|
||||
content: DF.Text | None
|
||||
image: DF.AttachImage | None
|
||||
parent: DF.Data
|
||||
parentfield: DF.Data
|
||||
parenttype: DF.Data
|
||||
route: DF.Data | None
|
||||
subtitle: DF.Data | None
|
||||
title: DF.Data
|
||||
# end: auto-generated types
|
||||
|
||||
pass
|
||||
|
||||
@@ -6,4 +6,18 @@ from frappe.model.document import Document
|
||||
|
||||
|
||||
class WebsiteAttribute(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
|
||||
|
||||
attribute: DF.Link
|
||||
parent: DF.Data
|
||||
parentfield: DF.Data
|
||||
parenttype: DF.Data
|
||||
# end: auto-generated types
|
||||
|
||||
pass
|
||||
|
||||
@@ -6,4 +6,18 @@ from frappe.model.document import Document
|
||||
|
||||
|
||||
class WebsiteFilterField(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.Autocomplete | None
|
||||
parent: DF.Data
|
||||
parentfield: DF.Data
|
||||
parenttype: DF.Data
|
||||
# end: auto-generated types
|
||||
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user