Skip to Content
Menu
This question has been flagged
3 Replies
4116 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">

    <h3><strong>

        <select class="form-control">

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

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

            </t>

        </select>

    </strong>

    </h3>

</div>


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

Avatar
Discard

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

Author

I tried it. but not returns any value.

Best Answer

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

Avatar
Discard
Related Posts Replies Views Activity
1
Jun 24
268
1
Dec 22
2319
1
Mar 22
1022
0
Sep 23
652
2
Aug 22
3334