Odoo Help


(SOLVED) Can I search on a new field added to an inherited class in OpenERP 6.1?

Luis M. Ontalba
on 7/15/14, 12:32 PM 1,559 views

I have created a new class inheriting from acount.move:

from osv import fields, osv

class account_ordering(osv.osv):

_inherit = "account.move"

_name = "account.move"

_columns = {

'fiscalyear_id': fields.related('period_id','fiscalyear_id',type='many2one',relation='account.fiscalyear',string='Fiscal year', store=True, readonly=True)



And I have added a new field and a new search field inheriting from a tree view:

<?xml version="1.0" encoding="utf-8"?>



<record id="view_account_ordering1_tree" model="ir.ui.view">

<field name="name">view.account.ordering1.tree</field>

<field name="model">account.move</field>

<field name="type">tree</field>

<field name="inherit_id" ref="account.view_account_move_filter"/>

<field name="arch" type="xml">

<field name="period_id" position="before">

<field name="fiscalyear_id"/>




<record id="view_account_ordering2_tree" model="ir.ui.view">

<field name="name">view.account.ordering2.tree</field>

<field name="model">account.move</field>

<field name="type">tree</field>

<field name="inherit_id" ref="account.view_move_tree"/>

<field name="arch" type="xml">

<field name="name" position="after">

<field name="fiscalyear_id"/>






My problem is the added search field is not working. What is wrong?

Thank you in advanced.

I have added  the "fiscalyear_id" field to account.move model, I have added this field to the account move tree view, and I have added a new search field in the search area in this view. All this changes work apparently well, the new field "fiscalyear_id" is in the account move tree view and there is a new search field by fiscalyear_id. The problem is when I try to search account moves selecting a fiscal year in the new field, it doesn´t find any account move. If I add a new search field on a original field of account.move model, it works correctly, but it doesn´t work on an added field like "fiscalyear_id". The code is what I posted first, the python class inheriting from account.move and de xml file inheriting from the account move tree view

Luis M. Ontalba
on 7/19/14, 5:04 AM
Mantavya Gajjar (mga)
On 7/15/14, 12:48 PM

When you inherit _inherit = "account.move" you no need to define _name = "account.move". You have to inherit search view of account.move and add field fiscalyear_id to do search on it. 

Luis M. Ontalba
On 7/22/14, 4:56 AM


I have removed store=True in the "fiscalyear_id" field and now it is possible to search account move by fiscal year.

Thank you.


Hello Luis,

If possible, provide your module, So I can test and let you know the reason.

Remove everything from that module, just keep this problem related code. Upload that module somewhere like dropbox and give me link, So that I can try and solve your problem.


About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)


Asked: 7/15/14, 12:32 PM
Seen: 1559 times
Last updated: 3/16/15, 8:10 AM