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
- Contabilidad
- Inventario
- PoS
- Project
- MRP
Se marcó esta pregunta
1
Responder
2805
Vistas
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
¿Le interesa esta conversación? ¡Participe en ella!
Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.
RegistrarsePublicaciones relacionadas | Respuestas | Vistas | Actividad | |
---|---|---|---|---|
|
0
may 20
|
2365 | ||
|
1
abr 20
|
2795 | ||
|
1
abr 20
|
2199 | ||
|
0
feb 22
|
2026 | ||
|
1
jul 20
|
4085 |