Skip to Content
Menu
This question has been flagged
2 Replies
3291 Views

hello 
i'm new in odoo  i have created a new module that inherits from res.partner and i have added new fields telephone 2 and tags  on the POS interface it's working  but when i save the customer all the information are saved expet the two fields that i've add 
 this is my models.js code   :

models.js

odoo.define('aspl_pos_stock.models', function (require) { "use strict"; var module = require('point_of_sale.models'); var Model = require('web.DataModel'); var core = require('web.core');
var _super = module.PosModel.prototype;

module.PosModel = module.PosModel.extend({

initialize: function (session, attributes) {


       // call super to set all properties

       _super.initialize.apply(this, arguments);

       // here i can access the models list like this and add an element.

       this.models.push({

       model:  'res.partner',

       fields: ['second_number_phone','category_id'],

       domain: [['customer','=',true]], 

       loaded: function(self,partners){

       self.partners = partners;

       self.db.add_partners(partners);

       }

       })

          var exports = require('point_of_sale.models');


           // overrides models in exports.PosModel

           var models = exports.PosModel.prototype.models;

           for (var i = 0; i <= models.length; i++) {

               var client = models[i];

               if (client.model === 'res.partner') {

                   for (var j = 0; j <= category_id.fields.length; j++) {

                       if(client.fields[j] === 'category_id'){

                           client.fields[j] = 'category_id';

                           break;

                       }

                   }

                   break;

               }

           }


           return exports; 

       return this;

}

})

    });

Avatar
Discard

your odoo version?

Author Best Answer

Odoo 10 

Avatar
Discard