Skip to Content
Menu
This question has been flagged

Hi, I'm kind of new with Odoo and I'm in a bit of a struggle at the moment, allow me to ellaborate:

I need to change both the screens.js and pos.xml files so that I can have two buttons in the print screen: one that prints the default receipt when clicked and another that prints a different template.

So far, I've created the second template in the pos.xml file and included the second button on the screen, but I'm stuck when it comes to editing the functions that would make the second button work.

I'm trying to track down the functions that take the default PosTicket template and "connect it" to the default button so I can copy the default ones and edit them to fit the second button and its template.

Which are the functions that I should duplicate and configure?

Avatar
Discard
Best Answer


Hi,

You can check the "ReceiptScreenWidget" inside the screens.js file. If you check the "renderElement" function of this widget, you can see how they are capturing the click event of the 'print receipt' button. There is a function called 'print' which will be executed on the button click. This button renders the receipt and prints it(refer the function 'print_xml').

So what you need to do is, extend the template "ReceiptScreenWidget"(this template contains the 'print receipt' button) and add your new button there. Then modify the "ReceiptScreenWidget" in the js file and capture the new button click. Once you captured the new button click, you can simply print the receipt in the format which you want.


Hope this answer helps.


Avatar
Discard
Related Posts Replies Views Activity
2
May 22
4561
1
Dec 24
39
0
Dec 24
43
0
Aug 23
1260
1
Jan 21
1403