Skip to content

Commit

Permalink
[17.0-mig-stock] [MIG] stock_quant_manual_assign: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
siemenv committed Mar 26, 2024
1 parent 33c3e45 commit 431304d
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 19 deletions.
2 changes: 1 addition & 1 deletion stock_quant_manual_assign/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

{
"name": "Stock - Manual Quant Assignment",
"version": "16.0.1.0.1",
"version": "17.0.1.0.0",
"category": "Warehouse",
"license": "AGPL-3",
"author": "AvanzOSC, "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def test_quant_manual_assign(self):
"There are 2 quants selected",
)
self.assertFalse(self.move.picking_type_id.auto_fill_qty_done)
self.assertEqual(sum(self.move.move_line_ids.mapped("qty_done")), 0.0)
self.assertEqual(sum(self.move.move_line_ids.mapped("quantity")), 0.0)

def test_quant_manual_assign_auto_fill_qty_done(self):
wizard = self.quant_assign_wizard.with_context(active_id=self.move.id).create(
Expand All @@ -162,7 +162,7 @@ def test_quant_manual_assign_auto_fill_qty_done(self):
self.picking_type.auto_fill_qty_done = True
wizard.assign_quants()
self.assertTrue(self.move.picking_type_id.auto_fill_qty_done)
self.assertEqual(sum(self.move.move_line_ids.mapped("qty_done")), 150.0)
self.assertEqual(sum(self.move.move_line_ids.mapped("quantity")), 150.0)

def test_quant_assign_wizard_after_availability_check(self):
self.move._action_assign()
Expand Down
4 changes: 2 additions & 2 deletions stock_quant_manual_assign/views/stock_move_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_form" />
<field name="arch" type="xml">
<button name="action_show_details" position="before">
<button name="action_assign_serial" position="before">
<button
name="%(assign_manual_quants_action)d"
type="action"
icon="fa-tags"
title="Manual Quants"
options='{"warn": true}'
attrs="{'invisible':['|',('picking_code','=','incoming'),('state','not in',('confirmed','assigned','partially_available'))]}"
invisible="picking_code == 'incoming' or state not in ['confirmed','assigned','partially_available']"
/>
</button>
</field>
Expand Down
8 changes: 3 additions & 5 deletions stock_quant_manual_assign/views/stock_picking_type_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
<field name="model">stock.picking.type</field>
<field name="inherit_id" ref="stock.view_picking_type_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='show_reserved']" position="after">
<field
name="auto_fill_qty_done"
attrs="{'invisible':[('code','=','incoming')]}"
/>
<xpath expr="//field[@name='create_backorder']" position="after">
<field name="code" invisible="1" />
<field name="auto_fill_qty_done" invisible="code == 'incoming'" />
</xpath>
</field>
</record>
Expand Down
8 changes: 4 additions & 4 deletions stock_quant_manual_assign/wizard/assign_manual_quants.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def assign_quants(self):
if move.picking_type_id.auto_fill_qty_done:
# Auto-fill all lines as done
for ml in move.move_line_ids:
ml.qty_done = ml.reserved_uom_qty
ml.qty_done = ml.quantity_product_uom
move._recompute_state()
move.mapped("picking_id")._compute_state()
return {}
Expand Down Expand Up @@ -115,7 +115,7 @@ def _prepare_wizard_line(self, move, quant):
and ml.package_id == quant.package_id
)
)
line["qty"] = sum(move_lines.mapped("reserved_uom_qty"))
line["qty"] = sum(move_lines.mapped("quantity_product_uom"))
line["selected"] = bool(line["qty"])
line["reserved"] = quant.reserved_quantity - line["qty"]
return line
Expand Down Expand Up @@ -200,11 +200,11 @@ def _check_qty(self):
quant = record.quant_id
move_lines = record.assign_wizard.move_id.move_line_ids.filtered(
lambda ml: (
ml.location_id == quant.location_id and ml.lot_id == quant.lot_id
ml.location_id == quant.location_id and ml.lot_id == quant.lot_id # noqa: B023
)
)
reserved = quant.reserved_quantity - sum(
move_lines.mapped("reserved_uom_qty")
move_lines.mapped("quantity_product_uom")
)
if (
float_compare(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@
<field name="on_hand" force_save="1" />
<field name="reserved" force_save="1" />
<field name="selected" widget="boolean_toggle" />
<field
name="qty"
attrs="{'readonly':[('selected', '=', False)]}"
sum="qty"
/>
<field name="qty" readonly="selected == False" sum="qty" />
</tree>
</field>
<group col='4' colspan="4">
Expand Down

0 comments on commit 431304d

Please sign in to comment.