mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[MIG] stock_reserve: Migration to 14.0
This commit is contained in:
committed by
Víctor Martínez
parent
e3a94c607a
commit
f5d40565a8
@@ -1,3 +1,3 @@
|
|||||||
# Copyright 2013 Camptocamp SA - Guewen Baconnier
|
# Copyright 2013 Camptocamp SA - Guewen Baconnier
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||||
from . import model
|
from . import models
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
{
|
{
|
||||||
"name": "Stock Reservation",
|
"name": "Stock Reservation",
|
||||||
"summary": "Stock reservations on products",
|
"summary": "Stock reservations on products",
|
||||||
"version": "13.0.1.0.0",
|
"version": "14.0.1.0.0",
|
||||||
"author": "Camptocamp, Odoo Community Association (OCA)",
|
"author": "Camptocamp, Odoo Community Association (OCA)",
|
||||||
"category": "Warehouse",
|
"category": "Warehouse",
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ class StockReservation(models.Model):
|
|||||||
The reservation is done using the default UOM of the product.
|
The reservation is done using the default UOM of the product.
|
||||||
A date until which the product is reserved can be specified.
|
A date until which the product is reserved can be specified.
|
||||||
"""
|
"""
|
||||||
self.write({"date_expected": fields.Datetime.now()})
|
self.write({"date_deadline": fields.Datetime.now()})
|
||||||
self.mapped("move_id")._action_confirm(merge=False)
|
self.mapped("move_id")._action_confirm(merge=False)
|
||||||
self.mapped("move_id.picking_id").action_assign()
|
self.mapped("move_id.picking_id").action_assign()
|
||||||
return True
|
return True
|
||||||
@@ -30,16 +30,16 @@ class TestStockReserve(common.TransactionCase):
|
|||||||
form_reservation_1.location_id = self.warehouse.lot_stock_id
|
form_reservation_1.location_id = self.warehouse.lot_stock_id
|
||||||
reservation_1 = form_reservation_1.save()
|
reservation_1 = form_reservation_1.save()
|
||||||
reservation_1.reserve()
|
reservation_1.reserve()
|
||||||
self.assertEquals(self.product.virtual_available, 4)
|
self.assertEqual(self.product.virtual_available, 4)
|
||||||
form_reservation_2 = Form(self.env["stock.reservation"])
|
form_reservation_2 = Form(self.env["stock.reservation"])
|
||||||
form_reservation_2.product_id = self.product
|
form_reservation_2.product_id = self.product
|
||||||
form_reservation_2.product_uom_qty = 1
|
form_reservation_2.product_uom_qty = 1
|
||||||
form_reservation_2.location_id = self.warehouse.lot_stock_id
|
form_reservation_2.location_id = self.warehouse.lot_stock_id
|
||||||
reservation_2 = form_reservation_2.save()
|
reservation_2 = form_reservation_2.save()
|
||||||
reservation_2.reserve()
|
reservation_2.reserve()
|
||||||
self.assertEquals(self.product.virtual_available, 3)
|
self.assertEqual(self.product.virtual_available, 3)
|
||||||
reservation_1.release_reserve()
|
reservation_1.release_reserve()
|
||||||
self.assertEquals(self.product.virtual_available, 9)
|
self.assertEqual(self.product.virtual_available, 9)
|
||||||
|
|
||||||
def test_cron_release(self):
|
def test_cron_release(self):
|
||||||
form_reservation_1 = Form(self.env["stock.reservation"])
|
form_reservation_1 = Form(self.env["stock.reservation"])
|
||||||
@@ -49,10 +49,10 @@ class TestStockReserve(common.TransactionCase):
|
|||||||
form_reservation_1.date_validity = fields.Date.from_string("2021-01-01")
|
form_reservation_1.date_validity = fields.Date.from_string("2021-01-01")
|
||||||
reservation_1 = form_reservation_1.save()
|
reservation_1 = form_reservation_1.save()
|
||||||
reservation_1.reserve()
|
reservation_1.reserve()
|
||||||
self.assertEquals(self.product.virtual_available, 4)
|
self.assertEqual(self.product.virtual_available, 4)
|
||||||
cron = self.env.ref("stock_reserve.ir_cron_release_stock_reservation")
|
cron = self.env.ref("stock_reserve.ir_cron_release_stock_reservation")
|
||||||
cron.method_direct_trigger()
|
cron.method_direct_trigger()
|
||||||
self.assertEquals(self.product.virtual_available, 10)
|
self.assertEqual(self.product.virtual_available, 10)
|
||||||
|
|
||||||
def test_cron_reserve(self):
|
def test_cron_reserve(self):
|
||||||
form_reservation_1 = Form(self.env["stock.reservation"])
|
form_reservation_1 = Form(self.env["stock.reservation"])
|
||||||
@@ -61,7 +61,7 @@ class TestStockReserve(common.TransactionCase):
|
|||||||
form_reservation_1.location_id = self.warehouse.lot_stock_id
|
form_reservation_1.location_id = self.warehouse.lot_stock_id
|
||||||
reservation_1 = form_reservation_1.save()
|
reservation_1 = form_reservation_1.save()
|
||||||
reservation_1.reserve()
|
reservation_1.reserve()
|
||||||
self.assertEquals(reservation_1.state, "partially_available")
|
self.assertEqual(reservation_1.state, "partially_available")
|
||||||
self.env["stock.quant"].create(
|
self.env["stock.quant"].create(
|
||||||
{
|
{
|
||||||
"product_id": self.product.id,
|
"product_id": self.product.id,
|
||||||
@@ -71,5 +71,5 @@ class TestStockReserve(common.TransactionCase):
|
|||||||
)
|
)
|
||||||
cron = self.env.ref("stock_reserve.ir_cron_reserve_waiting_confirmed")
|
cron = self.env.ref("stock_reserve.ir_cron_reserve_waiting_confirmed")
|
||||||
cron.method_direct_trigger()
|
cron.method_direct_trigger()
|
||||||
self.assertEquals(reservation_1.state, "assigned")
|
self.assertEqual(reservation_1.state, "assigned")
|
||||||
self.assertEquals(self.product.virtual_available, 9)
|
self.assertEqual(self.product.virtual_available, 9)
|
||||||
|
|||||||
Reference in New Issue
Block a user