Skip to content

fix(isolation): roll back custom_company enforcement that hid all rec…#260

Merged
engahmed1190 merged 1 commit into
version-15from
fix/revert-company-isolation-enforcement
May 13, 2026
Merged

fix(isolation): roll back custom_company enforcement that hid all rec…#260
engahmed1190 merged 1 commit into
version-15from
fix/revert-company-isolation-enforcement

Conversation

@engahmed1190
Copy link
Copy Markdown
Contributor

…ords

The permission_query_conditions / has_permission hooks added in PR #252 filtered Customer/Supplier/Item Group/Customer Group/Supplier Group/ Brand/Price List by custom_company IN (user_companies). On sites where legacy records have NULL custom_company (e.g. dev-miraaya, where 0 of 39,784 customers were tagged), the strict filter excluded every legacy record from every user — customers were invisible in Desk and POS.

Rollback:

  • hooks.py: remove permission_query_conditions and has_permission blocks for the 7 isolated doctypes
  • company_isolation.py: reduce to get_user_companies(); drop the build_condition / has_permission helpers and 14 wrappers
  • validations.py item_query: treat NULL custom_company as global and drop the 1=0 blocker so missing user-companies fall through to stock permissions
  • 8 custom_company custom field JSONs: reqd 1 → 0
  • delete test_company_isolation.py

The custom_company column stays (api/items.py uses it for the unrelated allow_global_items POS Profile feature, which already handles NULL sensibly). uninstall.py still removes the fields if the app is fully uninstalled.

sync_on_migrate: 1 on the custom field JSONs ensures bench migrate propagates reqd=0 to live sites without a separate patch.

…ords

The permission_query_conditions / has_permission hooks added in PR #252
filtered Customer/Supplier/Item Group/Customer Group/Supplier Group/
Brand/Price List by `custom_company IN (user_companies)`. On sites
where legacy records have NULL custom_company (e.g. dev-miraaya,
where 0 of 39,784 customers were tagged), the strict filter excluded
every legacy record from every user — customers were invisible in
Desk and POS.

Rollback:
- hooks.py: remove permission_query_conditions and has_permission
  blocks for the 7 isolated doctypes
- company_isolation.py: reduce to get_user_companies(); drop the
  build_condition / has_permission helpers and 14 wrappers
- validations.py item_query: treat NULL custom_company as global and
  drop the `1=0` blocker so missing user-companies fall through to
  stock permissions
- 8 custom_company custom field JSONs: reqd 1 → 0
- delete test_company_isolation.py

The custom_company column stays (api/items.py uses it for the
unrelated allow_global_items POS Profile feature, which already
handles NULL sensibly). uninstall.py still removes the fields if
the app is fully uninstalled.

sync_on_migrate: 1 on the custom field JSONs ensures `bench migrate`
propagates reqd=0 to live sites without a separate patch.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@engahmed1190 engahmed1190 merged commit 1c95d0f into version-15 May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant