Search code examples
odoo

Odoo 16 custom module could not be installed


My Code in views:

<!--account account type form view inherit-->
<record id="view_account_type_from" model="ir.ui.view">
    <field name="name">view.account.type.form</field>
    <field name="model">account.account.type</field>
    <field name="inherit_id" ref="account.view_account_type_form"/>
    <field name="arch" type="xml">
    <xpath expr="//field[@name='include_initial_balance']" position="after">

Error on install: odoo.tools.convert.ParseError: while parsing....../odoo_account_type_menu/views/account_type_menu.xml:9, somewhere inside strong text


Solution

  • The view account.account.type model has been removed in Odoo 16, and it's replaced with the below selection field in account.account model.

    So you can inherit account.account model and override the selection field.

        account_type = fields.Selection(
            selection=[
                ("asset_receivable", "Receivable"),
                ("asset_cash", "Bank and Cash"),
                ("asset_current", "Current Assets"),
                ("asset_non_current", "Non-current Assets"),
                ("asset_prepayments", "Prepayments"),
                ("asset_fixed", "Fixed Assets"),
                ("liability_payable", "Payable"),
                ("liability_credit_card", "Credit Card"),
                ("liability_current", "Current Liabilities"),
                ("liability_non_current", "Non-current Liabilities"),
                ("equity", "Equity"),
                ("equity_unaffected", "Current Year Earnings"),
                ("income", "Income"),
                ("income_other", "Other Income"),
                ("expense", "Expenses"),
                ("expense_depreciation", "Depreciation"),
                ("expense_direct_cost", "Cost of Revenue"),
                ("off_balance", "Off-Balance Sheet"),
            ],
            string="Type", tracking=True,
            required=True,
            compute='_compute_account_type', store=True, readonly=False, precompute=True,
            help="Account Type is used for information purpose, to generate country-specific legal reports, and set the rules to close a fiscal year and generate opening entries."
        )