Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
5055 Переглядів

ex. There Are many plan on many2one fields like Plan offender :plan-1 1.A 2.B 3.C :plan-2 1.D 2.E

                     **:plan-3**
                              *1.F*

Select maste plan-1 from many2one fieds and next dropdown list box( ( many2one)) display plan-1 related sub plan show my Code :def onchange_getplan(self, cr, uid, ids, plans_offered, context=None):

    if not plans_offered:
        return {'value': {}}
    name_browse = self.browse(cr, uid, plans_offered , context=context)
    print "name_browse:>>>", name_browse
    plan_obj = self.pool.get('membership.plan.master').browse(cr, uid, name_browse.id, context=context)
    print "\n\n\npersons_connected_with_plan",plan_obj.id
    data = self.pool.get('all.plan.master').search(cr, uid, [('plans','=',plan_obj.id)], context=context)
    print "d a t a :>", data
    for plan_object in data:
        print ">>>>>>>>>>>>>>> plan_object id", plan_object
        a = self.pool.get('all.plan.master').browse(cr, uid, plan_object)
        print "A:>>>>", a, a.plan_name
        new_val.append({'sub_plan': a.id})
    #       plan_object.id = plan_object
    print 'new_val:>>>>',new_val

}

  return {'value': new_val}
Аватар
Відмінити
Найкраща відповідь

The syntax for the return value of on_change function is the following:

{"value" : 
     {"field1": "value1", "field2": value2}, 
  "domain": {"plan2": [("parent_id", "=", plan1_id)]},
}

If you want to show only certain values in field plan2, you have to return the according domain for the field plan2.

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
0
бер. 25
1911
4
квіт. 24
175059
0
груд. 23
2646
5
лип. 25
230545
1
груд. 22
3794