Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
1 Vastaa
3170 Näkymät

Hello, I want to add a button in POS Payment widget, just like the default Invoice button. I have managed to add the button there and create a Click event, but i am not being able to print my custom report.

odoo.define('dev_dtr_inv_layout', function (require) {
"use strict";
var screens = require('point_of_sale.screens');
var gui = require('point_of_sale.gui');
var core = require('web.core');
var _t = core._t;
screens.PaymentScreenWidget.include({
events: {
'click .js_custom_print': 'orderClickEvent',
},
orderClickEvent: function(e){
alert("Clicked!")
var self = this;
var order_name = self.pos.get_order().name
this._rpc({
model: 'report.dev_dtr_inv_layout.template_sale_tax_invoice',
method: 'print_report',
args: [[]],
}).then(function (result) {
self.do_action(result);
});
var order = this.pos.get_order();
order.js_custom_print = !order.js_custom_print;
if (order.js_custom_print) {
this.$('.js_custom_print').addClass('highlight');
} else {
this.$('.js_custom_print').removeClass('highlight');
}
},

});
});

This is my javascript code so far and its throwing errors because of None Type object.

Whats the proper way to print a qweb report from javascript?

Avatar
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
0
helmik. 21
2577
2
tammik. 20
10564
0
elok. 15
4270
1
jouluk. 17
4272
0
helmik. 24
1001