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

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

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
มิ.ย. 17
8448
0
พ.ย. 16
3259
0
พ.ย. 16
3744
0
พ.ย. 16
3634
odoo android mobile framework แก้ไขแล้ว
1
ต.ค. 16
5221