콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
3 답글
3124 화면

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,
            }
            default['value']['bls_to_pay'].append(rs) 
        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"

작성자

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

베스트 답변

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.

아바타
취소
베스트 답변

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


 

아바타
취소
베스트 답변

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

아바타
취소