Skip to Content
Menu
This question has been flagged
1 Reply
7620 Views

Hello Guys,

i´ve trying to add a custom field to 'res.partner' inside the models.js file but i´ve used the code bellow to odoo 9 and it still don´t work...somebody please help


odoo.define('pos_info_recibo.models_extend', function(require){

var models = require('point_of_sale.models')
var _super_posmodel = models.PosModel.prototype;

models.PosModel = models.PosModel.extend({
initialize: function (session, attributes) {
        // Add field to model
        var partner_model = _.find(this.models, function(model){
            return model.model === 'res.partner';
        });
        partner_model.fields.push('membership_code');
        // run Super
        return _super_posmodel.initialize.call(this, session, attributes)
        },
});
});


Avatar
Discard
Many Thanks, Pat!
It worked.

Com os melhores Cumprimentos,

Eder Machado
Telefone: +244923681051 | +244913748338
Profissão: Programador & Analista de Software
WYSIWYG: What You See Is What You Get...

2017-12-26 12:47 GMT+01:00 Parth Patel (pat) <pat@odoo.com>:

A new answer on how to Add custom field to inside pos models.js file has been posted. Click here to access the post :

See post



Sent by Tiny ERP Pvt Ltd using Odoo.