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.

28 lines
1.1 KiB

  1. /******************************************************************************
  2. Copyright (C) 2018 - 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. 'use strict';
  7. odoo.define('pos_timeout.models', function (require) {
  8. var models = require('point_of_sale.models');
  9. /*************************************************************************
  10. Extend module.PosModel:
  11. Overload _save_to_server to alter the timeout
  12. */
  13. var PosModelParent = models.PosModel.prototype;
  14. models.PosModel = models.PosModel.extend({
  15. _save_to_server: function (orders, options) {
  16. // Get PoS Config Settings
  17. var timeout = this.config.pos_order_timeout;
  18. if (timeout > 0 && orders && orders.length) {
  19. arguments[1].timeout = timeout * 1000 * orders.length;
  20. }
  21. return PosModelParent._save_to_server.apply(this, arguments);
  22. },
  23. });
  24. });