Error: display_balance "None" on custom Geo Chart Type

Hello,

I am working on a Georgian localisation module for Tryton 7.6 (account_ge).
The module defines a Georgian chart of accounts in XML and also extends
account.account.type.template and account.account.type in Python to add
some extra boolean flags (assets, revenue, etc.).

If I install and use only the XML chart, everything works fine:

  • I can create the chart from the template,

  • link it to a company,

  • and there is no error.

As soon as I enable my Python extension (on a fresh database), I get this error
at the end of the “Create Chart of Accounts from Template” / configuration wizard:

The value “None” for field “Display Balance” in record “Geo Chart Type”
of “Account Type” is not one of the allowed options.

Here is a simplified version of my Python code:

from trytond.pool import PoolMeta
from trytond.model import fields

all = [‘AccountTypeTemplate’, ‘AccountType’]

class AccountTypeTemplate(metaclass=PoolMeta):
name = ‘account.account.type.template’

assets = fields.Boolean("Assets")
receivable = fields.Boolean("Receivable")
payable = fields.Boolean("Payable")
stock = fields.Boolean("Stock")
fixed_asset = fields.Boolean("Fixed Asset")
revenue = fields.Boolean("Revenue")
expense = fields.Boolean("Expense")

def _get_type_value(self, type=None):
    values = super()._get_type_value(type)

    if not type or type.assets != self.assets:
        values['assets'] = self.assets
    if not type or type.receivable != self.receivable:
        values['receivable'] = self.receivable
    if not type or type.payable != self.payable:
        values['payable'] = self.payable
    if not type or type.stock != self.stock:
        values['stock'] = self.stock
    if not type or type.fixed_asset != self.fixed_asset:
        values['fixed_asset'] = self.fixed_asset
    if not type or type.revenue != self.revenue:
        values['revenue'] = self.revenue
    if not type or type.expense != self.expense:
        values['expense'] = self.expense

    return values

class AccountType(metaclass=PoolMeta):
name = ‘account.account.type’

assets = fields.Boolean("Assets")
receivable = fields.Boolean("Receivable")
payable = fields.Boolean("Payable")
stock = fields.Boolean("Stock")
fixed_asset = fields.Boolean("Fixed Asset")
revenue = fields.Boolean("Revenue")
expense = fields.Boolean("Expense")

I do not redefine display_balance in this code anymore.
The error appears only when this Python extension is active; if I disable it and
keep only the XML chart, the problem disappears.

My questions are:

  1. Is there something wrong with the way I override _get_type_value on
    account.account.type.template?

  2. What is the recommended pattern to add extra fields to
    account.account.type.template / account.account.type without breaking
    the creation of account types from templates?

I am still learning Tryton internals, so any hint or example from other
localisation modules would be very helpful.

Thank you,

display_balance balance field has been removed since 5.0 series (6 years ago).
I do not know which version you are working on but it is definitely no more supported.