Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
3 Răspunsuri
7885 Vizualizări

Hi ,

I need to print my custom report in odoo pos interface. In the ReceiptScreenWidget I have added a button to print my custom report. So while clicking on that button I need to print or download that report. How can I do that?

This is my qweb template I used to add the print button in ReceiptScreenWidget

<t t-extend="ReceiptScreenWidget">

<t t-jquery=".button.print_invoice" t-operation="after">

<div class="button print_report_custom">

<i class='fa fa-print'></i> Print  report </div> </t> </t>


I need to print the report in the following click function.



screens.ReceiptScreenWidget.include({

    renderElement: function() {

        var self = this;

        this._super();


        var button_print_custom = this.$('.button.print_report_custom');

        button_print_custom.click(function () {

            var order = self.pos.get_order();

            if (!self._locked) 

            {

           

            }

            });

},

        });


 

Thanks in Advance


Imagine profil
Abandonează

Even I am looking something like this

Autor Cel mai bun răspuns

Hi,

Found the solution for this 

In the onclick of the button I just called a rpc query and added the function to print the report in that python file, and its worked for me.

Imagine profil
Abandonează

can you share your code?

Cel mai bun răspuns

Sharing a full code not possible but  I can guide you through it.

Steps:

1) Define a xml reciept view like Bill 

name - :  OrderReportReceipt

<t t-name="PaymentSummaryReportXmlReceipt">
<receipt align='center' width='50' value-thousands-separator='' >
//your code
</receipt>
</t>

2) Define an Action Button


var reportorder_button = ActionButtonWidget.extend({
    template: 'ReportorderButton',
init: function (parent, options) { this._super(parent, options); // youre code  }, 
button_click: function () {
var self = this;   
self.gui.show_popup('report_selection'
,{ title: _t('Report'),
list: selection_list,
confirm: function (repor_data) { var order = self.pos.get_order();
// your code  },
 }); },
});
define_action_button({ 'name': 'reportorder',
'widget': reportorder_button,
 });
3) define a popup with name which I have mentioned above
var ReprotPopupWidget = PopupWidget.extend({
template: 'ReprotPopupWidget',
print funtion(){
var self = this;
receipt = QWeb.render('OrderReportXmlReceipt', {
                                    widget: self,
                                    pos: self.pos,
                                    order: order,
  });
self.gui.show_screen('receipt');
},


});
gui.define_popup({name:'report_selection',widget: ReprotPopupWidget});
Codes and contribution from your side needed but it may help to get an idea.

Refer Screen.js code in Base module - point_of_sale

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
1
iul. 25
974
2
aug. 24
1525
1
mar. 24
2510
1
nov. 22
5668
0
sept. 20
2182