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

Im trying to convert the numeric total/subtotal to words in the POS module so that it is printed out on the receipt.  Im working on these files:

\addons\point_of_sale\static\src\js\ models.js

\addons\point_of_sale\static\src\xml\ pos.xml

Model.js

I've added the function get_letras() so far like so in models.js and added it to the pos_ticket_view.xml:


but it doesnt show up on the ticket.  So far Im passing order.get_letras(widget.format_currency(order.get_change())) but even if I pass it a fixed value like order.get_letras(510) I still get num as being UNDEFINED:


Any help would be appreciated:



Imagine profil
Abandonează
Cel mai bun răspuns

Hi Santiago,

You can use python code to convert number to words.

install num2words python package in your system

          from num2words import num2words
          num2words(Subtotal, lang='es') //here es for Spanish
Or you can refer

https://stackoverflow.com/questions/13913165/python-script-to-convert-from-numbers-to-words-for-printing-cheques/13932483
      
Write below code in your .js file

      var _super_order = models.Order.prototype;
      models.Order = models.Order.extend({
      export_for_printing: function() {
          var json =
      _super_order.export_for_printing.apply(this,arguments);
          json.subtotal_in_words = this.get_subtotal_in_words();
          return json;
          },
      get_subtotal_in_words:function(){
          var subtotal = this.get_total_without_tax();
          //here call your python code to convert subtotal to words and return it OR you can use js code to convert subototal into words
 },
      });

now to print this in receipt write below code in xml:


      <t t-esc="widget.format_currency(order.get_subtotal_in_words())"/>

Hope this will help you!

Thanks.

Imagine profil
Abandonează
Cel mai bun răspuns

I have a problem that looks like this but I would like to display the exchange of a currency in pos receipt, for example:

 total (CDF)                   4000fc

 total (USD)                    2$

I dont want to use two currences but just add that line in pos receipt.  thank you

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
1
aug. 25
995
1
iul. 25
1247
3
iul. 25
4272
3
mai 25
2184
1
iul. 25
1416