0
votes

I wrote a custom module in Odoo and now I would like to import some field values from the custom module into the POS widget.

Suppose I have a field named 'discount' in a module 'customer.discount'.

How do I load the field values from the custom module into the widget for the POS? This is the .js code I have so far. Any pointers? Remark: This is for the new Odoo API (V9).

odoo.define('pos_product_available.PosModel', function(require){
"use strict";


    var models = require('point_of_sale.models');
    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 === 'product.product'; });
            partner_model.fields.push('qty_available');
            var customer_model = _.find(this.models, function(model){return
                this.models.push({
                      model: 'customer.discount',
                      fields: ['discount_price','percentage'],
                })
            }),
            return _super_posmodel.initialize.call(this, session, attributes);
        },
    })
})
1

1 Answers

0
votes
odoo.pos_custom = function(instance){
module = instance.point_of_sale;
function pos_customer_discount(instance,module){
    var models = module.PosModel.prototype.models;
    models.model.push({ 
        model:  'customer.discount',
        fields: ['discount_price','percentage'],
        loaded: function(self,customer_discount){self.customer_discount = customer_discount[0]; },
});
}