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.

104 lines
3.9 KiB

  1. /* Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
  2. License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). */
  3. odoo.define('pos_product_qty_available.tour', function (require) {
  4. "use strict";
  5. var tour = require("web_tour.tour");
  6. var core = require('web.core');
  7. var _t = core._t;
  8. function open_pos_neworder () {
  9. return [{
  10. trigger: ".o_pos_kanban button.oe_kanban_action_button",
  11. content: _t("Click to start the point of sale interface"),
  12. position: "bottom",
  13. }, {
  14. content: "Switch to table or make dummy action",
  15. trigger: '.table, .order-button.selected',
  16. position: "bottom",
  17. timeout: 20000,
  18. }, {
  19. content: 'waiting for loading to finish',
  20. trigger: '.order-button.neworder-button',
  21. }];
  22. }
  23. function add_product_to_order (product_name) {
  24. return [{
  25. content: 'buy ' + product_name,
  26. trigger: '.product-list .product-name:contains("' + product_name + '")',
  27. }, {
  28. content: 'the ' + product_name + ' have been added to the order',
  29. trigger: '.orderline:contains("' + product_name + '") .qty-info:contains("0")',
  30. }];
  31. }
  32. function payment (pay_method) {
  33. return [{
  34. trigger: '.button.pay',
  35. content: _t("Open the payment screen"),
  36. }, {
  37. content: "Choose Administrator like a cashier",
  38. trigger: '.modal-dialog.cashier:not(.oe_hidden) .cashier .selection-item:contains("Mitchell Admin"), .payment-screen:not(.oe_hidden) h1:contains("Payment")',
  39. }, {
  40. extra_trigger: '.button.paymentmethod:contains("' + pay_method +'")',
  41. trigger: '.button.paymentmethod:contains("' + pay_method +'")',
  42. content: _t("Click the payment method"),
  43. }, {
  44. trigger: '.payment-screen .input-button.number-char:contains("2")',
  45. content: 'Set payment amount',
  46. }, {
  47. extra_trigger: '.button.next.highlight:contains("Validate")',
  48. trigger: '.button.next.highlight:contains("Validate")',
  49. content: 'Validate payment',
  50. }, {
  51. extra_trigger: '.pos-sale-ticket',
  52. trigger: '.button.next.highlight:contains("Next Order")',
  53. content: 'Check proceeded validation',
  54. }];
  55. }
  56. function close_pos () {
  57. return [{
  58. trigger: '.header-button:contains("Close")',
  59. content: _t("Close POS"),
  60. }, {
  61. trigger: '.header-button.confirm:contains("Confirm")',
  62. content: _t("Close POS"),
  63. }, {
  64. extra_trigger: ".o_pos_kanban button.oe_kanban_action_button",
  65. trigger: '.breadcrumb li.active',
  66. content: _t("Click to start the point of sale interface"),
  67. position: "bottom",
  68. }];
  69. }
  70. function check_quantity () {
  71. return [{
  72. content: 'check quantity',
  73. extra_trigger: '.product-list .product:contains("LED Lamp") .qty-tag.not-available:contains("-1")',
  74. trigger: '.order-button.selected',
  75. }];
  76. }
  77. var steps = [tour.STEPS.SHOW_APPS_MENU_ITEM, {
  78. trigger: '.o_app[data-menu-xmlid="point_of_sale.menu_point_root"]',
  79. content: _t("Launch your point of sale"),
  80. position: 'right',
  81. edition: 'community',
  82. }, {
  83. trigger: '.o_app[data-menu-xmlid="point_of_sale.menu_point_root"]',
  84. content: _t("Launch your point of sale"),
  85. position: 'bottom',
  86. edition: 'enterprise',
  87. }];
  88. steps = steps.concat(open_pos_neworder());
  89. steps = steps.concat(add_product_to_order('LED Lamp'));
  90. steps = steps.concat(payment('Cash (USD)'));
  91. steps = steps.concat(close_pos());
  92. steps = steps.concat(open_pos_neworder());
  93. steps = steps.concat(check_quantity());
  94. tour.register('tour_pos_product_qty_available', {test: true, url: '/web'}, steps);
  95. });