Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
5334 Переглядів

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

Аватар
Відмінити
Автор Найкраща відповідь

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

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
1
серп. 23
3147
Current model name Вирішено
1
лип. 22
9115
Override JS mail Вирішено
3
лип. 21
5384
1
серп. 19
3165
0
січ. 16
3263