i tried like below i got error called "No Enumerator given for foreach"
xml static file:
Visited Branches
py file
from odoo import api, fields, models
import logging
class resPartner(models.Model):
_inherit = 'res.partner'
visited_branches_ids = fields.Many2many('res.company', string="Visited Branches")
js file
odoo.define('prism_pos_extend.visited_branches', function (require) {added assets js file in
"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 company_model = _.find(this.models,function(model)
{
return model.model === 'res.company';
});
company_model.fields.push('visited_branches_ids');
return _super_posmodel.initialize.call(this,session,attributes);
},
});
models.load_models([
{
model: 'res.company',
fields: ['id', 'name'],
loaded: function(self,visited_branches_ids){
self.visited_branches = visited_branches_ids || [];
console.log("company fields")
console.log(self.visited_branches_ids)
},
}
]);
});