feat: add setting to hide Subscription references across doctypes (#54576)

This commit is contained in:
Jatin3128
2026-04-28 13:09:50 +05:30
committed by GitHub
parent f14751d538
commit 15b6633fc3
14 changed files with 111 additions and 77 deletions

View File

@@ -16,6 +16,7 @@
"invoicing_features_section", "invoicing_features_section",
"check_supplier_invoice_uniqueness", "check_supplier_invoice_uniqueness",
"automatically_fetch_payment_terms", "automatically_fetch_payment_terms",
"enable_subscription",
"column_break_17", "column_break_17",
"enable_common_party_accounting", "enable_common_party_accounting",
"allow_multi_currency_invoices_against_single_party_account", "allow_multi_currency_invoices_against_single_party_account",

View File

@@ -77,6 +77,7 @@ class AccountsSettings(Document):
enable_immutable_ledger: DF.Check enable_immutable_ledger: DF.Check
enable_loyalty_point_program: DF.Check enable_loyalty_point_program: DF.Check
enable_party_matching: DF.Check enable_party_matching: DF.Check
enable_subscription: DF.Check
exchange_gain_loss_posting_date: DF.Literal["Invoice", "Payment", "Reconciliation Date"] exchange_gain_loss_posting_date: DF.Literal["Invoice", "Payment", "Reconciliation Date"]
fetch_payment_schedule_in_payment_request: DF.Check fetch_payment_schedule_in_payment_request: DF.Check
fetch_valuation_rate_for_internal_transaction: DF.Check fetch_valuation_rate_for_internal_transaction: DF.Check
@@ -142,6 +143,10 @@ class AccountsSettings(Document):
toggle_loyalty_point_program_section(not self.enable_loyalty_point_program) toggle_loyalty_point_program_section(not self.enable_loyalty_point_program)
clear_cache = True clear_cache = True
if old_doc.enable_subscription != self.enable_subscription:
toggle_subscription_sections(not self.enable_subscription)
clear_cache = True
if clear_cache: if clear_cache:
frappe.clear_cache() frappe.clear_cache()
@@ -234,6 +239,12 @@ def toggle_loyalty_point_program_section(hide):
create_property_setter_for_hiding_field(doctype, "loyalty_points_redemption", hide) create_property_setter_for_hiding_field(doctype, "loyalty_points_redemption", hide)
def toggle_subscription_sections(hide):
subscription_doctypes = frappe.get_hooks("subscription_doctypes")
for doctype in subscription_doctypes:
create_property_setter_for_hiding_field(doctype, "subscription_section", hide)
def create_property_setter_for_hiding_field(doctype, field_name, hide): def create_property_setter_for_hiding_field(doctype, field_name, hide):
make_property_setter( make_property_setter(
doctype, doctype,

View File

@@ -39,7 +39,7 @@
"clearance_date", "clearance_date",
"column_break_oizh", "column_break_oizh",
"user_remark", "user_remark",
"subscription_section", "auto_repeat_section",
"auto_repeat", "auto_repeat",
"tax_withholding_tab", "tax_withholding_tab",
"section_tax_withholding_entry", "section_tax_withholding_entry",
@@ -477,11 +477,6 @@
"options": "Stock Entry", "options": "Stock Entry",
"read_only": 1 "read_only": 1
}, },
{
"fieldname": "subscription_section",
"fieldtype": "Section Break",
"label": "Subscription"
},
{ {
"allow_on_submit": 1, "allow_on_submit": 1,
"fieldname": "auto_repeat", "fieldname": "auto_repeat",

View File

@@ -89,6 +89,7 @@
"remarks", "remarks",
"base_in_words", "base_in_words",
"is_opening", "is_opening",
"title",
"column_break_16", "column_break_16",
"letter_head", "letter_head",
"print_heading", "print_heading",
@@ -96,10 +97,9 @@
"bank_account_no", "bank_account_no",
"payment_order", "payment_order",
"in_words", "in_words",
"subscription_section",
"auto_repeat",
"amended_from", "amended_from",
"title" "auto_repeat_section",
"auto_repeat"
], ],
"fields": [ "fields": [
{ {
@@ -503,11 +503,6 @@
"print_hide": 1, "print_hide": 1,
"read_only": 1 "read_only": 1
}, },
{
"fieldname": "subscription_section",
"fieldtype": "Section Break",
"label": "Subscription Section"
},
{ {
"allow_on_submit": 1, "allow_on_submit": 1,
"fieldname": "auto_repeat", "fieldname": "auto_repeat",
@@ -781,6 +776,11 @@
"fieldname": "override_tax_withholding_entries", "fieldname": "override_tax_withholding_entries",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Edit Tax Withholding Entries" "label": "Edit Tax Withholding Entries"
},
{
"fieldname": "auto_repeat_section",
"fieldtype": "Section Break",
"label": "Auto Repeat"
} }
], ],
"grid_page_length": 50, "grid_page_length": 50,

View File

@@ -183,7 +183,7 @@
"depends_on": "eval:doc.is_a_subscription", "depends_on": "eval:doc.is_a_subscription",
"fieldname": "subscription_section", "fieldname": "subscription_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Subscription Section" "label": "Subscription"
}, },
{ {
"fieldname": "subscription_plans", "fieldname": "subscription_plans",
@@ -478,7 +478,7 @@
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"is_submittable": 1, "is_submittable": 1,
"links": [], "links": [],
"modified": "2026-01-13 12:53:00.963274", "modified": "2026-02-27 19:11:03.308896",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Payment Request", "name": "Payment Request",

View File

@@ -187,7 +187,7 @@
"subscription_section", "subscription_section",
"from_date", "from_date",
"to_date", "to_date",
"column_break_140", "auto_repeat_section",
"auto_repeat", "auto_repeat",
"update_auto_repeat_reference", "update_auto_repeat_reference",
"against_income_account" "against_income_account"
@@ -1462,7 +1462,7 @@
{ {
"fieldname": "subscription_section", "fieldname": "subscription_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Subscription Section" "label": "Subscription"
}, },
{ {
"allow_on_submit": 1, "allow_on_submit": 1,
@@ -1480,10 +1480,6 @@
"no_copy": 1, "no_copy": 1,
"print_hide": 1 "print_hide": 1
}, },
{
"fieldname": "column_break_140",
"fieldtype": "Column Break"
},
{ {
"allow_on_submit": 1, "allow_on_submit": 1,
"fieldname": "auto_repeat", "fieldname": "auto_repeat",
@@ -1619,12 +1615,17 @@
{ {
"fieldname": "column_break_bhao", "fieldname": "column_break_bhao",
"fieldtype": "Column Break" "fieldtype": "Column Break"
},
{
"fieldname": "auto_repeat_section",
"fieldtype": "Section Break",
"label": "Auto Repeat"
} }
], ],
"icon": "fa fa-file-text", "icon": "fa fa-file-text",
"is_submittable": 1, "is_submittable": 1,
"links": [], "links": [],
"modified": "2026-02-10 14:23:07.181782", "modified": "2026-03-02 07:32:47.667810",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "POS Invoice", "name": "POS Invoice",

View File

@@ -180,11 +180,12 @@
"unrealized_profit_loss_account", "unrealized_profit_loss_account",
"subscription_section", "subscription_section",
"subscription", "subscription",
"auto_repeat",
"update_auto_repeat_reference",
"column_break_114", "column_break_114",
"from_date", "from_date",
"to_date", "to_date",
"automation_section",
"auto_repeat",
"update_auto_repeat_reference",
"printing_settings", "printing_settings",
"letter_head", "letter_head",
"group_same_items", "group_same_items",
@@ -1675,6 +1676,12 @@
"fieldname": "totals_section", "fieldname": "totals_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Totals" "label": "Totals"
},
{
"collapsible": 1,
"fieldname": "automation_section",
"fieldtype": "Section Break",
"label": "Automation"
} }
], ],
"grid_page_length": 50, "grid_page_length": 50,

View File

@@ -91,9 +91,9 @@
"column_break_xjag", "column_break_xjag",
"base_rounding_adjustment", "base_rounding_adjustment",
"base_rounded_total", "base_rounded_total",
"section_break_vacb", "section_break_pxwz",
"total_advance", "total_advance",
"column_break_rdks", "column_break_iaso",
"outstanding_amount", "outstanding_amount",
"section_tax_withholding_entry", "section_tax_withholding_entry",
"tax_withholding_group", "tax_withholding_group",
@@ -199,6 +199,7 @@
"unrealized_profit_loss_account", "unrealized_profit_loss_account",
"against_income_account", "against_income_account",
"commission_section", "commission_section",
"column_break_rdiw",
"sales_partner", "sales_partner",
"amount_eligible_for_commission", "amount_eligible_for_commission",
"column_break10", "column_break10",
@@ -214,12 +215,14 @@
"language", "language",
"subscription_section", "subscription_section",
"subscription", "subscription",
"from_date",
"auto_repeat",
"column_break_140", "column_break_140",
"from_date",
"to_date", "to_date",
"automation_section",
"auto_repeat",
"update_auto_repeat_reference", "update_auto_repeat_reference",
"utm_analytics_section", "utm_analytics_section",
"column_break_rdke",
"utm_source", "utm_source",
"utm_medium", "utm_medium",
"column_break_ixxw", "column_break_ixxw",
@@ -2304,14 +2307,6 @@
"options": "fa fa-group", "options": "fa fa-group",
"print_hide": 1 "print_hide": 1
}, },
{
"fieldname": "section_break_vacb",
"fieldtype": "Section Break"
},
{
"fieldname": "column_break_rdks",
"fieldtype": "Column Break"
},
{ {
"fieldname": "column_break_ixxw", "fieldname": "column_break_ixxw",
"fieldtype": "Column Break" "fieldtype": "Column Break"
@@ -2321,6 +2316,28 @@
"fieldname": "utm_analytics_section", "fieldname": "utm_analytics_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "UTM Analytics" "label": "UTM Analytics"
},
{
"collapsible": 1,
"fieldname": "automation_section",
"fieldtype": "Section Break",
"label": "Automation"
},
{
"fieldname": "section_break_pxwz",
"fieldtype": "Section Break"
},
{
"fieldname": "column_break_rdke",
"fieldtype": "Column Break"
},
{
"fieldname": "column_break_rdiw",
"fieldtype": "Column Break"
},
{
"fieldname": "column_break_iaso",
"fieldtype": "Column Break"
} }
], ],
"grid_page_length": 50, "grid_page_length": 50,
@@ -2334,7 +2351,7 @@
"link_fieldname": "consolidated_invoice" "link_fieldname": "consolidated_invoice"
} }
], ],
"modified": "2026-03-09 17:15:30.931929", "modified": "2026-04-28 12:39:53.267755",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Sales Invoice", "name": "Sales Invoice",

View File

@@ -147,7 +147,7 @@
"column_break_86", "column_break_86",
"select_print_heading", "select_print_heading",
"language", "language",
"subscription_section", "auto_repeat_section",
"from_date", "from_date",
"to_date", "to_date",
"column_break_97", "column_break_97",
@@ -1013,12 +1013,6 @@
"label": "Print Language", "label": "Print Language",
"print_hide": 1 "print_hide": 1
}, },
{
"collapsible": 1,
"fieldname": "subscription_section",
"fieldtype": "Section Break",
"label": "Auto Repeat"
},
{ {
"allow_on_submit": 1, "allow_on_submit": 1,
"fieldname": "from_date", "fieldname": "from_date",
@@ -1309,6 +1303,12 @@
"fieldtype": "Time", "fieldtype": "Time",
"label": "Time", "label": "Time",
"mandatory_depends_on": "is_internal_supplier" "mandatory_depends_on": "is_internal_supplier"
},
{
"collapsible": 1,
"fieldname": "auto_repeat_section",
"fieldtype": "Section Break",
"label": "Auto Repeat"
} }
], ],
"grid_page_length": 50, "grid_page_length": 50,

View File

@@ -111,7 +111,7 @@
"column_break_85", "column_break_85",
"select_print_heading", "select_print_heading",
"language", "language",
"subscription_section", "auto_repeat_section",
"auto_repeat", "auto_repeat",
"update_auto_repeat_reference", "update_auto_repeat_reference",
"more_info", "more_info",
@@ -736,11 +736,6 @@
"print_hide": 1, "print_hide": 1,
"read_only": 1 "read_only": 1
}, },
{
"fieldname": "subscription_section",
"fieldtype": "Section Break",
"label": "Auto Repeat"
},
{ {
"fieldname": "auto_repeat", "fieldname": "auto_repeat",
"fieldtype": "Link", "fieldtype": "Link",
@@ -940,6 +935,11 @@
"no_copy": 1, "no_copy": 1,
"options": "Item Wise Tax Detail", "options": "Item Wise Tax Detail",
"print_hide": 1 "print_hide": 1
},
{
"fieldname": "auto_repeat_section",
"fieldtype": "Section Break",
"label": "Auto Repeat"
} }
], ],
"grid_page_length": 50, "grid_page_length": 50,
@@ -948,7 +948,7 @@
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"is_submittable": 1, "is_submittable": 1,
"links": [], "links": [],
"modified": "2026-01-29 21:23:13.778468", "modified": "2026-02-27 18:05:50.121391",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Buying", "module": "Buying",
"name": "Supplier Quotation", "name": "Supplier Quotation",

View File

@@ -581,6 +581,8 @@ accounting_dimension_doctypes = [
"Advance Taxes and Charges", "Advance Taxes and Charges",
] ]
subscription_doctypes = ["Sales Invoice", "Purchase Invoice", "Payment Request", "POS Invoice"]
get_matching_queries = ( get_matching_queries = (
"erpnext.accounts.doctype.bank_reconciliation_tool.bank_reconciliation_tool.get_matching_queries" "erpnext.accounts.doctype.bank_reconciliation_tool.bank_reconciliation_tool.get_matching_queries"
) )

View File

@@ -109,7 +109,7 @@
"tc_name", "tc_name",
"terms", "terms",
"more_info_tab", "more_info_tab",
"subscription_section", "auto_repeat_section",
"auto_repeat", "auto_repeat",
"update_auto_repeat_reference", "update_auto_repeat_reference",
"print_settings", "print_settings",
@@ -832,11 +832,6 @@
"print_hide": 1, "print_hide": 1,
"read_only": 1 "read_only": 1
}, },
{
"fieldname": "subscription_section",
"fieldtype": "Section Break",
"label": "Auto Repeat"
},
{ {
"fieldname": "auto_repeat", "fieldname": "auto_repeat",
"fieldtype": "Link", "fieldtype": "Link",
@@ -1122,6 +1117,11 @@
"fieldname": "utm_analytics_section", "fieldname": "utm_analytics_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "UTM Analytics" "label": "UTM Analytics"
},
{
"fieldname": "auto_repeat_section",
"fieldtype": "Section Break",
"label": "Auto Repeat"
} }
], ],
"icon": "fa fa-shopping-cart", "icon": "fa fa-shopping-cart",

View File

@@ -151,7 +151,7 @@
"loyalty_points", "loyalty_points",
"column_break_116", "column_break_116",
"loyalty_amount", "loyalty_amount",
"subscription_section", "auto_repeat_section",
"from_date", "from_date",
"to_date", "to_date",
"column_break_108", "column_break_108",
@@ -1372,18 +1372,6 @@
"options": "Sales Team", "options": "Sales Team",
"print_hide": 1 "print_hide": 1
}, },
{
"allow_on_submit": 1,
"collapsible": 1,
"fieldname": "subscription_section",
"fieldtype": "Section Break",
"hide_days": 1,
"hide_seconds": 1,
"label": "Auto Repeat",
"no_copy": 1,
"print_hide": 1,
"read_only": 1
},
{ {
"allow_on_submit": 1, "allow_on_submit": 1,
"fieldname": "from_date", "fieldname": "from_date",
@@ -1742,6 +1730,18 @@
"hidden": 1, "hidden": 1,
"label": "Ignore Default Payment Terms Template", "label": "Ignore Default Payment Terms Template",
"read_only": 1 "read_only": 1
},
{
"allow_on_submit": 1,
"collapsible": 1,
"fieldname": "auto_repeat_section",
"fieldtype": "Section Break",
"hide_days": 1,
"hide_seconds": 1,
"label": "Auto Repeat",
"no_copy": 1,
"print_hide": 1,
"read_only": 1
} }
], ],
"grid_page_length": 50, "grid_page_length": 50,

View File

@@ -147,7 +147,7 @@
"total_commission", "total_commission",
"section_break1", "section_break1",
"sales_team", "sales_team",
"subscription_section", "auto_repeat_section",
"auto_repeat", "auto_repeat",
"printing_details", "printing_details",
"letter_head", "letter_head",
@@ -1115,11 +1115,6 @@
"oldfieldname": "instructions", "oldfieldname": "instructions",
"oldfieldtype": "Text" "oldfieldtype": "Text"
}, },
{
"fieldname": "subscription_section",
"fieldtype": "Section Break",
"label": "Subscription Section"
},
{ {
"fieldname": "auto_repeat", "fieldname": "auto_repeat",
"fieldtype": "Link", "fieldtype": "Link",
@@ -1446,6 +1441,11 @@
{ {
"fieldname": "column_break_neoj", "fieldname": "column_break_neoj",
"fieldtype": "Column Break" "fieldtype": "Column Break"
},
{
"fieldname": "auto_repeat_section",
"fieldtype": "Section Break",
"label": "Auto Repeat"
} }
], ],
"icon": "fa fa-truck", "icon": "fa fa-truck",