Skip to content

Commit

Permalink
[MIG] stock_picking_completion_info: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
glitchov committed Dec 2, 2022
1 parent 132edd7 commit a5a8bb2
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 151 deletions.
2 changes: 1 addition & 1 deletion stock_picking_completion_info/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "Stock Picking Completion Info",
"summary": "Display on current document completion information according "
"to next operations",
"version": "14.0.1.1.0",
"version": "16.0.1.0.0",
"development_status": "Beta",
"category": "Warehouse Management",
"website": "https://github.com/OCA/wms",
Expand Down
99 changes: 0 additions & 99 deletions stock_picking_completion_info/i18n/es_AR.po

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-12-02 10:17+0000\n"
"PO-Revision-Date: 2022-12-02 10:17+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand All @@ -23,40 +25,19 @@ msgstr ""
msgid "Display Completion Info"
msgstr ""

#. module: stock_picking_completion_info
#: model:ir.model.fields,field_description:stock_picking_completion_info.field_stock_move__display_name
#: model:ir.model.fields,field_description:stock_picking_completion_info.field_stock_picking__display_name
#: model:ir.model.fields,field_description:stock_picking_completion_info.field_stock_picking_type__display_name
msgid "Display Name"
msgstr ""

#. module: stock_picking_completion_info
#: model:ir.model.fields.selection,name:stock_picking_completion_info.selection__stock_picking__completion_info__full_order_picking
msgid ""
"Full order picking: You are processing a full order picking that will allow "
"next operation to be processed"
msgstr ""

#. module: stock_picking_completion_info
#: model:ir.model.fields,field_description:stock_picking_completion_info.field_stock_move__id
#: model:ir.model.fields,field_description:stock_picking_completion_info.field_stock_picking__id
#: model:ir.model.fields,field_description:stock_picking_completion_info.field_stock_picking_type__id
msgid "ID"
msgstr ""

#. module: stock_picking_completion_info
#: model:ir.model.fields,help:stock_picking_completion_info.field_stock_picking_type__display_completion_info
msgid ""
"Inform operator of a completed operation at processing and at completion"
msgstr ""

#. module: stock_picking_completion_info
#: model:ir.model.fields,field_description:stock_picking_completion_info.field_stock_move____last_update
#: model:ir.model.fields,field_description:stock_picking_completion_info.field_stock_picking____last_update
#: model:ir.model.fields,field_description:stock_picking_completion_info.field_stock_picking_type____last_update
msgid "Last Modified on"
msgstr ""

#. module: stock_picking_completion_info
#: model:ir.model.fields.selection,name:stock_picking_completion_info.selection__stock_picking__completion_info__last_picking
msgid ""
Expand Down
10 changes: 5 additions & 5 deletions stock_picking_completion_info/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class StockPicking(models.Model):

@api.depends(
"picking_type_id.display_completion_info",
"move_lines.common_dest_move_ids.state",
"move_ids.common_dest_move_ids.state",
)
def _compute_completion_info(self):
for picking in self:
Expand All @@ -49,7 +49,7 @@ def _compute_completion_info(self):
continue
# Depending moves are all the origin moves linked to the
# destination pickings' moves
depending_moves = picking.move_lines.mapped("common_dest_move_ids")
depending_moves = picking.move_ids.mapped("common_dest_move_ids")
# If all the depending moves are done or canceled then next picking
# is ready to be processed
if picking.state == "done" and all(
Expand All @@ -59,12 +59,12 @@ def _compute_completion_info(self):
continue
# If all the depending moves are the moves on the actual picking
# then it's a full order and next picking is ready to be processed
if depending_moves == picking.move_lines:
if depending_moves == picking.move_ids:
picking.completion_info = "full_order_picking"
continue
# If there aren't any depending move from another picking that is
# not done, then actual picking is the last to process
other_depending_moves = (depending_moves - picking.move_lines).filtered(
other_depending_moves = (depending_moves - picking.move_ids).filtered(
lambda m: m.state not in ("done", "cancel")
)
if not other_depending_moves:
Expand All @@ -82,5 +82,5 @@ def write(self, vals):
if "state" in vals:
# invalidate cache, the api.depends do not allow to find all
# the conditions to invalidate the field
self.env["stock.picking"].invalidate_cache(fnames=["completion_info"])
self.env["stock.picking"].invalidate_model(fnames=["completion_info"])
return True
1 change: 1 addition & 0 deletions stock_picking_completion_info/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
* Akim Juillerat <[email protected]>
* Raphaël Reverdy <[email protected]>
* Hughes Damry <[email protected]>
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Copyright 2019 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
from odoo.tests import Form, SavepointCase
from odoo.tests import Form, TransactionCase


class TestStockPickingCompletionInfo(SavepointCase):
class TestStockPickingCompletionInfo(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
Expand Down Expand Up @@ -32,8 +32,6 @@ def setUpClass(cls):
def _init_inventory(self, same_location=True):
# Product 1 on shelf 1
# Product 2 on shelf 2
inventory = self.env["stock.inventory"].create({"name": "Test init"})
inventory.action_start()
if not same_location:
product_location_list = [
(self.product_1, self.stock_shelf_location),
Expand All @@ -44,22 +42,17 @@ def _init_inventory(self, same_location=True):
(self.product_1, self.stock_shelf_location),
(self.product_2, self.stock_shelf_location),
]
lines_vals = list()
vals_list = list()
for product, location in product_location_list:
lines_vals.append(
(
0,
0,
{
"product_id": product.id,
"product_uom_id": product.uom_id.id,
"product_qty": 10.0,
"location_id": location.id,
},
)
vals_list.append(
{
"product_id": product.id,
"inventory_quantity": 10.0,
"location_id": location.id,
}
)
inventory.write({"line_ids": lines_vals})
inventory.action_validate()
quants = self.env["stock.quant"].create(vals_list)
quants.action_apply_inventory()

def _create_pickings(self, same_pick_location=True):
# Create delivery order
Expand Down Expand Up @@ -158,7 +151,7 @@ def test_picking_all_at_once(self):
self.assertEqual(pick_order.completion_info, "full_order_picking")
res = pick_order.button_validate()
Form(
self.env["stock.immediate.transfer"].with_context(res["context"])
self.env["stock.immediate.transfer"].with_context(**res["context"])
).save().process()
self.assertEqual(pick_move_1.state, "done")
self.assertEqual(pick_move_2.state, "done")
Expand Down Expand Up @@ -208,7 +201,7 @@ def test_picking_from_different_locations(self):
self.assertEqual(pick_order_2.completion_info, "no")
res = pick_order_1.button_validate()
Form(
self.env["stock.immediate.transfer"].with_context(res["context"])
self.env["stock.immediate.transfer"].with_context(**res["context"])
).save().process()
self.assertEqual(pick_move_1.state, "done")
self.assertEqual(pick_order_1.state, "done")
Expand All @@ -218,7 +211,7 @@ def test_picking_from_different_locations(self):
self.assertEqual(pick_order_2.completion_info, "last_picking")
res = pick_order_2.button_validate()
Form(
self.env["stock.immediate.transfer"].with_context(res["context"])
self.env["stock.immediate.transfer"].with_context(**res["context"])
).save().process()
self.assertEqual(pick_move_2.state, "done")
self.assertEqual(pick_order_2.state, "done")
Expand Down Expand Up @@ -261,12 +254,12 @@ def test_picking_with_backorder(self):
self.assertEqual(pick_order.completion_info, "full_order_picking")
# Process partially to create backorder
pick_move_1.move_line_ids.qty_done = 1.0
pick_move_2.move_line_ids.qty_done = pick_move_2.move_line_ids.product_uom_qty
pick_move_2.move_line_ids.qty_done = pick_move_2.move_line_ids.reserved_uom_qty
pick_order._action_done()
pick_backorder = self.env["stock.picking"].search(
[("backorder_id", "=", pick_order.id)]
)
pick_backorder_move = pick_backorder.move_lines
pick_backorder_move = pick_backorder.move_ids
self.assertEqual(pick_move_1.state, "done")
self.assertEqual(pick_move_2.state, "done")
self.assertEqual(pick_order.state, "done")
Expand All @@ -277,7 +270,7 @@ def test_picking_with_backorder(self):
self.assertEqual(pick_backorder.completion_info, "last_picking")
# Process backorder
pick_backorder_move.move_line_ids.qty_done = (
pick_backorder_move.move_line_ids.product_uom_qty
pick_backorder_move.move_line_ids.reserved_uom_qty
)
pick_backorder._action_done()
self.assertEqual(pick_backorder_move.state, "done")
Expand Down
2 changes: 2 additions & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# https://github.com/OCA/stock-logistics-warehouse/pull/1566
odoo-addon-stock-move-common-dest @ git+https://github.com/acsone/[email protected]_move_common_dest-hda#subdirectory=setup/stock_move_common_dest

0 comments on commit a5a8bb2

Please sign in to comment.