Přejít na obsah
Menu
You need to be registered to interact with the community.
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
Zrušit
Nejlepší odpověď


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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
2
kvě 22
5346
2
led 25
1458
1
pro 24
1337
0
pro 24
1027
0
srp 23
2879