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:
- إدارة علاقات العملاء
- e-Commerce
- المحاسبة
- المخزون
- PoS
- Project
- MRP
لقد تم الإبلاغ عن هذا السؤال
1
الرد
2904
أدوات العرض
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
هل أعجبك النقاش؟ لا تكن مستمعاً فقط. شاركنا!
أنشئ حساباً اليوم لتستمتع بالخصائص الحصرية، وتفاعل مع مجتمعنا الرائع!
تسجيلالمنشورات ذات الصلة | الردود | أدوات العرض | النشاط | |
---|---|---|---|---|
|
0
مايو 20
|
2521 | ||
|
1
أبريل 20
|
2937 | ||
|
1
أبريل 20
|
2342 | ||
|
0
فبراير 22
|
2215 | ||
|
1
يوليو 20
|
4233 |