Hello all,
In the file odoo-8.0-20151203/openerp/addons/point_of_sale/static/src/js/models.js, there is this code :
module.PosModel = Backbone.Model.extend({
models: [
{
model: 'res.users',
fields: ['name','company_id'],
ids: function(self){ return [self.session.uid]; },
loaded: function(self,users){ self.user = users[0]; },
},{
model: 'res.company',
fields: [ 'currency_id', 'email', 'website', 'company_registry', 'vat', 'name', 'phone', 'partner_id' , 'country_id', 'tax_calculation_rounding_method'],
ids: function(self){ return [self.user.company_id[0]] },
loaded: function(self,companies){ self.company = companies[0]; },
},{
model: 'decimal.precision',
fields: ['name','digits'],
loaded: function(self,dps){
self.dp = {};
for (var i = 0; i < dps.length; i++) {
self.dp[dps[i].name] = dps[i].digits;
}
},
..............................................
I only want to modify ONE model (res.company) in my own module. Is it possible?
Or do I have to override ALL models even if I want to modify only one of them?
Thanks to help
UPDATE #1
With this code, I think that I override ALL the original models with only this new one. So, it doesn't work.
openerp.canada_rounding = function (instance) {
var module=instance.point_of_sale
var round_pr = instance.web.round_precision
module.PosModel = module.PosModel.extend({
models: [
{
model: 'res.company',
fields: [ 'currency_id', 'email', 'website', 'company_registry', 'vat', 'name', 'phone', 'partner_id' , 'country_id', 'tax_calculation_rounding_method'],
ids: function(self){ return [self.user.company_id[0]] },
loaded: function(self,companies){ self.company = companies[0]; },
}
]
});
}