Odoo Help

Welcome!

This community 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.

0

odoo mobile android framework

By
marshall
on 11/23/16, 4:21 AM 54 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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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