Added app formula editor
This commit is contained in:
parent
ea92b6e9a9
commit
a1849cdd4c
|
|
@ -0,0 +1,24 @@
|
|||
import frappe
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_doctype_fields(doctype):
|
||||
meta = frappe.get_meta(doctype)
|
||||
fields = []
|
||||
|
||||
# Получаем все int-поля
|
||||
for field in meta.fields:
|
||||
if field.fieldtype in ["Int", "Float", "Currency"]:
|
||||
fields.append({"fieldname": field.fieldname, "label": field.label})
|
||||
|
||||
# Проверяем таблицы внутри DocType (например, `items` в `Sales Invoice`)
|
||||
for child in meta.fields:
|
||||
if child.fieldtype == "Table":
|
||||
child_meta = frappe.get_meta(child.options)
|
||||
for sub_field in child_meta.fields:
|
||||
if sub_field.fieldtype in ["Int", "Float", "Currency"]:
|
||||
fields.append({
|
||||
"fieldname": f"{child.fieldname}_{sub_field.fieldname}",
|
||||
"label": f"{child.label} → {sub_field.label}"
|
||||
})
|
||||
|
||||
return fields
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,59 @@
|
|||
{
|
||||
"actions": [],
|
||||
"allow_rename": 1,
|
||||
"creation": "2025-02-27 19:10:10.533620",
|
||||
"doctype": "DocType",
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"target_doctype",
|
||||
"formula_storage",
|
||||
"formula_fields",
|
||||
"test"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "target_doctype",
|
||||
"fieldtype": "Link",
|
||||
"label": "target_doctype",
|
||||
"options": "DocType"
|
||||
},
|
||||
{
|
||||
"fieldname": "formula_storage",
|
||||
"fieldtype": "Text",
|
||||
"label": "formula_storage"
|
||||
},
|
||||
{
|
||||
"fieldname": "formula_fields",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "formula_fields"
|
||||
},
|
||||
{
|
||||
"fieldname": "test",
|
||||
"fieldtype": "HTML"
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2025-02-27 19:12:22.113845",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Formula Editor",
|
||||
"name": "Formula Editor",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"sort_field": "creation",
|
||||
"sort_order": "DESC",
|
||||
"states": []
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
# Copyright (c) 2025, Jey ERP and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
|
||||
class FormulaEditor(Document):
|
||||
pass
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
# Copyright (c) 2025, Jey ERP and Contributors
|
||||
# See license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
# On IntegrationTestCase, the doctype test records and all
|
||||
# link-field test record depdendencies are recursively loaded
|
||||
# Use these module variables to add/remove to/from that list
|
||||
EXTRA_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"]
|
||||
IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"]
|
||||
|
||||
|
||||
class UnitTestformula_editor(UnitTestCase):
|
||||
"""
|
||||
Unit tests for formula_editor.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class IntegrationTestformula_editor(IntegrationTestCase):
|
||||
"""
|
||||
Integration tests for formula_editor.
|
||||
Use this class for testing interactions between multiple components.
|
||||
"""
|
||||
|
||||
pass
|
||||
Loading…
Reference in New Issue