Odoo Help


Onchange Method Issue openerpv7 [SOLVED]

Yassine TEIMI
on 12/9/14, 1:38 PM 1,151 views

I have a one2many field on account_voucher, so as to display the deliveries uninvoiced of the selected partner.

For that I overrided the basic_onchange_partner methode of account_voucher, wich displayed tha default accout id of the selected partner, as follow : 

from openerp.osv import fields, orm

class AccountVoucher(orm.Model):

    _inherit = 'account.voucher'
    _name = 'account.voucher'
    _columns = {
        'bls_to_pay': fields.one2many('stock.picking.out','bl_id','BLS to pay'),

    def basic_onchange_partner(self, cr, uid, ids, partner_id, journal_id, ttype, context=None):
        if context==None:
            context={ }
        super(AccountVoucher, self).basic_onchange_partner(cr,uid,ids, partner_id, journal_id, ttype, context)
        DO = self.pool.get('stock.picking.out')
        default = {
            'value': {'bls_to_pay' : [] ,},
        do2pay_ids = DO.search(cr, uid, [('partner_id','=',partner_id),('state','=','done'),('invoice_state','=','2binvoiced')])
        for do2pay in do2pay_ids :
            do_rec= DO.browse(cr, uid, do2pay)
            rs = {
                'num_bl': do_rec.num_bl,
                'date' : do_rec.date,
                'origin': do_rec.origin,
        return default

When selecting the partner, an error occurs ( Client side ) saying : Uncaught Error: Champ state inconnu dans le domaine [["state","in",["cancel","done"]]]

and giving the following location : /web/static/src/js/view_form.js:1675

Why this error rises ?

I'll translate "Champ state inconnu dans le domaine " : " field state unknown on domain"

Yassine TEIMI
on 12/9/14, 1:40 PM

Yes Ivan, I used the field state on my onchange method, without putting it on the xml view.

Yassine TEIMI
on 12/10/14, 2:56 AM



| 5 3 6
Jakarta, Indonesia
On 12/10/14, 3:15 AM

It is usually happen when you use the field that is not included in view. All fields to be included in view or to be passed to on_change need to be included in view although they can be invisible.


Techno-Functional Associate with 7+ years of experience in Odoo (formerly known as OpenERP).

On 12/10/14, 2:36 AM

Error occurs when state field is not used in the view [tree/form]... but you would have added states property either in your Python code or Xml code... Hence that error is occured..

So do add the field "state" in the views... if it is of no use to you then add "invisible" property to it


Mohamed Essakali
On 12/9/14, 1:47 PM

I think the error is on your view xml, can you put the code of your view file?

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: 12/9/14, 1:38 PM
Seen: 1151 times
Last updated: 3/16/15, 8:10 AM