# Fusion Accounting - Balance Sheet Report Handler

from odoo import models


class BalanceSheetCustomHandler(models.AbstractModel):
    """Handler for balance sheet report customizations."""

    _name = 'account.balance.sheet.report.handler'
    _inherit = 'account.report.custom.handler'
    _description = 'Balance Sheet Report Handler'

    def _customize_warnings(self, report, options, all_column_groups_expression_totals, warnings):
        """Flag a warning when currency translation adjustment is active.

        If the selected currency table type is 'cta', there may be unbalanced
        entries caused by the currency translation process. This method injects
        the appropriate warning template so the user is informed.
        """
        currency_cfg = options.get('currency_table', {})
        if currency_cfg.get('type') == 'cta':
            warnings['fusion_accounting.common_possibly_unbalanced_because_cta'] = {}
