Odoo Help


This community 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.


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

Luis Martinez
on 7/15/14, 12:32 PM 1,042 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 Martinez
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 Martinez
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.


Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)


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