odoo-addon-stock-barcodes 16.0.1.1.0.10__py3-none-any.whl → 16.0.2.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. odoo/addons/stock_barcodes/README.rst +217 -12
  2. odoo/addons/stock_barcodes/__init__.py +1 -0
  3. odoo/addons/stock_barcodes/__manifest__.py +8 -3
  4. odoo/addons/stock_barcodes/data/stock_barcodes_action.xml +8 -0
  5. odoo/addons/stock_barcodes/data/stock_barcodes_option.xml +99 -1
  6. odoo/addons/stock_barcodes/i18n/stock_barcodes.pot +268 -79
  7. odoo/addons/stock_barcodes/models/__init__.py +1 -0
  8. odoo/addons/stock_barcodes/models/barcode_events_mixin.py +11 -0
  9. odoo/addons/stock_barcodes/models/stock_barcodes_action.py +137 -3
  10. odoo/addons/stock_barcodes/models/stock_picking.py +17 -2
  11. odoo/addons/stock_barcodes/models/stock_picking_type.py +35 -0
  12. odoo/addons/stock_barcodes/models/stock_quant.py +51 -1
  13. odoo/addons/stock_barcodes/readme/CONTRIBUTORS.rst +4 -0
  14. odoo/addons/stock_barcodes/readme/DESCRIPTION.rst +4 -0
  15. odoo/addons/stock_barcodes/readme/HISTORY.rst +12 -0
  16. odoo/addons/stock_barcodes/readme/USAGE.rst +191 -10
  17. odoo/addons/stock_barcodes/reports/__init__.py +1 -0
  18. odoo/addons/stock_barcodes/reports/barcode_actions_report.py +16 -0
  19. odoo/addons/stock_barcodes/reports/barcode_actions_report.xml +25 -0
  20. odoo/addons/stock_barcodes/reports/reports.xml +28 -0
  21. odoo/addons/stock_barcodes/static/description/index.html +189 -33
  22. odoo/addons/stock_barcodes/static/src/docs/barcodes_actions.pdf +0 -0
  23. odoo/addons/stock_barcodes/static/src/docs/barcodes_demo.pdf +0 -0
  24. odoo/addons/stock_barcodes/static/src/img/add_product.png +0 -0
  25. odoo/addons/stock_barcodes/static/src/img/apply_inventory.png +0 -0
  26. odoo/addons/stock_barcodes/static/src/img/apply_inventory_reason.png +0 -0
  27. odoo/addons/stock_barcodes/static/src/img/barcode_interface_picking.png +0 -0
  28. odoo/addons/stock_barcodes/static/src/img/confirm_all_quantity_items_picking.png +0 -0
  29. odoo/addons/stock_barcodes/static/src/img/confirm_items_picking.png +0 -0
  30. odoo/addons/stock_barcodes/static/src/img/create_barcode_action.png +0 -0
  31. odoo/addons/stock_barcodes/static/src/img/form_add_product.png +0 -0
  32. odoo/addons/stock_barcodes/static/src/img/form_add_product_quantity.png +0 -0
  33. odoo/addons/stock_barcodes/static/src/img/form_add_product_reset.png +0 -0
  34. odoo/addons/stock_barcodes/static/src/img/inventory_barcode_action.png +0 -0
  35. odoo/addons/stock_barcodes/static/src/img/list_action_items.png +0 -0
  36. odoo/addons/stock_barcodes/static/src/img/list_items.png +0 -0
  37. odoo/addons/stock_barcodes/static/src/img/list_items_picking.png +0 -0
  38. odoo/addons/stock_barcodes/static/src/img/list_items_picking_edit.png +0 -0
  39. odoo/addons/stock_barcodes/static/src/img/list_items_picking_quantity.png +0 -0
  40. odoo/addons/stock_barcodes/static/src/img/list_items_picking_scanned.png +0 -0
  41. odoo/addons/stock_barcodes/static/src/img/list_picking.png +0 -0
  42. odoo/addons/stock_barcodes/static/src/img/print_barcodes.png +0 -0
  43. odoo/addons/stock_barcodes/static/src/scss/barcode.scss +135 -0
  44. odoo/addons/stock_barcodes/static/src/scss/stock.scss +285 -0
  45. odoo/addons/stock_barcodes/static/src/utils/barcodes_models_utils.esm.js +1 -0
  46. odoo/addons/stock_barcodes/static/src/views/actions/stock_barcode_main_menu.esm.js +88 -0
  47. odoo/addons/stock_barcodes/static/src/views/actions/stock_barcode_main_menu.scss +74 -0
  48. odoo/addons/stock_barcodes/static/src/views/actions/stock_barcode_main_menu.xml +45 -0
  49. odoo/addons/stock_barcodes/static/src/views/form/form_controller.esm.js +71 -0
  50. odoo/addons/stock_barcodes/static/src/views/form/form_view.esm.js +14 -0
  51. odoo/addons/stock_barcodes/static/src/views/kanban/kanban_record.esm.js +27 -0
  52. odoo/addons/stock_barcodes/static/src/views/{kanban_renderer.esm.js → kanban/kanban_renderer.esm.js} +78 -27
  53. odoo/addons/stock_barcodes/static/src/views/kanban/kanban_view.esm.js +8 -0
  54. odoo/addons/stock_barcodes/static/src/views/kanban/stock_barcodes_kanban.xml +28 -0
  55. odoo/addons/stock_barcodes/static/src/views/views.esm.js +35 -7
  56. odoo/addons/stock_barcodes/static/src/widgets/boolean_toggle.esm.js +46 -0
  57. odoo/addons/stock_barcodes/tests/common.py +25 -0
  58. odoo/addons/stock_barcodes/tests/test_stock_barcodes.py +65 -1
  59. odoo/addons/stock_barcodes/tests/test_stock_barcodes_picking.py +97 -13
  60. odoo/addons/stock_barcodes/views/stock_barcodes_action_view.xml +83 -9
  61. odoo/addons/stock_barcodes/views/stock_barcodes_menu.xml +1 -1
  62. odoo/addons/stock_barcodes/views/stock_picking_views.xml +29 -10
  63. odoo/addons/stock_barcodes/wizard/__init__.py +1 -0
  64. odoo/addons/stock_barcodes/wizard/stock_barcodes_candidate_picking.py +148 -0
  65. odoo/addons/stock_barcodes/wizard/stock_barcodes_read.py +148 -55
  66. odoo/addons/stock_barcodes/wizard/stock_barcodes_read_inventory.py +30 -2
  67. odoo/addons/stock_barcodes/wizard/stock_barcodes_read_inventory_views.xml +101 -92
  68. odoo/addons/stock_barcodes/wizard/stock_barcodes_read_picking.py +77 -141
  69. odoo/addons/stock_barcodes/wizard/stock_barcodes_read_picking_views.xml +197 -219
  70. odoo/addons/stock_barcodes/wizard/stock_barcodes_read_todo.py +45 -0
  71. odoo/addons/stock_barcodes/wizard/stock_barcodes_read_views.xml +87 -170
  72. odoo_addon_stock_barcodes-16.0.2.0.0.dist-info/METADATA +435 -0
  73. odoo_addon_stock_barcodes-16.0.2.0.0.dist-info/RECORD +103 -0
  74. odoo/addons/stock_barcodes/static/src/css/stock.scss +0 -136
  75. odoo/addons/stock_barcodes/static/src/views/form_view.esm.js +0 -17
  76. odoo_addon_stock_barcodes-16.0.1.1.0.10.dist-info/METADATA +0 -230
  77. odoo_addon_stock_barcodes-16.0.1.1.0.10.dist-info/RECORD +0 -68
  78. {odoo_addon_stock_barcodes-16.0.1.1.0.10.dist-info → odoo_addon_stock_barcodes-16.0.2.0.0.dist-info}/WHEEL +0 -0
  79. {odoo_addon_stock_barcodes-16.0.1.1.0.10.dist-info → odoo_addon_stock_barcodes-16.0.2.0.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,285 @@
1
+ @mixin margin-form-edit-sm($margin) {
2
+ @include media-breakpoint-down(sm) {
3
+ margin: $margin !important;
4
+ }
5
+ }
6
+
7
+ .oe_stock_scan_button {
8
+ border: none !important;
9
+ background: none !important;
10
+ box-shadow: none !important;
11
+ }
12
+
13
+ .oe_stock_barcodes_bottombar {
14
+ bottom: 0;
15
+ background-color: $o-view-background-color;
16
+ border-width: 1px 0 0 0 solid $border-color;
17
+ box-shadow: 0 -3px 10px #c9ccd2;
18
+ height: 60px !important;
19
+ }
20
+
21
+ // Avoid too big small buttons from core
22
+ .o_web_client.o_touch_device {
23
+ .oe_stock_barcordes_form {
24
+ .btn {
25
+ &,
26
+ .btn-sm {
27
+ padding: 0.25rem 0.5rem;
28
+ }
29
+ }
30
+ }
31
+ }
32
+
33
+ .oe_stock_barcordes_form {
34
+ padding: 0 !important;
35
+ height: 100%;
36
+ // Recover useless space
37
+ div[name="_barcode_scanned"] {
38
+ min-height: 0 !important;
39
+ }
40
+
41
+ div[name="package_id"],
42
+ div[name="product_id"],
43
+ div[name="lot_id"] {
44
+ width: 90% !important;
45
+ }
46
+
47
+ div[name="product_id"],
48
+ div[name="package_id"],
49
+ div[name="lot_name"] {
50
+ @include margin-form-edit-sm(0 0 0 1%);
51
+ }
52
+
53
+ div[name="location_dest_id"] {
54
+ @include margin-form-edit-sm(0 0 1% 1%);
55
+ }
56
+
57
+ div.widget_numeric_step {
58
+ font-size: 1.5rem !important;
59
+ }
60
+
61
+ input#location_id,
62
+ input#location_dest_id,
63
+ input#package_id,
64
+ input#product_id,
65
+ input#lot_id_1,
66
+ input#lot_name {
67
+ border-radius: 0.5rem !important;
68
+ padding: 0.375rem 0.75rem !important;
69
+ height: 40px !important;
70
+ font-size: 1.5rem !important;
71
+
72
+ & + ul.o-autocomplete--dropdown-menu {
73
+ li {
74
+ font-size: 1.5rem !important;
75
+ }
76
+ }
77
+ }
78
+
79
+ div[name="candidate_picking_ids"] {
80
+ div.oe_kanban_color_alert {
81
+ padding: 0 !important;
82
+ margin: 0 !important;
83
+ }
84
+
85
+ div.o_kanban_ungrouped.o_kanban_renderer {
86
+ margin: 0 !important;
87
+ padding: 0 !important;
88
+ }
89
+
90
+ @include media-breakpoint-down(sm) {
91
+ div.o_kanban_renderer {
92
+ margin: 2% 1% 2% 1% !important;
93
+ }
94
+ }
95
+ }
96
+
97
+ div.scan_fields {
98
+ width: 100% !important;
99
+ margin: 0 !important;
100
+
101
+ div.o-autocomplete.dropdown {
102
+ + a.o_dropdown_button {
103
+ display: none !important;
104
+ }
105
+ }
106
+
107
+ @include media-breakpoint-down(sm) {
108
+ padding: 0 2% 0 2% !important;
109
+ width: 100% !important;
110
+ }
111
+
112
+ > div.o_inner_group.grid.col-lg-6 {
113
+ div.o_cell {
114
+ width: 100% !important;
115
+ }
116
+ }
117
+
118
+ div.mt4.col-lg-6 {
119
+ @include media-breakpoint-down(sm) {
120
+ margin-bottom: 1.5rem !important;
121
+ }
122
+ }
123
+
124
+ &:has(button[name="action_clean_lot"]) {
125
+ div[name="lot_name"] {
126
+ width: 88% !important;
127
+ @include media-breakpoint-down(sm) {
128
+ width: 90% !important;
129
+ }
130
+ }
131
+ button[name="action_clean_lot"] {
132
+ margin-left: 5px !important;
133
+ }
134
+ }
135
+ }
136
+
137
+ .o_group .scan_fields {
138
+ &.o_inner_group {
139
+ margin-bottom: 0 !important;
140
+ }
141
+
142
+ @include media-breakpoint-down(sm) {
143
+ padding: 2% 0 2% 0 !important;
144
+ }
145
+ margin: 0 !important;
146
+ }
147
+
148
+ .o_form_sheet,
149
+ .o_form_sheet_bg {
150
+ padding: 0 !important;
151
+ margin: 0 !important;
152
+ max-width: 100% !important;
153
+ border: 0 !important;
154
+ }
155
+
156
+ // In Odoo 16 the flat input styling lacks proper usability
157
+ .o_field_widget {
158
+ margin-bottom: 1px !important;
159
+
160
+ .o_input {
161
+ border-radius: 3px;
162
+ border-width: 1px;
163
+ background-color: white;
164
+ }
165
+
166
+ .o_x2m_control_panel {
167
+ margin: 0px !important;
168
+ }
169
+ }
170
+
171
+ .o_kanban_record {
172
+ flex-basis: 100%;
173
+
174
+ .btn-full-width {
175
+ margin: -9px;
176
+ width: calc(100% + 18px);
177
+ height: calc(100% + 18px);
178
+ }
179
+
180
+ &.o_kanban_ghost {
181
+ display: none;
182
+ }
183
+ }
184
+
185
+ .alert {
186
+ //position: fixed;
187
+ top: 0;
188
+ width: 100%;
189
+ border-radius: 0;
190
+ padding: 0;
191
+ min-height: 50px;
192
+ z-index: 999;
193
+ }
194
+
195
+ .oe_stock_barcordes_content {
196
+ overflow-y: overlay !important;
197
+
198
+ div.g-col-sm-2 {
199
+ &:has(div.o_horizontal_separator) {
200
+ display: none !important;
201
+ }
202
+ }
203
+
204
+ div.o_inner_group.grid.px-3 {
205
+ padding: 0 !important;
206
+ }
207
+
208
+ div[name="picking_id"] {
209
+ > a.o_form_uri {
210
+ span {
211
+ color: white !important;
212
+ }
213
+ }
214
+ }
215
+
216
+ div[name="action_unlock_picking"] {
217
+ span {
218
+ color: white !important;
219
+ }
220
+ }
221
+ }
222
+
223
+ div[name="info"] {
224
+ div.alert {
225
+ display: flex !important;
226
+ @include media-breakpoint-down(sm) {
227
+ display: block !important;
228
+ text-align: center !important;
229
+ }
230
+ }
231
+
232
+ div.barcode-danger {
233
+ background-color: #dc3545 !important;
234
+ }
235
+ }
236
+ }
237
+
238
+ .o_kanban_barcode {
239
+ .o_kanban_record.oe_kanban_details {
240
+ @extend .btn;
241
+ @extend .btn-secondary;
242
+ padding: 0.6em 0;
243
+ margin-bottom: 0.5em;
244
+ }
245
+ }
246
+
247
+ .oe_kanban_action_button:focus {
248
+ background-color: lightgray;
249
+ }
250
+
251
+ // Left icon in small screens
252
+ .oe_span_small_icon {
253
+ width: 25px;
254
+ text-align: center;
255
+ }
256
+
257
+ // Display 100% all menu elements
258
+ .oe_kanban_card_full_width {
259
+ width: 100% !important;
260
+ }
261
+
262
+ // The kanban view adds some pre-styles that we want to be able to tweak
263
+ div[name="menu_actions"] {
264
+ div[role="article"] {
265
+ margin-top: 10px !important;
266
+ }
267
+ }
268
+
269
+ // Dropdown that is desactivated at lg width
270
+ @media (min-width: 992px) {
271
+ .d-lg-flex-no-dropdown {
272
+ position: relative !important;
273
+ display: flex !important;
274
+ border: none;
275
+ box-shadow: none;
276
+ bottom: auto !important;
277
+ transform: none !important;
278
+ }
279
+ }
280
+
281
+ .dropdown-menu.d-lg-flex-no-dropdown {
282
+ .d-flex {
283
+ margin-bottom: 5px;
284
+ }
285
+ }
@@ -18,6 +18,7 @@ export const barcodeModels = [
18
18
  /**
19
19
  * Helper to know if the given model is allowed
20
20
  *
21
+ * @param {String} modelName
21
22
  * @returns {Boolean}
22
23
  */
23
24
  export function isAllowedBarcodeModel(modelName) {
@@ -0,0 +1,88 @@
1
+ /** @odoo-module **/
2
+ import {_t} from "@web/core/l10n/translation";
3
+ import {browser} from "@web/core/browser/browser";
4
+ import {markup} from "@odoo/owl";
5
+ import {registry} from "@web/core/registry";
6
+ import {useService} from "@web/core/utils/hooks";
7
+
8
+ const {Component, onWillStart, useEffect} = owl;
9
+
10
+ export class StockBarcodesMainMenu extends Component {
11
+ setup() {
12
+ super.setup();
13
+ this.actionService = useService("action");
14
+ this.ormService = useService("orm");
15
+ const busService = useService("bus_service");
16
+ const notification = useService("notification");
17
+ this.modelBarcodeAction = "stock.barcodes.action";
18
+ if (this.hasService("home_menu"))
19
+ this.homeMenuService = useService("home_menu");
20
+ onWillStart(async () => {
21
+ this.barcodeActions = await this.getBarcodeActions();
22
+ });
23
+
24
+ const handleNotification = ({detail: notifications}) => {
25
+ if (notifications && notifications.length > 0) {
26
+ notifications.forEach((notif) => {
27
+ const {payload, type} = notif;
28
+ if (type === "actions_main_menu_barcode") {
29
+ if (payload.action_ok && payload.action) {
30
+ this.actionService.doAction(payload.action);
31
+ } else {
32
+ notification.add(
33
+ _t("No action found with barcode: " + payload.barcode),
34
+ {
35
+ type: "danger",
36
+ }
37
+ );
38
+ }
39
+ }
40
+ });
41
+ }
42
+ };
43
+ useEffect(() => {
44
+ busService.addChannel("stock_barcodes_main_menu");
45
+ busService.addEventListener("notification", handleNotification);
46
+ return () => {
47
+ busService.deleteChannel("stock_barcodes_main_menu");
48
+ busService.removeEventListener("notification", handleNotification);
49
+ };
50
+ });
51
+ }
52
+
53
+ hasService(service) {
54
+ return service in this.env.services;
55
+ }
56
+
57
+ mainMenuHome() {
58
+ // Enterprise
59
+ if (this.hasService("home_menu")) {
60
+ this.homeMenuService.toggle(true);
61
+ } else {
62
+ // Community
63
+ this.actionService.doAction("mail.action_discuss");
64
+ browser.setTimeout(() => browser.location.reload(), 100);
65
+ }
66
+ }
67
+
68
+ async openAction(action_id) {
69
+ const action = await this.ormService.call(
70
+ this.modelBarcodeAction,
71
+ "open_action",
72
+ [action_id]
73
+ );
74
+ action.help = markup(_t(action.help));
75
+ this.actionService.doAction(action);
76
+ }
77
+
78
+ async getBarcodeActions() {
79
+ return await this.ormService.call(this.modelBarcodeAction, "search_read", [], {
80
+ domain: [["action_window_id", "!=", false]],
81
+ fields: ["id", "name", "icon_class"],
82
+ });
83
+ }
84
+ }
85
+
86
+ StockBarcodesMainMenu.template = "stock_barcodes.MainMenu";
87
+
88
+ registry.category("actions").add("stock_barcodes_main_menu", StockBarcodesMainMenu);
@@ -0,0 +1,74 @@
1
+ @keyframes o_barcode_scanner_intro {
2
+ 25% {
3
+ top: 75%;
4
+ }
5
+ 50% {
6
+ top: 0;
7
+ }
8
+ 75% {
9
+ top: 100%;
10
+ }
11
+ 100% {
12
+ top: 50%;
13
+ }
14
+ }
15
+
16
+ div.o_action_manager {
17
+ &:has(div.stock-barcodes-main-menu) {
18
+ overflow-y: scroll !important;
19
+ background-color: $o-community-color !important;
20
+ @include media-breakpoint-down(sm) {
21
+ overflow: scroll !important;
22
+ }
23
+ }
24
+ }
25
+
26
+ div.stock-barcodes-main-menu {
27
+ background-color: white !important;
28
+ margin: 0 10% 5% 10% !important;
29
+ border-radius: 5px !important;
30
+ min-height: 90% !important;
31
+ @include media-breakpoint-down(sm) {
32
+ margin: 0 !important;
33
+ }
34
+
35
+ img {
36
+ height: 220px !important;
37
+ }
38
+
39
+ div.o_stock_barcode_functions {
40
+ margin-top: 5rem;
41
+ @include media-breakpoint-down(sm) {
42
+ margin-top: 3.6rem;
43
+ }
44
+ }
45
+
46
+ div.o_stock_barcode_buttons {
47
+ button {
48
+ padding: 1.5rem 1.5rem !important;
49
+ }
50
+ }
51
+
52
+ span.o_stock_barcode_laser {
53
+ @include o-position-absolute(33%, -15px, auto, -15px);
54
+ height: 5px;
55
+ background: rgba(red, 0.6);
56
+ box-shadow: 0 1px 10px 1px rgba(red, 0.8);
57
+ animation: o_barcode_scanner_intro 1s cubic-bezier(0.6, -0.28, 0.735, 0.045)
58
+ 0.4s;
59
+ width: 26%;
60
+ margin-left: 38%;
61
+ @include media-breakpoint-down(sm) {
62
+ @include o-position-absolute(35%, -15px, auto, -15px);
63
+ width: 95%;
64
+ margin-left: 6%;
65
+ }
66
+ }
67
+
68
+ div.o_stock_barcode_header_home {
69
+ padding-right: 45% !important;
70
+ @include media-breakpoint-down(sm) {
71
+ padding-right: 27% !important;
72
+ }
73
+ }
74
+ }
@@ -0,0 +1,45 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <templates xml:space="preserve">
3
+
4
+ <div
5
+ t-name="stock_barcodes.MainMenu"
6
+ class="d-flex flex-column stock-barcodes-main-menu align-items-center p-4"
7
+ owl="1"
8
+ >
9
+ <div
10
+ class="d-flex o_stock_barcode_header_home justify-content-between align-items-center w-100"
11
+ >
12
+ <a href="#" t-on-click="mainMenuHome">
13
+ <i class="fa fa-chevron-left fa-2x" />
14
+ </a>
15
+ <h1 class="mb-4">Barcode Scanner</h1>
16
+ </div>
17
+ <div
18
+ class="alert alert-info alert-dismissible fade show w-100 fs-3 o_stock_barcode_description"
19
+ role="alert"
20
+ >
21
+ Scan a barcode actions
22
+ </div>
23
+ <div
24
+ class="d-flex justify-content-center w-100 mt-3 px-2 o_stock_barcode_buttons"
25
+ >
26
+ <div class="row w-100">
27
+ <t
28
+ t-foreach="this.barcodeActions"
29
+ t-as="barcodeAction"
30
+ t-key="barcodeAction.id"
31
+ >
32
+ <div class="col-12 col-md-6">
33
+ <button
34
+ class="btn btn-primary btn-lg w-100 mt-3 text-uppercase"
35
+ t-on-click="() => this.openAction(barcodeAction.id)"
36
+ >
37
+ <span t-attf-class="#{barcodeAction.icon_class} mx-2" />
38
+ <t t-out="barcodeAction.name" />
39
+ </button>
40
+ </div>
41
+ </t>
42
+ </div>
43
+ </div>
44
+ </div>
45
+ </templates>
@@ -0,0 +1,71 @@
1
+ /** @odoo-module */
2
+ /* Copyright 2021 Tecnativa - Alexandre D. Díaz
3
+ * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
4
+
5
+ import {onMounted, useEffect} from "@odoo/owl";
6
+ import {FormController} from "@web/views/form/form_controller";
7
+ import {useService} from "@web/core/utils/hooks";
8
+
9
+ export class StockBarcodesFormController extends FormController {
10
+ setup() {
11
+ super.setup();
12
+ const busService = useService("bus_service");
13
+ const ormService = useService("orm");
14
+ this.enableApplyCount = false;
15
+ // Adds support to use control_pannel_hidden from the
16
+ // context to disable the control panel
17
+ if (this.props.context.control_panel_hidden) {
18
+ this.display.controlPanel = false;
19
+ }
20
+
21
+ const handleNotification = ({detail: notifications}) => {
22
+ if (notifications && notifications.length > 0) {
23
+ notifications.forEach((notif) => {
24
+ const {payload, type} = notif;
25
+ if (type === "count_apply_inventory" && payload) {
26
+ this.countApplyInventory(payload.count);
27
+ }
28
+ });
29
+ }
30
+ };
31
+ useEffect(() => {
32
+ busService.addChannel("stock_barcodes_form_update");
33
+ busService.addEventListener("notification", handleNotification);
34
+ const $applyInventory = $("span.count_apply_inventory");
35
+ if ($applyInventory.length > 0) {
36
+ if (!this.enableApplyCount) {
37
+ this.countApplyInventory(1);
38
+ this.enableApplyCount = true;
39
+ }
40
+ } else {
41
+ this.enableApplyCount = false;
42
+ }
43
+ return () => {
44
+ busService.deleteChannel("stock_barcodes_form_update");
45
+ busService.removeEventListener("notification", handleNotification);
46
+ };
47
+ });
48
+
49
+ onMounted(async () => {
50
+ if (this.props.resModel === "wiz.stock.barcodes.read.inventory") {
51
+ const fields = ["count_inventory_quants"];
52
+ const countApply = await ormService.call(
53
+ this.props.resModel,
54
+ "read",
55
+ [this.props.resId],
56
+ {fields}
57
+ );
58
+ this.countApplyInventory(
59
+ countApply.length > 0 ? countApply[0].count_inventory_quants : 0
60
+ );
61
+ }
62
+ });
63
+ }
64
+
65
+ countApplyInventory(countApply = 0) {
66
+ const $countApply = $("span.count_apply_inventory");
67
+ if ($countApply.length) {
68
+ $countApply.text(countApply);
69
+ }
70
+ }
71
+ }
@@ -0,0 +1,14 @@
1
+ /** @odoo-module */
2
+ /* Copyright 2021 Tecnativa - Alexandre D. Díaz
3
+ * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
4
+
5
+ import {StockBarcodesFormController} from "./form_controller.esm";
6
+ import {formView} from "@web/views/form/form_view";
7
+ import {registry} from "@web/core/registry";
8
+
9
+ export const StockBarcodesFormView = {
10
+ ...formView,
11
+ Controller: StockBarcodesFormController,
12
+ };
13
+
14
+ registry.category("views").add("stock_barcodes_form", StockBarcodesFormView);
@@ -0,0 +1,27 @@
1
+ /** @odoo-module */
2
+ /* Copyright 2022 Tecnativa - Alexandre D. Díaz
3
+ * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
4
+
5
+ import {KanbanRecord} from "@web/views/kanban/kanban_record";
6
+ import {patch} from "@web/core/utils/patch";
7
+
8
+ patch(KanbanRecord.prototype, "stock_barcodes.KanbanRecord", {
9
+ props: {
10
+ ...KanbanRecord.props,
11
+ },
12
+
13
+ setup() {
14
+ this._super(...arguments);
15
+ },
16
+
17
+ async onCustomGlobalClick() {
18
+ const record_barcode = $('div[name="inventory_quant_ids"]');
19
+ if (record_barcode.length > 0) {
20
+ const record = this.props.record;
21
+ $("div.oe_kanban_operations").addClass("d-none");
22
+ $("div.oe_kanban_operations-" + record.data.id).removeClass("d-none");
23
+ return;
24
+ }
25
+ this._super.apply(this, arguments);
26
+ },
27
+ });