[MIG] stock_picking_completion_info: Migration to 13.0

This commit is contained in:
Guewen Baconnier
2019-12-19 15:04:01 +01:00
parent 071d70ef31
commit 0289d74b88
5 changed files with 23 additions and 5 deletions

View File

@@ -0,0 +1 @@
../../../../stock_picking_completion_info

View File

@@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

View File

@@ -4,7 +4,7 @@
"name": "Stock Picking Completion Info",
"summary": "Display on current document completion information according "
"to next operations",
"version": "12.0.1.0.0",
"version": "13.0.1.0.0",
"development_status": "Alpha",
"category": "Warehouse Management",
"website": "https://github.com/OCA/stock-logistics-warehouse",

View File

@@ -71,3 +71,16 @@ class StockPicking(models.Model):
picking.completion_info = "last_picking"
continue
picking.completion_info = "no"
class StockMove(models.Model):
_inherit = "stock.move"
def write(self, vals):
super().write(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"])
return True

View File

@@ -10,7 +10,7 @@ class TestStockPickingCompletionInfo(SavepointCase):
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))
cls.partner_delta = cls.env.ref("base.res_partner_4")
cls.warehouse = cls.env.ref("stock.warehouse0")
cls.warehouse.write({"outgoing_shipments": "pick_pack_ship"})
cls.warehouse.write({"delivery_steps": "pick_pack_ship"})
cls.customers_location = cls.env.ref("stock.stock_location_customers")
cls.output_location = cls.env.ref("stock.stock_location_output")
cls.packing_location = cls.env.ref("stock.location_pack_zone")
@@ -32,9 +32,7 @@ class TestStockPickingCompletionInfo(SavepointCase):
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", "filter": "partial"}
)
inventory = self.env["stock.inventory"].create({"name": "Test init"})
inventory.action_start()
if not same_location:
product_location_list = [