refactor: gate company restrictions per master via Restrict to Companies checkbox

Replaces the Global Defaults toggle. Each Item/Customer/Supplier now
carries a Restrict to Companies checkbox: the Allowed Companies table
only shows (and is mandatory) when checked, is cleared on uncheck, and
permission filtering, read denial and write validation apply only to
masters that have the checkbox set.
This commit is contained in:
Mihir Kandoi
2026-07-18 19:01:07 +05:30
parent 4d49cfa1de
commit ea5c648ab0
12 changed files with 74 additions and 37 deletions

View File

@@ -17,8 +17,7 @@
"disable_rounded_total",
"disable_in_words",
"column_break_hnew",
"use_posting_datetime_for_naming_documents",
"enable_company_wise_masters"
"use_posting_datetime_for_naming_documents"
],
"fields": [
{
@@ -93,13 +92,6 @@
"fieldtype": "Check",
"label": "Use Posting Datetime for Naming Documents"
},
{
"default": "0",
"description": "When enabled, Supplier, Customer, and Item records can be restricted to specific companies via their <b>Allowed Companies</b> table. Transactions will only show masters configured for the selected company.",
"fieldname": "enable_company_wise_masters",
"fieldtype": "Check",
"label": "Enable Company-wise Master Filtering"
},
{
"fieldname": "defaults_section",
"fieldtype": "Section Break",
@@ -121,7 +113,7 @@
"in_create": 1,
"issingle": 1,
"links": [],
"modified": "2026-07-14 18:30:00.000000",
"modified": "2026-07-14 23:00:00.000000",
"modified_by": "Administrator",
"module": "Setup",
"name": "Global Defaults",

View File

@@ -18,7 +18,6 @@ keydict = {
"account_url": "account_url",
"disable_rounded_total": "disable_rounded_total",
"disable_in_words": "disable_in_words",
"enable_company_wise_masters": "enable_company_wise_masters",
}
ROUNDED_TOTAL_DOCTYPES = (
@@ -52,7 +51,6 @@ class GlobalDefaults(Document):
demo_company: DF.Link | None
disable_in_words: DF.Check
disable_rounded_total: DF.Check
enable_company_wise_masters: DF.Check
hide_currency_symbol: DF.Check
use_posting_datetime_for_naming_documents: DF.Check
# end: auto-generated types