feat(fusion_accounting_core): add _fusion_is_enterprise_accounting_installed helper
Made-with: Cursor
This commit is contained in:
@@ -1 +1 @@
|
||||
# Models populated in Tasks 8-12 (shared-field-ownership, helpers)
|
||||
from . import ir_module_module
|
||||
|
||||
32
fusion_accounting_core/models/ir_module_module.py
Normal file
32
fusion_accounting_core/models/ir_module_module.py
Normal file
@@ -0,0 +1,32 @@
|
||||
from odoo import api, models
|
||||
|
||||
|
||||
# Modules considered "Odoo Enterprise accounting" for the purpose of feature gating.
|
||||
# A client is "on Enterprise" if any of these are installed; fusion_accounting_*
|
||||
# replacement modules will hide their menus when Enterprise is present (replace mode
|
||||
# vs. augment mode is configurable in Settings).
|
||||
ENTERPRISE_ACCOUNTING_MODULES = (
|
||||
'account_accountant',
|
||||
'account_reports',
|
||||
'accountant',
|
||||
)
|
||||
|
||||
|
||||
class IrModuleModule(models.Model):
|
||||
_inherit = "ir.module.module"
|
||||
|
||||
@api.model
|
||||
def _fusion_is_enterprise_accounting_installed(self):
|
||||
"""True if any Odoo Enterprise accounting module is installed in this DB."""
|
||||
return bool(self.sudo().search_count([
|
||||
('name', 'in', list(ENTERPRISE_ACCOUNTING_MODULES)),
|
||||
('state', '=', 'installed'),
|
||||
]))
|
||||
|
||||
@api.model
|
||||
def _fusion_is_module_installed(self, module_name):
|
||||
"""True if a specific module is installed."""
|
||||
return bool(self.sudo().search_count([
|
||||
('name', '=', module_name),
|
||||
('state', '=', 'installed'),
|
||||
]))
|
||||
Reference in New Issue
Block a user