Skip to Content
Menu
This question has been flagged
3 Replies
2674 Views

Hi, I have the following view with a field with on2many_list widget and custom tree inside it. Field named 'saldo_acumulado' is computed and not stored. When I update the module Odoo tells that field 'saldo_acumulado' does not exist. Anyone can help with this issue?

In Python file:

saldo_acumulado = fields.Float('Saldo acumulado', compute='_compute_saldo_acumulado')

In view file:

<record id="view_account_invoice_form_inherited" model="ir.ui.view">
    <field name="name">Herencia factura</field>
    <field name="model">account.invoice</field>
    <field name="inherit_id" ref="account.invoice_form"/>
    <field name="arch" type="xml">
        <xpath expr="//notebook/page[@name='other_info']" position="after">
            <page string="Efectos" name="efectos">
                <field name="efectos_id" nolabel="1" widget="one2many_list" mode="tree,kanban">
                    <tree>
                        <field name="date"/>
                        <field name="move_id"/>
                        <field name="journal_id"/>
                        <field name="name"/>
                        <field name="account_id"/>
                        <field name="debit"/>
                        <field name="saldo_acumulado"/>
                     </tree>
                 </field>
            </page>
        </xpath>
    </field>
</record>
Avatar
Discard

I am pretty sure it's not issue related to widget one2many_list.

I think you try to define tree view for many2one field `efectos_id` which not possible/supported

Author

But if I comment field 'saldo_acumulado' in the view, there isn't any error and tree is painted with the rest of the fields.

It seems that new inherited fields I've define in account.move.line, like 'saldo_acumulado', are not allowed. In fact I´ve tested with another fields created in the inherit class and I got the same error: 'Field my_field does not exist'

Author Best Answer

Finally, I got the solution. Field 'saldo_acumulado' is defined in another module distinct to the one where the view is defined.

So, I had to add that module in depends section in manifest.py file:

'depends': ['base', 'account', 'my_module']

Avatar
Discard