Odoo Help
Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM
|
e-Commerce
|
Accounting
|
Inventory
|
PoS
|
Project management
|
MRP
|
etc.
My JS function doesn't return array value?
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
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.
RegisterOdoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.
Test it nowQuestion tools
Stats
Asked: 9/23/15, 4:50 AM |
Seen: 1213 times |
Last updated: 3/11/16, 6:30 AM |
jyothimani,
at place of "return partners", try "return self.partners"...
I tried it. but not returns any value.