odoo-addon-shopfloor 18.0.0.1.2__py3-none-any.whl → 18.0.0.3.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.
- odoo/addons/shopfloor/README.rst +1 -1
- odoo/addons/shopfloor/__manifest__.py +1 -1
- odoo/addons/shopfloor/actions/message.py +3 -3
- odoo/addons/shopfloor/models/stock_move_line.py +3 -3
- odoo/addons/shopfloor/models/stock_picking.py +2 -5
- odoo/addons/shopfloor/services/checkout.py +64 -54
- odoo/addons/shopfloor/services/cluster_picking.py +3 -2
- odoo/addons/shopfloor/services/delivery.py +14 -15
- odoo/addons/shopfloor/services/zone_picking.py +12 -9
- odoo/addons/shopfloor/static/description/index.html +1 -1
- odoo/addons/shopfloor/tests/__init__.py +50 -48
- odoo/addons/shopfloor/tests/common.py +3 -1
- odoo/addons/shopfloor/tests/test_checkout_auto_post.py +9 -8
- odoo/addons/shopfloor/tests/test_checkout_base.py +1 -1
- odoo/addons/shopfloor/tests/test_checkout_cancel_line.py +12 -8
- odoo/addons/shopfloor/tests/test_checkout_done.py +5 -5
- odoo/addons/shopfloor/tests/test_checkout_list_delivery_packaging.py +0 -2
- odoo/addons/shopfloor/tests/test_checkout_list_package.py +19 -12
- odoo/addons/shopfloor/tests/test_checkout_new_package.py +7 -7
- odoo/addons/shopfloor/tests/test_checkout_no_package.py +6 -6
- odoo/addons/shopfloor/tests/test_checkout_scan.py +1 -1
- odoo/addons/shopfloor/tests/test_checkout_scan_dest_location.py +2 -2
- odoo/addons/shopfloor/tests/test_checkout_scan_line.py +3 -1
- odoo/addons/shopfloor/tests/test_checkout_scan_package_action.py +14 -14
- odoo/addons/shopfloor/tests/test_checkout_scan_package_action_no_prefill_qty.py +9 -9
- odoo/addons/shopfloor/tests/test_checkout_select_line.py +1 -1
- odoo/addons/shopfloor/tests/test_checkout_select_package_base.py +6 -4
- odoo/addons/shopfloor/tests/test_checkout_set_qty.py +12 -11
- odoo/addons/shopfloor/tests/test_checkout_summary.py +2 -2
- odoo/addons/shopfloor/tests/test_delivery_base.py +3 -3
- odoo/addons/shopfloor/tests/test_delivery_done.py +1 -2
- odoo/addons/shopfloor/tests/test_delivery_reset_qty_done_line.py +2 -2
- odoo/addons/shopfloor/tests/test_delivery_reset_qty_done_pack.py +2 -2
- odoo/addons/shopfloor/tests/test_delivery_scan_deliver.py +11 -11
- odoo/addons/shopfloor/tests/test_delivery_set_qty_done_line.py +1 -1
- odoo/addons/shopfloor/tests/test_delivery_set_qty_done_pack.py +1 -1
- odoo/addons/shopfloor/tests/test_zone_picking_select_line.py +5 -2
- odoo/addons/shopfloor/tests/test_zone_picking_set_line_destination.py +7 -6
- odoo/addons/shopfloor/tests/test_zone_picking_set_line_destination_pick_pack.py +4 -3
- odoo/addons/shopfloor/tests/test_zone_picking_unload_all.py +2 -2
- odoo/addons/shopfloor/tests/test_zone_picking_unload_single.py +1 -1
- {odoo_addon_shopfloor-18.0.0.1.2.dist-info → odoo_addon_shopfloor-18.0.0.3.0.dist-info}/METADATA +2 -2
- {odoo_addon_shopfloor-18.0.0.1.2.dist-info → odoo_addon_shopfloor-18.0.0.3.0.dist-info}/RECORD +45 -46
- {odoo_addon_shopfloor-18.0.0.1.2.dist-info → odoo_addon_shopfloor-18.0.0.3.0.dist-info}/WHEEL +1 -1
- odoo/addons/shopfloor/tests/test_zone_picking_select_line_first_scan_location.py.bak +0 -202
- {odoo_addon_shopfloor-18.0.0.1.2.dist-info → odoo_addon_shopfloor-18.0.0.3.0.dist-info}/top_level.txt +0 -0
@@ -23,37 +23,38 @@ from . import test_actions_stock
|
|
23
23
|
# from . import test_cluster_picking_stock_issue
|
24
24
|
# from . import test_cluster_picking_change_pack_lot
|
25
25
|
# from . import test_cluster_picking_unload
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
26
|
+
from . import test_checkout_base
|
27
|
+
from . import test_checkout_scan
|
28
|
+
from . import test_checkout_select
|
29
|
+
from . import test_checkout_scan_line
|
30
|
+
from . import test_checkout_scan_line_no_prefill_qty
|
31
|
+
from . import test_checkout_scan_line_base
|
32
|
+
from . import test_checkout_scan_dest_location
|
33
|
+
from . import test_checkout_select_line
|
34
|
+
from . import test_checkout_select_package_base
|
35
|
+
from . import test_checkout_set_qty
|
36
|
+
from . import test_checkout_scan_package_action
|
37
|
+
from . import test_checkout_scan_package_action_no_prefill_qty
|
38
|
+
from . import test_checkout_new_package
|
39
|
+
from . import test_checkout_no_package
|
40
|
+
from . import test_checkout_auto_post
|
41
|
+
from . import test_checkout_list_delivery_packaging
|
42
|
+
from . import test_checkout_list_package
|
43
|
+
from . import test_checkout_summary
|
44
|
+
from . import test_checkout_change_packaging
|
45
|
+
from . import test_checkout_cancel_line
|
46
|
+
from . import test_checkout_done
|
47
|
+
from . import test_delivery_base
|
48
|
+
from . import test_delivery_done
|
49
|
+
from . import test_delivery_scan_deliver
|
50
|
+
from . import test_delivery_reset_qty_done_line
|
51
|
+
from . import test_delivery_reset_qty_done_pack
|
52
|
+
from . import test_delivery_set_qty_done_pack
|
53
|
+
from . import test_delivery_set_qty_done_line
|
54
|
+
from . import test_delivery_sublocation
|
55
|
+
from . import test_delivery_list_stock_picking
|
56
|
+
from . import test_delivery_select
|
57
|
+
|
57
58
|
# from . import test_location_content_transfer_base
|
58
59
|
# from . import test_location_content_transfer_start
|
59
60
|
# from . import test_location_content_transfer_get_work
|
@@ -63,24 +64,25 @@ from . import test_actions_stock
|
|
63
64
|
# from . import test_location_content_transfer_set_destination_package_or_line
|
64
65
|
# from . import test_location_content_transfer_putaway
|
65
66
|
# from . import test_location_content_transfer_mix
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
67
|
+
from . import test_zone_picking_base
|
68
|
+
from . import test_zone_picking_complete_mix_pack_flux
|
69
|
+
from . import test_zone_picking_start
|
70
|
+
from . import test_zone_picking_select_picking_type
|
71
|
+
from . import test_zone_picking_select_line
|
72
|
+
from . import test_zone_picking_select_line_no_prefill_qty
|
73
|
+
from . import test_zone_picking_select_line_first_scan_location
|
74
|
+
from . import test_zone_picking_set_line_destination
|
75
|
+
from . import test_zone_picking_set_line_destination_no_prefill_qty
|
76
|
+
from . import test_zone_picking_set_line_destination_pick_pack
|
77
|
+
from . import test_zone_picking_zero_check
|
78
|
+
from . import test_zone_picking_stock_issue
|
79
|
+
|
78
80
|
# from . import test_zone_picking_change_pack_lot
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
81
|
+
from . import test_zone_picking_unload_buffer_lines
|
82
|
+
from . import test_zone_picking_unload_single
|
83
|
+
from . import test_zone_picking_unload_all
|
84
|
+
from . import test_zone_picking_unload_set_destination
|
85
|
+
from . import test_zone_picking_require_destination_package
|
84
86
|
from . import test_misc
|
85
87
|
from . import test_move_action_assign
|
86
88
|
from . import test_scan_anything
|
@@ -182,8 +182,10 @@ class CommonCase(BaseCommonCase):
|
|
182
182
|
)
|
183
183
|
# this method adds the quantity to the current quantity, so remove it
|
184
184
|
quantity -= sum(quants.mapped("quantity"))
|
185
|
+
if not quantity:
|
186
|
+
return
|
185
187
|
cls.env["stock.quant"]._update_available_quantity(
|
186
|
-
product, location, quantity, package_id=package, lot_id=lot
|
188
|
+
product, location, quantity=quantity, package_id=package, lot_id=lot
|
187
189
|
)
|
188
190
|
|
189
191
|
@classmethod
|
@@ -14,11 +14,11 @@ class CheckoutAutoPostCase(CheckoutCommonCase):
|
|
14
14
|
selected_move_line_a = picking.move_line_ids.filtered(
|
15
15
|
lambda x: x.product_id == self.product_a
|
16
16
|
)
|
17
|
-
selected_move_line_a.
|
17
|
+
selected_move_line_a.qty_picked = 7
|
18
18
|
selected_move_line_b = picking.move_line_ids.filtered(
|
19
19
|
lambda x: x.product_id == self.product_b
|
20
20
|
)
|
21
|
-
selected_move_line_b.
|
21
|
+
selected_move_line_b.qty_picked = 9
|
22
22
|
selected_move_line_c = picking.move_line_ids.filtered(
|
23
23
|
lambda x: x.product_id == self.product_c
|
24
24
|
)
|
@@ -44,10 +44,10 @@ class CheckoutAutoPostCase(CheckoutCommonCase):
|
|
44
44
|
)
|
45
45
|
self.assertEqual(picking, selected_move_line_c.picking_id)
|
46
46
|
|
47
|
-
# The lines in the new picking must have the expected
|
47
|
+
# The lines in the new picking must have the expected picked qty,
|
48
48
|
# and the split picking must be marked as "done".
|
49
|
-
self.assertEqual(selected_move_line_a.
|
50
|
-
self.assertEqual(selected_move_line_b.
|
49
|
+
self.assertEqual(selected_move_line_a.qty_picked, 7)
|
50
|
+
self.assertEqual(selected_move_line_b.qty_picked, 9)
|
51
51
|
self.assertEqual(selected_move_line_a.picking_id.state, "done")
|
52
52
|
|
53
53
|
# In the original picking, we should have three lines:
|
@@ -63,6 +63,7 @@ class CheckoutAutoPostCase(CheckoutCommonCase):
|
|
63
63
|
self.assertEqual(line_b_in_original_picking.quantity, 11)
|
64
64
|
self.assertEqual(selected_move_line_c.quantity, 30)
|
65
65
|
|
66
|
-
self.assertEqual(line_a_in_original_picking.
|
67
|
-
self.assertEqual(line_b_in_original_picking.
|
68
|
-
self.assertEqual(selected_move_line_c.
|
66
|
+
self.assertEqual(line_a_in_original_picking.qty_picked, 0)
|
67
|
+
self.assertEqual(line_b_in_original_picking.qty_picked, 0)
|
68
|
+
self.assertEqual(selected_move_line_c.qty_picked, 0)
|
69
|
+
self.assertFalse(selected_move_line_c.picked)
|
@@ -91,6 +91,6 @@ class CheckoutCommonCase(CommonCase):
|
|
91
91
|
"message_type": "warning",
|
92
92
|
"body": "The quantity scanned for one or more lines cannot be "
|
93
93
|
"higher than the maximum allowed. "
|
94
|
-
f"({line.product_id.name} : {str(line.
|
94
|
+
f"({line.product_id.name} : {str(line.qty_picked)} > {str(line.quantity)})", # noqa
|
95
95
|
},
|
96
96
|
)
|
@@ -35,7 +35,7 @@ class CheckoutRemovePackageCase(CheckoutCommonCase):
|
|
35
35
|
new_package = self.env["stock.quant.package"].create({})
|
36
36
|
(pack1_lines | raw_line).write(
|
37
37
|
{
|
38
|
-
"
|
38
|
+
"qty_picked": 10,
|
39
39
|
"result_package_id": new_package.id,
|
40
40
|
"shopfloor_checkout_done": True,
|
41
41
|
}
|
@@ -43,7 +43,7 @@ class CheckoutRemovePackageCase(CheckoutCommonCase):
|
|
43
43
|
new_package2 = self.env["stock.quant.package"].create({})
|
44
44
|
pack2_lines.write(
|
45
45
|
{
|
46
|
-
"
|
46
|
+
"qty_picked": 10,
|
47
47
|
"result_package_id": new_package2.id,
|
48
48
|
"shopfloor_checkout_done": True,
|
49
49
|
}
|
@@ -59,26 +59,30 @@ class CheckoutRemovePackageCase(CheckoutCommonCase):
|
|
59
59
|
pack1_lines + raw_line + pack2_lines,
|
60
60
|
[
|
61
61
|
{
|
62
|
-
"
|
62
|
+
"qty_picked": 0,
|
63
|
+
"picked": False,
|
63
64
|
# reset to origin package
|
64
65
|
"result_package_id": pack1_lines.mapped("package_id").id,
|
65
66
|
"shopfloor_checkout_done": False,
|
66
67
|
},
|
67
68
|
{
|
68
|
-
"
|
69
|
+
"qty_picked": 0,
|
70
|
+
"picked": False,
|
69
71
|
# reset to origin package
|
70
72
|
"result_package_id": pack1_lines.mapped("package_id").id,
|
71
73
|
"shopfloor_checkout_done": False,
|
72
74
|
},
|
73
75
|
{
|
74
|
-
"
|
76
|
+
"qty_picked": 0,
|
77
|
+
"picked": False,
|
75
78
|
# result to an empty package (raw product)
|
76
79
|
"result_package_id": False,
|
77
80
|
"shopfloor_checkout_done": False,
|
78
81
|
},
|
79
82
|
# different package, leave untouched
|
80
83
|
{
|
81
|
-
"
|
84
|
+
"qty_picked": 10,
|
85
|
+
"picked": True,
|
82
86
|
"result_package_id": new_package2.id,
|
83
87
|
"shopfloor_checkout_done": True,
|
84
88
|
},
|
@@ -97,7 +101,7 @@ class CheckoutRemovePackageCase(CheckoutCommonCase):
|
|
97
101
|
|
98
102
|
raw_line = self.raw_move.move_line_ids
|
99
103
|
|
100
|
-
raw_line.write({"
|
104
|
+
raw_line.write({"qty_picked": 10, "shopfloor_checkout_done": True})
|
101
105
|
|
102
106
|
# and now, we want to drop the new_package
|
103
107
|
response = self.service.dispatch(
|
@@ -107,7 +111,7 @@ class CheckoutRemovePackageCase(CheckoutCommonCase):
|
|
107
111
|
|
108
112
|
self.assertRecordValues(
|
109
113
|
raw_line,
|
110
|
-
[{"
|
114
|
+
[{"qty_picked": 0, "picked": False, "shopfloor_checkout_done": False}],
|
111
115
|
)
|
112
116
|
|
113
117
|
self.assert_response(
|
@@ -10,7 +10,7 @@ class CheckoutDoneCase(CheckoutCommonCase):
|
|
10
10
|
self._fill_stock_for_moves(picking.move_ids, in_package=True)
|
11
11
|
picking.action_assign()
|
12
12
|
# line is done
|
13
|
-
picking.move_line_ids.write({"
|
13
|
+
picking.move_line_ids.write({"qty_picked": 10, "shopfloor_checkout_done": True})
|
14
14
|
response = self.service.dispatch("done", params={"picking_id": picking.id})
|
15
15
|
|
16
16
|
self.assertRecordValues(picking, [{"state": "done"}])
|
@@ -37,8 +37,8 @@ class CheckoutDonePartialCase(CheckoutCommonCase):
|
|
37
37
|
picking.action_assign()
|
38
38
|
cls.line1 = picking.move_line_ids[0]
|
39
39
|
cls.line2 = picking.move_line_ids[1]
|
40
|
-
cls.line1.write({"
|
41
|
-
cls.line2.write({"
|
40
|
+
cls.line1.write({"qty_picked": 10, "shopfloor_checkout_done": True})
|
41
|
+
cls.line2.write({"qty_picked": 2, "shopfloor_checkout_done": True})
|
42
42
|
|
43
43
|
cls.dest_location = picking.location_dest_id
|
44
44
|
cls.child_location = (
|
@@ -119,12 +119,12 @@ class CheckoutDoneRawUnpackedCase(CheckoutCommonCase):
|
|
119
119
|
cls.package = cls.env["stock.quant.package"].create({})
|
120
120
|
cls.line1.write(
|
121
121
|
{
|
122
|
-
"
|
122
|
+
"qty_picked": 10,
|
123
123
|
"shopfloor_checkout_done": True,
|
124
124
|
"result_package_id": cls.package.id,
|
125
125
|
}
|
126
126
|
)
|
127
|
-
cls.line2.write({"
|
127
|
+
cls.line2.write({"qty_picked": 10, "shopfloor_checkout_done": False})
|
128
128
|
|
129
129
|
def test_done_partial(self):
|
130
130
|
# line is done
|
@@ -105,8 +105,6 @@ class CheckoutListDeliveryPackagingCase(CheckoutCommonCase, CheckoutSelectPackag
|
|
105
105
|
self._fill_stock_for_moves(self.picking.move_ids, in_package=True)
|
106
106
|
self.picking.action_assign()
|
107
107
|
selected_lines = self.picking.move_line_ids
|
108
|
-
# for line in selected_lines:
|
109
|
-
# line.qty_done = line.quantity
|
110
108
|
response = self.service.dispatch(
|
111
109
|
"list_delivery_packaging",
|
112
110
|
params={
|
@@ -137,9 +137,9 @@ class CheckoutScanSetDestPackageCase(CheckoutCommonCase, SelectDestPackageMixin)
|
|
137
137
|
# them
|
138
138
|
cls.move_line1.result_package_id = cls.delivery_package
|
139
139
|
# We'll put only product A and B in the destination package
|
140
|
-
cls.move_line1.
|
141
|
-
cls.move_line2.
|
142
|
-
cls.move_line3.
|
140
|
+
cls.move_line1.qty_picked = cls.move_line1.quantity
|
141
|
+
cls.move_line2.qty_picked = cls.move_line2.quantity
|
142
|
+
cls.move_line3.qty_picked = 0
|
143
143
|
|
144
144
|
cls.picking = picking
|
145
145
|
|
@@ -161,7 +161,7 @@ class CheckoutScanSetDestPackageCase(CheckoutCommonCase, SelectDestPackageMixin)
|
|
161
161
|
"result_package_id": self.delivery_package.id,
|
162
162
|
"shopfloor_checkout_done": True,
|
163
163
|
},
|
164
|
-
#
|
164
|
+
# picked qty was zero so we don't set it as packed
|
165
165
|
{"result_package_id": self.pack1.id, "shopfloor_checkout_done": False},
|
166
166
|
],
|
167
167
|
)
|
@@ -232,9 +232,9 @@ class CheckoutScanSetDestPackageCase(CheckoutCommonCase, SelectDestPackageMixin)
|
|
232
232
|
)
|
233
233
|
self._assert_package_set(response)
|
234
234
|
|
235
|
-
def
|
235
|
+
def test_set_dest_package_ok_on_partial_qty_picked(self):
|
236
236
|
# Partially process line three 3 quantiy out of 10
|
237
|
-
self.move_line3.
|
237
|
+
self.move_line3.qty_picked = 3
|
238
238
|
response = self.service.dispatch(
|
239
239
|
"set_dest_package",
|
240
240
|
params={
|
@@ -250,23 +250,30 @@ class CheckoutScanSetDestPackageCase(CheckoutCommonCase, SelectDestPackageMixin)
|
|
250
250
|
{
|
251
251
|
"result_package_id": self.delivery_package.id,
|
252
252
|
"shopfloor_checkout_done": True,
|
253
|
+
"quantity": 10,
|
254
|
+
"qty_picked": 10,
|
255
|
+
"picked": True,
|
253
256
|
},
|
254
257
|
{
|
255
258
|
"result_package_id": self.delivery_package.id,
|
256
259
|
"shopfloor_checkout_done": True,
|
260
|
+
"quantity": 10,
|
261
|
+
"qty_picked": 10,
|
262
|
+
"picked": True,
|
257
263
|
},
|
258
264
|
# Line 3 has been split
|
259
265
|
{
|
260
266
|
"result_package_id": self.delivery_package.id,
|
261
267
|
"shopfloor_checkout_done": True,
|
262
|
-
"
|
263
|
-
"
|
268
|
+
"quantity": 3,
|
269
|
+
"qty_picked": 3,
|
270
|
+
"picked": True,
|
264
271
|
},
|
265
272
|
],
|
266
273
|
)
|
267
274
|
# Left quantity to do from line 3
|
268
275
|
new_move_line = self.picking.move_line_ids.filtered(
|
269
|
-
lambda line: line.
|
276
|
+
lambda line: not line.picked and line.quantity == 7
|
270
277
|
)
|
271
278
|
self.assertTrue(new_move_line)
|
272
279
|
self.assertFalse(new_move_line.shopfloor_checkout_done)
|
@@ -313,12 +320,12 @@ class CheckoutScanSetDestPackageCase(CheckoutCommonCase, SelectDestPackageMixin)
|
|
313
320
|
message=self.service.msg_store.dest_package_not_valid(package),
|
314
321
|
)
|
315
322
|
|
316
|
-
def
|
317
|
-
# If the
|
323
|
+
def test_set_dest_package_error_qty_picked_above(self):
|
324
|
+
# If the picked qty of a selected line goes beyond
|
318
325
|
# the maximum allowed, a message should be displayed
|
319
326
|
# and the user shouldn't be allowed to select a package.
|
320
327
|
line = fields.first(self.picking.move_line_ids)
|
321
|
-
line.
|
328
|
+
line.qty_picked = line.quantity + 1
|
322
329
|
response = self.service.dispatch(
|
323
330
|
"list_dest_package",
|
324
331
|
params={
|
@@ -28,9 +28,9 @@ class CheckoutNewPackageCase(CheckoutCommonCase, CheckoutSelectPackageMixin):
|
|
28
28
|
|
29
29
|
move_line1, move_line2, move_line3 = selected_lines
|
30
30
|
# we'll put only the first 2 lines (product A and B) in the new package
|
31
|
-
move_line1.
|
32
|
-
move_line2.
|
33
|
-
move_line3.
|
31
|
+
move_line1.qty_picked = move_line1.quantity
|
32
|
+
move_line2.qty_picked = move_line2.quantity
|
33
|
+
move_line3.qty_picked = 0
|
34
34
|
|
35
35
|
response = self.service.dispatch(
|
36
36
|
"new_package",
|
@@ -50,7 +50,7 @@ class CheckoutNewPackageCase(CheckoutCommonCase, CheckoutSelectPackageMixin):
|
|
50
50
|
)
|
51
51
|
self.assertRecordValues(
|
52
52
|
move_line3,
|
53
|
-
#
|
53
|
+
# picked qty was zero so we don't set it as packed and it remains in
|
54
54
|
# the same package
|
55
55
|
[{"result_package_id": pack1.id, "shopfloor_checkout_done": False}],
|
56
56
|
)
|
@@ -62,7 +62,7 @@ class CheckoutNewPackageCase(CheckoutCommonCase, CheckoutSelectPackageMixin):
|
|
62
62
|
message=self.msg_store.goods_packed_in(new_package),
|
63
63
|
)
|
64
64
|
|
65
|
-
def
|
65
|
+
def test_set_dest_package_error_qty_picked_above(self):
|
66
66
|
picking = self._create_picking(
|
67
67
|
lines=[
|
68
68
|
(self.product_a, 10),
|
@@ -72,12 +72,12 @@ class CheckoutNewPackageCase(CheckoutCommonCase, CheckoutSelectPackageMixin):
|
|
72
72
|
moves = picking.move_ids
|
73
73
|
self._fill_stock_for_moves(moves, in_package=True)
|
74
74
|
picking.action_assign()
|
75
|
-
# If the
|
75
|
+
# If the picked qty of a selected line goes beyond
|
76
76
|
# the maximum allowed, a message should be displayed
|
77
77
|
# and the user shouldn't be allowed to select a package.
|
78
78
|
selected_lines = moves.move_line_ids
|
79
79
|
line = fields.first(selected_lines)
|
80
|
-
line.
|
80
|
+
line.qty_picked = line.quantity + 1
|
81
81
|
response = self.service.dispatch(
|
82
82
|
"list_dest_package",
|
83
83
|
params={
|
@@ -33,9 +33,9 @@ class CheckoutNoPackageCase(CheckoutCommonCase, CheckoutSelectPackageMixin):
|
|
33
33
|
selected_lines = move_line1 + move_line2
|
34
34
|
|
35
35
|
# we'll put only the first 2 lines (product A and B) w/ no package
|
36
|
-
move_line1.
|
37
|
-
move_line2.
|
38
|
-
move_line3.
|
36
|
+
move_line1.qty_picked = move_line1.quantity
|
37
|
+
move_line2.qty_picked = move_line2.quantity
|
38
|
+
move_line3.qty_picked = 0
|
39
39
|
response = self.service.dispatch(
|
40
40
|
"no_package",
|
41
41
|
params={
|
@@ -79,12 +79,12 @@ class CheckoutNoPackageCase(CheckoutCommonCase, CheckoutSelectPackageMixin):
|
|
79
79
|
)
|
80
80
|
self.assertEqual(repr(err), "`checkout.no_package` endpoint is not enabled")
|
81
81
|
|
82
|
-
def
|
83
|
-
# If the
|
82
|
+
def test_set_dest_package_error_qty_picked_above(self):
|
83
|
+
# If the picked qty of a selected line goes beyond
|
84
84
|
# the maximum allowed, a message should be displayed
|
85
85
|
# and the user shouldn't be allowed to select a package.
|
86
86
|
line = fields.first(self.picking.move_line_ids)
|
87
|
-
line.
|
87
|
+
line.qty_picked = line.quantity + 1
|
88
88
|
response = self.service.dispatch(
|
89
89
|
"list_dest_package",
|
90
90
|
params={
|
@@ -189,7 +189,7 @@ class CheckoutScanCase(CheckoutCommonCase):
|
|
189
189
|
"select_line",
|
190
190
|
params={"picking_id": picking.id, "package_id": package.id},
|
191
191
|
)
|
192
|
-
self.assertTrue(all(m.
|
192
|
+
self.assertTrue(all(m.qty_picked for m in picking.move_line_ids))
|
193
193
|
self.assertEqual(picking.move_line_ids.shopfloor_user_id, self.env.user)
|
194
194
|
# He restarts the scenario and try to select again the previous line
|
195
195
|
# to continue its job
|
@@ -17,8 +17,8 @@ class CheckoutSelectChildLocationCase(CheckoutCommonCase):
|
|
17
17
|
picking.action_assign()
|
18
18
|
cls.line1 = picking.move_line_ids[0]
|
19
19
|
cls.line2 = picking.move_line_ids[1]
|
20
|
-
cls.line1.write({"
|
21
|
-
cls.line2.write({"
|
20
|
+
cls.line1.write({"qty_picked": 10, "shopfloor_checkout_done": True})
|
21
|
+
cls.line2.write({"qty_picked": 2, "shopfloor_checkout_done": True})
|
22
22
|
|
23
23
|
cls.dest_location = picking.location_dest_id
|
24
24
|
cls.child_location = (
|
@@ -382,7 +382,9 @@ class CheckoutScanLineCase(CheckoutScanLineCaseBase):
|
|
382
382
|
self._fill_stock_for_moves(picking.move_ids, in_package=True)
|
383
383
|
picking.action_assign()
|
384
384
|
# set all lines as done
|
385
|
-
picking.move_line_ids.write(
|
385
|
+
picking.move_line_ids.write(
|
386
|
+
{"qty_picked": 10.0, "shopfloor_checkout_done": True}
|
387
|
+
)
|
386
388
|
response = self.service.dispatch(
|
387
389
|
"scan_line",
|
388
390
|
params={
|
@@ -21,7 +21,7 @@ class CheckoutScanPackageActionCase(CheckoutCommonCase, CheckoutSelectPackageMix
|
|
21
21
|
|
22
22
|
# we have selected the pack that contains product a
|
23
23
|
line_a = picking.move_line_ids[0]
|
24
|
-
line_a.
|
24
|
+
line_a.qty_picked = origin_qty_func(line_a)
|
25
25
|
|
26
26
|
response = self.service.dispatch(
|
27
27
|
"scan_package_action",
|
@@ -33,7 +33,7 @@ class CheckoutScanPackageActionCase(CheckoutCommonCase, CheckoutSelectPackageMix
|
|
33
33
|
)
|
34
34
|
|
35
35
|
# since we scanned the barcode of the product and we had a
|
36
|
-
#
|
36
|
+
# picked qty, the picked qty should flip to 0
|
37
37
|
self._assert_selected_qties(
|
38
38
|
response, line_a, {line_a: expected_qty_func(line_a)}
|
39
39
|
)
|
@@ -86,7 +86,7 @@ class CheckoutScanPackageActionCase(CheckoutCommonCase, CheckoutSelectPackageMix
|
|
86
86
|
self._fill_stock_for_moves(picking.move_ids, in_package=True)
|
87
87
|
picking.action_assign()
|
88
88
|
move_line = picking.move_line_ids
|
89
|
-
|
89
|
+
origin_qty_picked = move_line.qty_picked
|
90
90
|
response = self.service.dispatch(
|
91
91
|
"scan_package_action",
|
92
92
|
params={
|
@@ -99,7 +99,7 @@ class CheckoutScanPackageActionCase(CheckoutCommonCase, CheckoutSelectPackageMix
|
|
99
99
|
response,
|
100
100
|
move_line,
|
101
101
|
# no change as the scan was not valid
|
102
|
-
{move_line:
|
102
|
+
{move_line: origin_qty_picked},
|
103
103
|
message={
|
104
104
|
"message_type": "warning",
|
105
105
|
"body": "Product tracked by lot, please scan one.",
|
@@ -135,9 +135,9 @@ class CheckoutScanPackageActionCase(CheckoutCommonCase, CheckoutSelectPackageMix
|
|
135
135
|
|
136
136
|
move_line1, move_line2, move_line3 = selected_lines
|
137
137
|
# We'll put only product A and B in the package
|
138
|
-
move_line1.
|
139
|
-
move_line2.
|
140
|
-
move_line3.
|
138
|
+
move_line1.qty_picked = move_line1.quantity
|
139
|
+
move_line2.qty_picked = move_line2.quantity
|
140
|
+
move_line3.qty_picked = 0
|
141
141
|
|
142
142
|
response = self.service.dispatch(
|
143
143
|
"scan_package_action",
|
@@ -161,7 +161,7 @@ class CheckoutScanPackageActionCase(CheckoutCommonCase, CheckoutSelectPackageMix
|
|
161
161
|
)
|
162
162
|
self.assertRecordValues(
|
163
163
|
move_line3,
|
164
|
-
#
|
164
|
+
# picked qty was zero so it hasn't been done anyway
|
165
165
|
[{"result_package_id": pack1.id, "shopfloor_checkout_done": False}],
|
166
166
|
)
|
167
167
|
self.assert_response(
|
@@ -243,7 +243,7 @@ class CheckoutScanPackageActionCase(CheckoutCommonCase, CheckoutSelectPackageMix
|
|
243
243
|
|
244
244
|
selected_lines = pack1_moves.move_line_ids
|
245
245
|
# they are all selected
|
246
|
-
selected_lines.write({"
|
246
|
+
selected_lines.write({"qty_picked": 10.0})
|
247
247
|
|
248
248
|
response = self.service.dispatch(
|
249
249
|
"scan_package_action",
|
@@ -296,9 +296,9 @@ class CheckoutScanPackageActionCase(CheckoutCommonCase, CheckoutSelectPackageMix
|
|
296
296
|
|
297
297
|
move_line1, move_line2, move_line3 = selected_lines
|
298
298
|
# we'll put only the first 2 lines (product A and B) in the new package
|
299
|
-
move_line1.
|
300
|
-
move_line2.
|
301
|
-
move_line3.
|
299
|
+
move_line1.qty_picked = move_line1.quantity
|
300
|
+
move_line2.qty_picked = move_line2.quantity
|
301
|
+
move_line3.qty_picked = 0
|
302
302
|
|
303
303
|
packaging = (
|
304
304
|
self.env["stock.package.type"]
|
@@ -349,7 +349,7 @@ class CheckoutScanPackageActionCase(CheckoutCommonCase, CheckoutSelectPackageMix
|
|
349
349
|
)
|
350
350
|
self.assertRecordValues(
|
351
351
|
move_line3,
|
352
|
-
#
|
352
|
+
# picked qty was zero so we don't set it as packed and it remains in
|
353
353
|
# the same package
|
354
354
|
[{"result_package_id": pack1.id, "shopfloor_checkout_done": False}],
|
355
355
|
)
|
@@ -368,7 +368,7 @@ class CheckoutScanPackageActionCase(CheckoutCommonCase, CheckoutSelectPackageMix
|
|
368
368
|
self._fill_stock_for_moves(pack1_moves, in_package=True)
|
369
369
|
picking.action_assign()
|
370
370
|
selected_lines = pack1_moves.move_line_ids
|
371
|
-
selected_lines.
|
371
|
+
selected_lines.qty_picked = selected_lines.quantity
|
372
372
|
|
373
373
|
packaging = (
|
374
374
|
self.env["stock.package.type"]
|
@@ -21,7 +21,7 @@ class CheckoutScanPackageActionCaseNoPrefillQty(
|
|
21
21
|
self._fill_stock_for_moves(picking.move_ids, in_package=False)
|
22
22
|
picking.action_assign()
|
23
23
|
move_line = picking.move_line_ids
|
24
|
-
|
24
|
+
origin_qty_picked = move_line.qty_picked = 2
|
25
25
|
response = self.service.dispatch(
|
26
26
|
"scan_package_action",
|
27
27
|
params={
|
@@ -33,7 +33,7 @@ class CheckoutScanPackageActionCaseNoPrefillQty(
|
|
33
33
|
self._assert_selected_qties(
|
34
34
|
response,
|
35
35
|
move_line,
|
36
|
-
{move_line:
|
36
|
+
{move_line: origin_qty_picked + 1},
|
37
37
|
)
|
38
38
|
|
39
39
|
def test_scan_package_action_scan_product2_to_increment_qty(self):
|
@@ -68,7 +68,7 @@ class CheckoutScanPackageActionCaseNoPrefillQty(
|
|
68
68
|
|
69
69
|
# First line is fully processed,
|
70
70
|
# so we expect the second line to be incremented.
|
71
|
-
move_lines[0].
|
71
|
+
move_lines[0].qty_picked = 3.0
|
72
72
|
self.service.dispatch(
|
73
73
|
"scan_package_action",
|
74
74
|
params={
|
@@ -77,8 +77,8 @@ class CheckoutScanPackageActionCaseNoPrefillQty(
|
|
77
77
|
"barcode": self.product_a.barcode,
|
78
78
|
},
|
79
79
|
)
|
80
|
-
self.assertEqual(move_lines[0].
|
81
|
-
self.assertEqual(move_lines[1].
|
80
|
+
self.assertEqual(move_lines[0].qty_picked, 3.0)
|
81
|
+
self.assertEqual(move_lines[1].qty_picked, 1.0)
|
82
82
|
|
83
83
|
def test_scan_package_action_scan_lot_to_increment_qty(self):
|
84
84
|
""" """
|
@@ -86,7 +86,7 @@ class CheckoutScanPackageActionCaseNoPrefillQty(
|
|
86
86
|
self._fill_stock_for_moves(picking.move_ids, in_lot=True)
|
87
87
|
picking.action_assign()
|
88
88
|
move_line = picking.move_line_ids
|
89
|
-
|
89
|
+
origin_qty_picked = move_line.qty_picked = 2
|
90
90
|
response = self.service.dispatch(
|
91
91
|
"scan_package_action",
|
92
92
|
params={
|
@@ -98,7 +98,7 @@ class CheckoutScanPackageActionCaseNoPrefillQty(
|
|
98
98
|
self._assert_selected_qties(
|
99
99
|
response,
|
100
100
|
move_line,
|
101
|
-
{move_line:
|
101
|
+
{move_line: origin_qty_picked + 1},
|
102
102
|
)
|
103
103
|
|
104
104
|
def test_scan_package_action_scan_packaging_to_increment_qty(self):
|
@@ -107,7 +107,7 @@ class CheckoutScanPackageActionCaseNoPrefillQty(
|
|
107
107
|
self._fill_stock_for_moves(picking.move_ids, in_package=True, in_lot=False)
|
108
108
|
picking.action_assign()
|
109
109
|
move_line = picking.move_line_ids
|
110
|
-
|
110
|
+
origin_qty_picked = move_line.qty_picked = 0
|
111
111
|
response = self.service.dispatch(
|
112
112
|
"scan_package_action",
|
113
113
|
params={
|
@@ -119,5 +119,5 @@ class CheckoutScanPackageActionCaseNoPrefillQty(
|
|
119
119
|
self._assert_selected_qties(
|
120
120
|
response,
|
121
121
|
move_line,
|
122
|
-
{move_line:
|
122
|
+
{move_line: origin_qty_picked + self.product_a_packaging.qty},
|
123
123
|
)
|