Odoo Help


odoo mobile android framework

on 11/23/16, 4:21 AM 569 views

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

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 11/23/16, 4:21 AM
Seen: 569 times
Last updated: 11/23/16, 10:18 AM