Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
3 Răspunsuri
1879 Vizualizări

hi i have tow module one: l10n_dz (chart account of algeria) tow: account_cetic(custom module)to add tow field boolean in account.account and it s work ,
class AccountAccount(models.Model):
_inherit = 'account.account'

is_section_management = fields.Boolean(string='Section Gestion ',
help="Check this box if this account have a section management.")
is_partner = fields.Boolean(string='Tiers ',
help="Check this box if this account have a partner.")

now i add data file in l10n_dz for the account.account this is the file


<record id="dz_pcg_411200" model="account.account.template">
<field name="name">Clients direc. Informat.</field>
<field name="code">411200</field>
<field name="user_type_id" ref="account.data_account_type_receivable"/>
<field name="reconcile" eval="True"/>
<field name="is_partner" eval="True"/>
<field name="chart_template_id" ref="l10n_dz_pcg_chart_template"/>
<field name="group_id" ref="l10n_dz.account_group_411" />
</record>
averything come in table just the tow field it show me :
odoo.models: account.account.template.create() includes unknown fields: is_partner, is_section_management
Imagine profil
Abandonează
Cel mai bun răspuns

Hi,

You must ensure that the fields are declared in both the model and the data file if you want to add the custom fields is_partner and is_section_management to the account.account model in the l10n_dz module.

First, add the custom fields to the account.account model in your custom module account_cetic.

In Python:

from odoo import models, fields

class AccountAccount(models.Model):
_inherit = 'account.account'

is_section_management = fields.Boolean(string='Section Gestion', help="Check this box if this account has a section management.")
is_partner = fields.Boolean(string='Tiers', help="Check this box if this account has a partner.")

<record id="dz_pcg_411200" model="account.account.template">
    <field name="name">Clients direc. Informat.</field>
    <field name="code">411200</field>
    <field name="user_type_id" ref="account.data_account_type_receivable"/>
    <field name="reconcile" eval="True"/>
    <field name="chart_template_id" ref="l10n_dz_pcg_chart_template"/>
    <field name="group_id" ref="l10n_dz.account_group_411"/>
    <field name="is_partner" eval="True"/>
    <field name="is_section_management" eval="False"/>
</record>


Regards

Imagine profil
Abandonează
Cel mai bun răspuns

You should inherit 'account.account.template' I think.


Imagine profil
Abandonează
Cel mai bun răspuns

Hi,
Please try below code....

class AccountAccountTemplate(models.Model):
_inherit = 'account.account.template'

I hope above code will work...

Imagine profil
Abandonează