mirror of
https://github.com/NaN-tic/trytond-account_reports.git
synced 2023-12-14 05:43:08 +01:00
parent
588dec0618
commit
158f89002a
3 changed files with 39 additions and 0 deletions
13
common.py
13
common.py
|
@ -13,6 +13,19 @@ from trytond.transaction import Transaction
|
|||
__all__ = ['FiscalYear', 'Account', 'Party']
|
||||
|
||||
|
||||
def deactivate_menu_entry(module_name, xml_id):
|
||||
pool = Pool()
|
||||
Menu = pool.get('ir.ui.menu')
|
||||
ModelData = pool.get('ir.model.data')
|
||||
|
||||
menu = Menu.search([
|
||||
('id', '=', ModelData.get_id(module_name, xml_id)),
|
||||
])
|
||||
if menu:
|
||||
menu[0].active = False
|
||||
menu[0].save()
|
||||
|
||||
|
||||
class FiscalYear(metaclass=PoolMeta):
|
||||
__name__ = 'account.fiscalyear'
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ from trytond.tools import grouped_slice
|
|||
from trytond.modules.html_report.html_report import HTMLReport
|
||||
from babel.dates import format_datetime
|
||||
from trytond.rpc import RPC
|
||||
from ..common import deactivate_menu_entry
|
||||
|
||||
_ZERO = Decimal(0)
|
||||
|
||||
|
@ -54,6 +55,18 @@ class PrintGeneralLedgerStart(ModelView):
|
|||
], 'Output Format', required=True)
|
||||
company = fields.Many2One('company.company', 'Company', required=True)
|
||||
|
||||
@classmethod
|
||||
def __register__(cls, module_name):
|
||||
pool = Pool()
|
||||
Modules = pool.get('ir.module')
|
||||
super().__register__(module_name)
|
||||
account_jasper_report_activated = Modules.search([
|
||||
('name', '=', 'account_jasper_reports'),
|
||||
('state', '=', 'activated')], limit=1)
|
||||
if account_jasper_report_activated:
|
||||
deactivate_menu_entry('account_jasper_reports', 'menu_print_general_ledger')
|
||||
|
||||
|
||||
@staticmethod
|
||||
def default_fiscalyear():
|
||||
FiscalYear = Pool().get('account.fiscalyear')
|
||||
|
|
|
@ -15,6 +15,8 @@ from trytond.modules.html_report.engine import DualRecord
|
|||
|
||||
from babel.dates import format_datetime
|
||||
|
||||
from ..common import deactivate_menu_entry
|
||||
|
||||
_ZERO = Decimal(0)
|
||||
|
||||
|
||||
|
@ -94,6 +96,17 @@ class PrintTaxesByInvoiceAndPeriodStart(ModelView):
|
|||
], depends=['partner_type'])
|
||||
include_cancel = fields.Boolean('Include cancel')
|
||||
|
||||
@classmethod
|
||||
def __register__(cls, module_name):
|
||||
pool = Pool()
|
||||
Modules = pool.get('ir.module')
|
||||
super().__register__(module_name)
|
||||
account_jasper_report_activated = Modules.search([
|
||||
('name', '=', 'account_jasper_reports'),
|
||||
('state', '=', 'activated')], limit=1)
|
||||
if account_jasper_report_activated:
|
||||
deactivate_menu_entry('account_jasper_reports', 'menu_print_taxes_by_invoice')
|
||||
|
||||
@staticmethod
|
||||
def default_partner_type():
|
||||
return 'customers'
|
||||
|
|
Loading…
Reference in a new issue