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.

51 lines
1.7 KiB

  1. /*
  2. Copyright (C) 2015-Today GRAP (http://www.grap.coop)
  3. @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
  4. License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  5. */
  6. odoo.define('pos_customer_display.screens', function (require) {
  7. "use strict";
  8. var screens = require('point_of_sale.screens');
  9. screens.PaymentScreenWidget.include({
  10. render_paymentlines: function() {
  11. if (this.pos.get_order().get_total_with_tax() === 0) {
  12. // Render payment is called each time a new order is created
  13. // (and so when lauching the PoS)
  14. // in that case, we display the welcome message
  15. this.pos.proxy.send_text_customer_display(
  16. this.pos.proxy.prepare_message_welcome()
  17. );
  18. } else {
  19. this.pos.proxy.send_text_customer_display(
  20. this.pos.proxy.prepare_message_payment()
  21. );
  22. }
  23. return this._super();
  24. },
  25. });
  26. screens.ClientListScreenWidget.include({
  27. save_changes: function(){
  28. if(this.has_client_changed()){
  29. this.pos.proxy.send_text_customer_display(
  30. this.pos.proxy.prepare_message_client(this.new_client)
  31. );
  32. }
  33. // we disable the send of message, during the call of _super()
  34. // because when selecting customer, all lines are recomputed
  35. // and so a message is sent for each lines
  36. // causing useless flashes
  37. this.pos.send_message_customer_display = false;
  38. var res = this._super();
  39. this.pos.send_message_customer_display = true;
  40. return res;
  41. },
  42. });
  43. });