I need to filter the Customer list in Odoo 13 POS customer button. I have written code in js but it's not working. The code is mentioned below. Can anybody figure out where I'm wrong?
odoo.define('customer_filter_pos.customer_filter_pos', function (require) {
var models = require('point_of_sale.models');
var rpc = require('web.rpc');
models.load_fields('res.partner','parent_id');
var _super_posmodel = models.PosModel.prototype;
models.PosModel = models.PosModel.extend({
initialize: function (session, attributes) {
var partner_model = _.find(this.models, function(model){
return model.model === 'res.partner';
});
partner_model.domain.push(['parent_id','=',false]);
return _super_posmodel.initialize.call(this, session, attributes);
},
});
models.PosModel = models.PosModel.extend({
load_new_partners: function(load_new_partners){
var self = this;
var def = new $.Deferred();
var fields = _.find(this.models,function(model){ return model.model === 'res.partner'; }).fields;
var domain = [['customer','=',true],['write_date','>',this.db.get_partner_write_date()],['parent_id','=',false]];
rpc.query({
model: 'res.partner',
method: 'search_read',
args: [domain, fields],
}, {
timeout: 3000,
shadow: true,
})
.then(function(partners){
if (self.db.add_partners(partners)) { // check if the partners we got were real updates
def.resolve();
} else {
def.reject();
}
}, function(type,err){ def.reject(); });
return def;
}
});
});
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project
- MRP
This question has been flagged
1
Reply
2807
Views
hello i hope you are well did you find a solution for this task, please share with me if you have already found it. thanks
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
0
May 20
|
2368 | ||
|
1
Apr 20
|
2802 | ||
|
1
Apr 20
|
2203 | ||
|
0
Feb 22
|
2029 | ||
|
1
Jul 20
|
4086 |