You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.5 KiB

  1. /*
  2. POS Gift Tickete for Odoo
  3. Copyright (C) 2015 FactorLibre (www.factorlibre.com)
  4. @author: Ismael Calvo <ismael.calvo@factorlibre.com>
  5. The licence is in the file __openerp__.py
  6. */
  7. openerp.pos_gift_ticket = function (instance) {
  8. var _t = instance.web._t,
  9. _lt = instance.web._lt;
  10. var QWeb = instance.web.qweb;
  11. instance.point_of_sale.ReceiptScreenWidget.include({
  12. show: function(){
  13. this._super()
  14. var self = this;
  15. var print_gift_ticket_button = this.add_action_button({
  16. label: _t('Gift Ticket'),
  17. icon: '/point_of_sale/static/src/img/icons/png48/printer.png',
  18. click: function(){
  19. self.print_gift();
  20. },
  21. });
  22. },
  23. refresh_gift_ticket: function(){
  24. var order = this.pos.get('selectedOrder');
  25. $('.pos-receipt-container', this.$el).html(QWeb.render('PosGiftTicket',{
  26. widget:this,
  27. order: order,
  28. orderlines: order.get('orderLines').models,
  29. }));
  30. },
  31. print: function() {
  32. this.refresh()
  33. this._super()
  34. },
  35. print_gift: function() {
  36. this.refresh_gift_ticket()
  37. this.pos.get('selectedOrder')._printed = true;
  38. setTimeout(function() {
  39. window.print();
  40. }, 2000);
  41. // window.print();
  42. },
  43. });
  44. };