Odoo Help


My JS function doesn't return array value?

on 9/23/15, 4:50 AM 1,266 views

Hi all,

I'm trying show a partners in dropdown box at Warehouse->All operations->Click to launch the barcode interface.

my code is:

in addons\stock\static\src\xml\picking.xml

<div class="col-md-3 col-sm-4 col-xs-6">


        <select class="form-control">

            <t t-foreach="widget.get_partners()" t-as="partner">

                <option value="partne.id"><t t-esc="partner.name"/></option>






in \addons\stock\static\src\js\widget.js

get_partners: function(){

    var self = this;

    var partners = [];

    var model = new instance.web.Model('res.partner');

    model.query(['id', 'name']).filter([['customer', '=', 'True']]).limit(1000).all().done(function(partners){

        self.partners = partners;

        console.log(partners); // returns excepted values


    return partners; // but here doesn't return any value


I mentioned in my code by comments, what i need.

please give me suggestions.

Thanks in advance

at place of "return partners", try "return self.partners"...

on 9/23/15, 6:09 AM

I tried it. but not returns any value.

on 9/23/15, 6:21 AM
Ayaz Mansuri
On 3/11/16, 6:30 AM

I've posted answer here: https://www.odoo.com/nl_NL/forum/help-1/question/how-to-read-the-res-partner-ids-in-javascript-91165#answer-98549

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: 9/23/15, 4:50 AM
Seen: 1266 times
Last updated: 3/11/16, 6:30 AM