Skip to content

Commit 82f5f89

Browse files
committed
[MIG] stock_barcodes_picking_batch: Migration to 18.0
1 parent b6002fa commit 82f5f89

File tree

6 files changed

+24
-40
lines changed

6 files changed

+24
-40
lines changed

stock_barcodes_picking_batch/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{
44
"name": "Stock Barcodes Picking Batch",
55
"summary": "It provides read barcodes on stock operations from batch pickings.",
6-
"version": "16.0.2.0.0",
6+
"version": "18.0.1.0.0",
77
"author": "Tecnativa, Odoo Community Association (OCA)",
88
"website": "https://github.com/OCA/stock-logistics-barcode",
99
"license": "AGPL-3",

stock_barcodes_picking_batch/static/src/js/barcodes_models_mixin.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ odoo.define("stock_barcodes_picking_batch.BarcodesModelsMixin", function (requir
66

77
const BarcodesModelsMixin = require("stock_barcodes.BarcodesModelsMixin");
88

9-
var _barcode_models_picking_batch = [
10-
"stock.picking.batch",
11-
"wiz.candidate.picking.batch",
12-
];
9+
var _barcode_models_picking_batch = ["stock.picking.batch"];
1310
BarcodesModelsMixin._barcode_models.push.apply(
1411
BarcodesModelsMixin._barcode_models,
1512
_barcode_models_picking_batch

stock_barcodes_picking_batch/static/src/js/barcodes_models_utils.esm.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
import {barcodeModels} from "@stock_barcodes/utils/barcodes_models_utils.esm";
66

7-
barcodeModels.push("stock.picking.batch", "wiz.candidate.picking.batch");
7+
barcodeModels.push("stock.picking.batch");

stock_barcodes_picking_batch/tests/test_stock_barcodes_picking_batch.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def test_wiz_scan_picking_batch_values(self):
101101
)
102102
self.assertEqual(self.wiz_scan_picking_batch.res_id, self.picking_batch.id)
103103
self.assertIn(
104-
"Barcode reader - %s - " % (self.picking_batch.name),
104+
f"Barcode reader - {self.picking_batch.name} - ",
105105
self.wiz_scan_picking_batch.display_name,
106106
)
107107

@@ -115,7 +115,7 @@ def test_picking_batch_wizard_scan_product(self):
115115
sml = self.picking_batch.move_line_ids.filtered(
116116
lambda x: x.product_id == self.product_wo_tracking
117117
)
118-
self.assertEqual(sum(sml.mapped("qty_done")), 1.0)
118+
self.assertEqual(sum(sml.mapped("qty_picked")), 1.0)
119119

120120
def test_picking_batch_wizard_scan_more_product_than_needed(self):
121121
self._create_quant_for_product(self.stock_location, self.product_wo_tracking)
@@ -140,7 +140,7 @@ def test_picking_batch_wizard_scan_more_product_than_needed(self):
140140
sml = self.picking_batch.move_line_ids.filtered(
141141
lambda x: x.product_id == self.product_wo_tracking
142142
)
143-
self.assertEqual(sum(sml.mapped("qty_done")), 6.0)
143+
self.assertEqual(sum(sml.mapped("qty_picked")), 6.0)
144144

145145
# Check that all qty's have included in pickings
146146
self.action_barcode_scanned(wiz_scan_picking_batch, "8480000723208")
@@ -151,4 +151,4 @@ def test_picking_batch_wizard_scan_more_product_than_needed(self):
151151
sml = self.picking_batch.move_line_ids.filtered(
152152
lambda x: x.product_id == self.product_wo_tracking
153153
)
154-
self.assertEqual(sum(sml.mapped("qty_done")), 15.0)
154+
self.assertEqual(sum(sml.mapped("qty_picked")), 15.0)

stock_barcodes_picking_batch/wizard/stock_barcodes_read_picking_batch.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,20 +148,18 @@ def create_new_stock_move_line(self, moves_todo, available_qty):
148148
)
149149
else:
150150
moves = to_do.stock_move_ids.filtered(
151-
lambda ln: ln.ln.quantity_done < ln.product_uom_qty
151+
lambda ln: ln.quantity < ln.product_uom_qty
152152
)
153153
# TODO: split between all lines
154154
sml = self.env["stock.move.line"].browse()
155155
for move in moves:
156156
if move._name == "stock.move.line":
157-
move_qty_done = "qty_done"
158157
move_demand = move.move_id.product_uom_qty
159158
else:
160-
move_qty_done = "quantity_done"
161159
move_demand = move.product_uom_qty
162160
if move_demand:
163161
assigned_qty = min(
164-
max(move_demand - move[move_qty_done], 0.0), available_qty
162+
max(move_demand - move.qty_picked, 0.0), available_qty
165163
)
166164
else:
167165
assigned_qty = available_qty

stock_barcodes_picking_batch/wizard/stock_barcodes_read_picking_batch_views.xml

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
name="todo_line_display_ids"
2323
mode="kanban"
2424
force_save="1"
25-
attrs="{'invisible': [('todo_line_display_ids', '=', [])]}"
25+
invisible="not todo_line_display_ids"
2626
/>
2727
</xpath>
2828
<field name="location_id" position="before">
@@ -33,15 +33,12 @@
3333
</field>
3434
<group name="scan_fields" position="attributes">
3535
<!-- hide group scan_fields for extra todo lines -->
36-
<attribute
37-
name="attrs"
38-
>{'invisible': [('todo_line_is_extra_line', '!=', False)]}
39-
</attribute>
36+
<attribute name="invisible">todo_line_is_extra_line </attribute>
4037
</group>
4138
<group name="scan_fields" position="after">
4239
<field name="picking_batch_state" invisible="1" />
4340
<div
44-
attrs="{'invisible': [('picking_batch_state', '!=', 'done')]}"
41+
invisible="picking_batch_state != 'done'"
4542
class="oe_kanban_picking_done bg-dark d-flex flex-column justify-content-center align-items-center text-white"
4643
>
4744
<span class="fa fa-6x mb-4 fa-exclamation-triangle" />
@@ -51,7 +48,7 @@
5148
</div>
5249
<group
5350
string="Pending moves"
54-
attrs="{'invisible': ['|', ('picking_batch_state', '=', 'done'), ('pending_move_ids', '=', [])]}"
51+
invisible="picking_batch_state = 'done' or not pending_move_ids"
5552
>
5653
<field
5754
name="pending_move_ids"
@@ -80,18 +77,10 @@
8077
<div
8178
class="d-flex justify-content-start align-items-center indent h4 pt-3"
8279
>
83-
<span
84-
t-esc="record.qty_done.raw_value"
85-
/>
86-
&#32;/&#32;
87-
<span
88-
t-esc="record.product_uom_qty.raw_value"
89-
/>
90-
91-
<span
92-
t-if="record.uom_id"
93-
t-esc="record.uom_id.value"
94-
/>
80+
<field name="qty_done" />
81+
&#32;/&#32;
82+
<field name="product_uom_qty" />
83+
<field name="uom_id" />
9584
</div>
9685
</div>
9786
<div
@@ -130,11 +119,11 @@
130119
</group>
131120
<group
132121
string="Detailed operations"
133-
attrs="{'invisible': ['|', ('move_line_ids', '=', []), ('show_detailed_operations', '=', False)]}"
122+
invisible="not move_line_ids or not show_detailed_operations"
134123
>
135124
<h3
136125
class="mt-4 w-100 px-4"
137-
attrs="{'invisible': ['|', ('move_line_ids', '=', []), ('show_detailed_operations', '=', False)]}"
126+
invisible="not show_detailed_operations or not move_line_ids"
138127
>
139128
Detailed operations
140129
</h3>
@@ -148,7 +137,7 @@
148137
>
149138
<kanban class="o_kanban_mobile">
150139
<field name="product_id" />
151-
<field name="qty_done" />
140+
<field name="qty_picked" />
152141
<field name="product_uom_id" />
153142
<field name="lot_id" />
154143
<field name="result_package_id" />
@@ -178,7 +167,7 @@
178167
<div
179168
class="col-4 col-md-4 d-flex justify-content-end align-items-center"
180169
>
181-
<field class="h3" name="qty_done" />
170+
<field class="h3" name="qty_picked" />
182171

183172
<button
184173
name="action_barcode_detailed_operation_unlink"
@@ -209,7 +198,7 @@
209198
icon="fa-check fa-2x"
210199
class="btn btn-secondary w-100 oe_kanban_action_button btn-sm text-uppercase
211200
d-flex justify-content-center align-items-center fs-2"
212-
attrs="{'invisible': ['|',('picking_batch_state', '!=', 'in_progress'), ('picking_batch_show_validate', '=', False)]}"
201+
invisible="picking_batch_state != 'in_progress' or not picking_batch_show_validate"
213202
confirm="Are you sure to validate the picking ?"
214203
data-hotkey="'shift+v'"
215204
>
@@ -230,14 +219,14 @@
230219
type="object"
231220
title="Detailed operations"
232221
icon="fa-eye fa-2x"
233-
attrs="{'invisible': ['|', ('move_line_ids', '=', []), ('show_detailed_operations', '=', True)]}"
222+
invisible="show_detailed_operations or not move_line_ids"
234223
/>
235224
<button
236225
name="action_show_detailed_operations"
237226
type="object"
238227
title="Detailed operations"
239228
icon="fa-eye-slash fa-2x"
240-
attrs="{'invisible': ['|', ('move_line_ids', '=', []), ('show_detailed_operations', '=', False)]}"
229+
invisible="not show_detailed_operations or not move_line_ids"
241230
/>
242231
</xpath>
243232
</field>

0 commit comments

Comments
 (0)