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

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]; },
}
]
});
}

Avatar
Discard
Author Best Answer

This post solves my problem : https://www.odoo.com/fr_FR/forum/help-1/question/inheritance-of-posmodel-in-pos-models-js-file-59023

Avatar
Discard
Related Posts Replies Views Activity
1
Aug 23
1961
1
Jul 22
7883
3
Jul 21
4280
1
Aug 19
2273
0
Jan 16
2381