Hi.
I want to inherit function "get_due" of "Models.Order".
Here is the code in original function in a file point_of_sale/static/src/js/models.js:
get_due: function(paymentline) {
if (!paymentline) {
var due = this.get_total_with_tax() - this.get_total_paid();
} else {
var due = this.get_total_with_tax();
var lines = this.paymentlines.models;
for (var i = 0; i < lines.length; i++) {
if (lines[i] === paymentline) {
break;
} else {
due -= lines[i].get_amount();
}
}
}
return round_pr(due, this.pos.currency.rounding);
},
i want to customize that function and add some code like this:
odoo.define('pos_mi_module.mi_module', function (require) {
"use strict";
var Models = require('point_of_sale.models');
Models.Order = Models.Order.extend({
get_due: function (paymentline) {
if (!paymentline) {
var due = this.get_total_with_tax() - this.get_total_paid();
} else {
var due = this.get_total_with_tax();
var lines = this.paymentlines.models;
for (var i = 0; i < lines.length; i++) {
if (lines[i] === paymentline) {
break;
} else {
due -= lines[i].get_amount();
}
}
}
return round_pr(due, this.pos.currency.rounding);
},
});
})
and after updating the module when i enter the session of the POS it remains black, without showing anything, and no error appears in the browser console. Both codes of "get_due" are the same because use copy and paste. What happen with this?.
Thanks in advance