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.

244 lines
7.7 KiB

  1. odoo.define('pos_container.tour.tare', function (require) {
  2. "use strict";
  3. var Tour = require('web_tour.tour');
  4. function click_numpad(num) {
  5. return {
  6. content: "click on numpad button '" + num + "'",
  7. trigger: ".input-button.number-char:contains('"+num+"')"
  8. }
  9. }
  10. function scan(barcode) {
  11. return {
  12. content: "Scanning barcode " + barcode,
  13. trigger: "input.ean",
  14. run: "text " + barcode
  15. }
  16. }
  17. function confirm_scan() {
  18. return {
  19. content: "Confirm barcode",
  20. trigger: ".button.barcode",
  21. }
  22. }
  23. function set_weight(weight) {
  24. return {
  25. content: "Setting weight " + weight,
  26. trigger: "input.weight",
  27. run: "text " + weight
  28. }
  29. }
  30. function confirm_weight() {
  31. return {
  32. content: "Confirm weight",
  33. trigger: ".button.set_weight",
  34. }
  35. }
  36. function check_selected_orderline(message, check) {
  37. return {
  38. content: message,
  39. trigger: ".orderline.selected " + check,
  40. run: function () {}, // it's a check
  41. }
  42. }
  43. var steps = [{
  44. content: 'waiting for loading to finish',
  45. trigger: '.o_main_content:has(.loader:hidden)',
  46. run: function () {},
  47. },
  48. scan('0499999999998'),
  49. confirm_scan(),
  50. set_weight(0.1),
  51. confirm_weight(),
  52. {
  53. content: "Click on save",
  54. trigger: ".add-container",
  55. },
  56. // Test a second time with a custom name
  57. scan('0499999999981'),
  58. confirm_scan(),
  59. set_weight(0.2),
  60. confirm_weight(),
  61. {
  62. content: "Set a custom name",
  63. trigger:"input.container-name",
  64. run:"text TOTO",
  65. }, {
  66. content: "Click on save",
  67. trigger: ".add-container",
  68. },
  69. // Scan du premier contenant
  70. scan('0499999999998'),
  71. confirm_scan(),
  72. check_selected_orderline("Check: empty container in the orderline", ".product-name:contains('Container without product')"),
  73. check_selected_orderline("Check: the name is 'Container'", ".info:contains('Container')"),
  74. check_selected_orderline("Check: the quantity is 0", ".info em:contains('0.000')"),
  75. {
  76. content: "select product",
  77. trigger: ".product:contains('Whiteboard Pen')", //UoM = kg
  78. },
  79. set_weight(0.2),
  80. confirm_weight(),
  81. {
  82. content: "validate weight",
  83. trigger: ".buy-product",
  84. },
  85. check_selected_orderline("Check: the name is 'Container'", ".info:contains('Container')"),
  86. check_selected_orderline("Check: orderline in AUTO tare mode", ".pos-right-align:contains('AUTO')"),
  87. check_selected_orderline("Check: orderline's product is the Pen", ".product-name:contains('Whiteboard Pen')"),
  88. check_selected_orderline("Check: the quantity is the tared weight", ".info:contains('0.200')"),
  89. {
  90. content: "click container button",
  91. trigger: ".control-button.o_container_button",
  92. }, {
  93. content: "Search Container TOTO",
  94. trigger: ".searchbox input",
  95. run: "text TOTO",
  96. }, {
  97. content: "Select container TOTO",
  98. trigger: ".container-line:contains('TOTO')",
  99. }, {
  100. content: "Click delete",
  101. trigger: ".button.delete-container",
  102. }, {
  103. content: "Click cancel",
  104. trigger: ".button.cancel",
  105. }, {
  106. content: "Click delete",
  107. trigger: ".button.delete-container",
  108. }, {
  109. content: "Click confirm",
  110. trigger: ".button.confirm",
  111. }, {
  112. content: "Search by barcode",
  113. trigger: ".searchbox input",
  114. run: "text 0499999999998",
  115. }, {
  116. content: "select the searched container",
  117. trigger: ".container-line:contains('Container')",
  118. }, {
  119. content: "confirm selection",
  120. trigger: ".containerlist-screen .next",
  121. }, {
  122. content: "remove orderline quantity",
  123. trigger: ".input-button.numpad-backspace",
  124. }, {
  125. content: "delete orderline",
  126. trigger: ".input-button.numpad-backspace",
  127. }, {
  128. content: "select another product",
  129. trigger: ".product:contains('Desk Organizer')", //UoM = kg
  130. },
  131. set_weight(0.5),
  132. confirm_weight(),
  133. {
  134. content: "confirm purchase",
  135. trigger: ".buy-product",
  136. }, {
  137. content: "switch numpad to tare mode",
  138. trigger: ".control-button.o_tare_button",
  139. },
  140. click_numpad(0),
  141. click_numpad('.'),
  142. click_numpad(2),
  143. check_selected_orderline("Check: orderline in MAN tare mode", ".pos-right-align:contains('MAN')"),
  144. check_selected_orderline("Check: orderline's product is the Organizer", ".product-name:contains('Desk Organizer')"),
  145. check_selected_orderline("Check: the quantity is the tared weight", ".info:contains('0.300')"),
  146. {
  147. content: "click orderline auto",
  148. trigger: ".orderline .pos-right-align:contains('AUTO')",
  149. }, {
  150. content: "switch numpad to tare mode",
  151. trigger: ".control-button.o_tare_button",
  152. },
  153. click_numpad(0),
  154. click_numpad('.'),
  155. click_numpad(2),
  156. check_selected_orderline("Check: orderline in MAN tare mode", ".pos-right-align:contains('MAN')"),
  157. check_selected_orderline("Check: orderline's product is the Pen", ".product-name:contains('Whiteboard Pen')"),
  158. check_selected_orderline("Check: the quantity is the tared weight", ".info em:contains('0.100')"),
  159. {
  160. content: "switch numpad to quantity mode",
  161. trigger: ".mode-button[data-mode='quantity']",
  162. },
  163. click_numpad(0),
  164. click_numpad('.'),
  165. click_numpad(6),
  166. check_selected_orderline("Check: orderline in MAN tare mode", ".pos-right-align:contains('MAN')"),
  167. check_selected_orderline("Check: orderline's product is the Pen", ".product-name:contains('Whiteboard Pen')"),
  168. check_selected_orderline("Check: the quantity is 0.6", ".info em:contains('0.600')"),
  169. check_selected_orderline("Check: the tare is unchanged", ".info:contains('0.2')"),
  170. check_selected_orderline("Check: the gross weight is the tare + the quantity", ".info:contains('Gross : 0.8 kg')"),
  171. {
  172. content: "Add a unit product",
  173. trigger: ".product:contains('Large Cabinet')",
  174. }, {
  175. content: "click discount",
  176. trigger: ".mode-button[data-mode='discount']",
  177. },
  178. click_numpad(1),
  179. click_numpad(0),
  180. check_selected_orderline("Check: orderline in MAN tare mode", ".pos-right-align:contains('MAN')"),
  181. check_selected_orderline("Check: the undiscounted price is still 320", ".info:contains('320.00')"),
  182. {
  183. content: "Add a unit product",
  184. trigger: ".product:contains('Large Cabinet')",
  185. }, {
  186. content: "click price change",
  187. trigger: ".mode-button[data-mode='price']",
  188. },
  189. click_numpad(2),
  190. click_numpad(0),
  191. click_numpad(0),
  192. check_selected_orderline("Check: orderline in MAN tare mode", ".pos-right-align:contains('MAN')"),
  193. // Ajouter une ligne en AUTO
  194. scan('0499999999998'),
  195. confirm_scan(),
  196. {
  197. content: "select product",
  198. trigger: ".product:contains('Whiteboard Pen')", //UoM = kg
  199. },
  200. set_weight(0.3),
  201. confirm_weight(),
  202. {
  203. content: "validate weight",
  204. trigger: ".buy-product",
  205. },
  206. {
  207. content: "pay",
  208. trigger: ".button.pay",
  209. },
  210. click_numpad(2),
  211. click_numpad(0),
  212. click_numpad(0),
  213. click_numpad(0),
  214. {
  215. content: "validate",
  216. trigger: ".button.next",
  217. }];
  218. var autre = [{
  219. content: "relancer POS",
  220. trigger: "",
  221. }, {
  222. content: "click commandes",
  223. trigger: "",
  224. }, {
  225. content: "sélectionner dernière commande",
  226. trigger: "",
  227. }, {
  228. content: "click reprint",
  229. trigger: "",
  230. }];
  231. Tour.register('pos_container', { test: true, url: '/pos/web' }, steps);
  232. });