Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

Odoo9: PROBLEM WITH THE API

By
Drees Far
on 12/16/15, 12:29 PM 461 views

Hi friends!!!

Please, i have this code that works fine on openerp and i want to migrate to odoo9 but it doesnt display anything.

Who can help me please:

update_date: function() {

var self = this;

console.log(this.field_manager.get_field_value("date_start"));

console.log('momo test');

console.log(this.field_manager.get_field_value("date_end"));

console.log(this.field_manager.get_field_value("company_id"));

var date = this.field_manager.get_field_value("date_start");

var date_end = this.field_manager.get_field_value("date_end");

var company_id = this.field_manager.get_field_value("company_id");

var model = new instance.web.Model("hr.payslip");

console.log("fddf =" );

$(self.$el.find('.riheneremove')).remove();

model.query(['employee_id', 'seetek_worked_day', 'hours_overtime_100', 'seetek_absence_day', 'total_brut','retenue_source', 'net_payer']).filter([['date_from', '=', date ], ['date_to', '=', date_end], ['company_id', '=', company_id]]).limit(15).all().then(function (result) {console.log("result =" +result);

_.each(result, function(item) {

console.log("item =" +item);

console.log("item =" +JSON.stringify(item));

var $item = $(QWeb.render("seetek_example.Mywidget", {item: item}));

var tr = $('<tr></tr>');

var td1 = $('<td class="riheneremove" bgcolor="#FF6699" style="border: 1px solid black;color: blue;">'+item.employee_id[1]+'</td>');

$(self.$el.find('#employe')).append(td1);

self.$el.append(tr);

var tr = $('<tr></tr>');

var td1 = $('<td class="riheneremove" style="border: 1px solid black;">'+item.employee_id[0]+'</td>');

$(self.$el.find('#matricule')).append(td1);

self.$el.append(tr);

var tr = $('<tr></tr>');

var td1 = $('<td class="riheneremove" style="border: 1px solid black;">'+item.seetek_worked_day+'</td>');

$(self.$el.find('#presence')).append(td1);

self.$el.append(tr);

var tr = $('<tr></tr>');

var td1 = $('<td class="riheneremove" style="border: 1px solid black;">'+item.hours_overtime_100+'</td>');

$(self.$el.find('#heures')).append(td1);

self.$el.append(tr);

var tr = $('<tr></tr>');

var td1 = $('<td class="riheneremove" style="border: 1px solid black;">'+item.seetek_absence_day+'</td>');

$(self.$el.find('#absence')).append(td1);

self.$el.append(tr);

var tr = $('<tr></tr>');

var td1 = $('<td class="riheneremove" style="border: 1px solid black;">'+item.total_brut+'</td>');

$(self.$el.find('#brut')).append(td1);

self.$el.append(tr);

var tr = $('<tr></tr>');

var td1 = $('<td class="riheneremove" style="border: 1px solid black;"></td>');

$(self.$el.find('#cnss')).append(td1);

self.$el.append(tr);

var tr = $('<tr></tr>');

var td1 = $('<td class="riheneremove" style="border: 1px solid black;">'+item.total_brut * 0.0918+'</td>');

$(self.$el.find('#cnsss')).append(td1);

self.$el.append(tr);

var tr = $('<tr></tr>');

var td1 = $('<td class="riheneremove" style="border: 1px solid black;">'+item.total_brut * 0.1657+'</td>');

$(self.$el.find('#cnssp')).append(td1);

self.$el.append(tr);

var tr = $('<tr></tr>');

var td1 = $('<td class="riheneremove" style="border: 1px solid black;">'+item.total_brut * (1 - 0.0918)+'</td>');

$(self.$el.find('#salaire')).append(td1);

self.$el.append(tr);

var tr = $('<tr></tr>');

var td1 = $('<td class="riheneremove" style="border: 1px solid black;">'+item.retenue_source+'</td>');

$(self.$el.find('#irpp')).append(td1);

self.$el.append(tr);

var tr = $('<tr></tr>');

var td1 = $('<td class="riheneremove" style="border: 1px solid black;">'+item.net_payer+'</td>');

$(self.$el.find('#net')).append(td1);

self.$el.append(tr);

var tr = $('<tr></tr>');

var td1 = $('<td class="riheneremove" style="border: 1px solid black;">'+1+'</td>');

$(self.$el.find('#foprolos')).append(td1);

self.$el.append(tr);

var brut_tfp = item.total_brut;

console.log(brut_tfp);

var model2 = new instance.web.Model("res.company");

console.log(model);

model2.query(['tfp_rate','tfp_accident']).limit(15).all().then(function (result) {

console.log("result =" +JSON.stringify(result));

_.each(result, function(item) {

console.log("item =" +item);

console.log("item =" +JSON.stringify(item));

var tr = $('<tr></tr>');

var td1 = $('<td class="riheneremove" style="border: 1px solid black;">'+item.tfp_rate+'</td>');

var td2 = $('<td class="riheneremove" style="border: 1px solid black;">'+item.tfp_accident +'</td>');

var td3 = $('<td class="riheneremove" style="border: 1px solid black;">'+item.tfp_rate * brut_tfp +'</td>');

$(self.$el.find('#tfp')).append(td1);

$(self.$el.find('#at')).append(td2);

$(self.$el.find('#bruttfp')).append(td3);

});

});

$item.click(function() {

self.item_clicked(item);

});

});

});

},

Best Regards.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 12/16/15, 12:29 PM
Seen: 461 times
Last updated: 1/18/16, 3:23 PM