Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
6429 มุมมอง

This question is really close to this one :

https://www.odoo.com/forum/help-1/question/how-to-create-dynamic-domain-on-many2one-fields-with-onchange-function-11253

My code so far:

the xml:

    field name="ds_id" on_change="onchange_fill_fields(ds_id)"

the method:

def onchange_fill_fields(self, cr, uid, ids, ds, context=None)

    res = {'value': {}}

    ds_domain = []

    ds_domain.append(('model_id', '=', model_name)) # model_name is the name of the model we have     chose('res.parnter',account etc)

return {'value': res.get('value', {}), 'domain': {'field_name': ds_domain}}

The problem is that I want with this function to change the selection to an other class.

columns={

    'first_obj': fields.one2many('second_obj', 'first_obj_id', string='models')

    'ds_id': fields.many2one('ds_obj', string='Data ', required=True), }

    (the ds_id is an other class, where there is a selection with models

    )

Other class columns={

    'second_obj: fields.many2one('sec_obj', string='Camp'),

    'field_name': fields.many2one('ir.model.fields', 'Model Fields',

    domain=[('model_id', '=', ' ')]),

}

So if i pick res.partner(for example) from the selection (ds_id), I want to see the res.partner fields in a selection to the other class!Is this possible?? If it was in the same class,it would be easy.But this is different. I know that I have to change the "domain" to be like this

('model_id', '=', model_name)

Any Help?

 

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi, 

You can follow following link for this:

https://youtu.be/GPhgxxwprA4

Hope it helps,

Thanks

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ธ.ค. 18
13
Onchange many2one partner_bank_id แก้ไขแล้ว
1
พ.ค. 16
4415
3
ก.ค. 24
4480
3
มี.ค. 23
6388
1
ส.ค. 22
7765