コンテンツへスキップ
メニュー
この質問にフラグが付けられました

in my class there is a column like

weight_shared_data = fields.One2many('weight.management', compute= "collect_shared_weight_user_wise",  string='One2many Test')

def collect_shared_weight_user_wise(self):
    weight_obj = self.env['weight.management']

    weight_ids = weight_obj.search([('user_id','=',self.shared_user_id.id)])

    self.weight_shared_data = weight_ids


how I'll b defining it on my OModel

i tried something like this

@Odoo.Functional( method = "collect_shared_weight_user_wise",depends = {"shared_user_id"})    OColumn weight_shared_data =new OColumn("One2many Test", WeightManagement.class,OColumn.RelationType.OneToMany);

public String collect_shared_weight_user_wise(OValues values) {       

try {

            WeightManagement obj=new WeightManagement(context,user);
            List<ODataRow> ids = obj.select(new String[]{OColumn.ROW_ID},"user_id=?",new String[]{values.getString("shared_user_id")});
            values.put("weight_shared_data",new RelValues().append(ids.toArray()));
        } catch (Exception e) {        }       

return "";
    }


and its not working...
thank you

アバター
破棄
関連投稿 返信 ビュー 活動
2
6月 17
7855
0
11月 16
2723
0
11月 16
3065
0
11月 16
3026
1
10月 16
4586