Skip to Content
Menu
This question has been flagged
2035 Views

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) {
"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)
},
}

]);
});
added assets js file in 












Avatar
Discard
Related Posts Replies Views Activity
4
May 24
10067
1
Apr 24
1561
0
Nov 23
525
1
Sep 23
562
2
Aug 23
2421