mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[MIG] stock_warehouse_calendar: Migration to 14.0
This commit is contained in:
committed by
RicardCForgeFlow
parent
24041691bf
commit
c1035af3ba
@@ -4,7 +4,7 @@
|
||||
{
|
||||
"name": "Stock Warehouse Calendar",
|
||||
"summary": "Adds a calendar to the Warehouse",
|
||||
"version": "13.0.1.0.1",
|
||||
"version": "14.0.1.0.1",
|
||||
"license": "LGPL-3",
|
||||
"website": "https://github.com/OCA/stock-logistics-warehouse",
|
||||
"author": "ForgeFlow, " "Odoo Community Association (OCA)",
|
||||
|
||||
@@ -32,10 +32,7 @@ class StockRule(models.Model):
|
||||
)
|
||||
warehouse = self.propagate_warehouse_id or self.warehouse_id
|
||||
if warehouse.calendar_id and self.delay:
|
||||
date_expected = warehouse.wh_plan_days(
|
||||
values["date_planned"], -1 * self.delay
|
||||
)
|
||||
if date_expected > datetime.now():
|
||||
res["date"] = date_expected
|
||||
res["date_expected"] = date_expected
|
||||
date = warehouse.wh_plan_days(values["date_planned"], -1 * self.delay)
|
||||
if date > datetime.now():
|
||||
res["date"] = date
|
||||
return res
|
||||
|
||||
@@ -69,11 +69,11 @@ class TestStockWarehouseCalendar(TransactionCase):
|
||||
move = self.env["stock.move"].search(
|
||||
[("product_id", "=", self.product.id)], limit=1
|
||||
)
|
||||
date_expected = fields.Date.to_date(move.date_expected)
|
||||
date = fields.Date.to_date(move.date)
|
||||
# Friday 4th Jan 2017
|
||||
friday = fields.Date.to_date("2097-01-04 09:00:00")
|
||||
|
||||
self.assertEquals(date_expected, friday)
|
||||
self.assertEqual(date, friday)
|
||||
|
||||
def test_02_procurement_with_calendar_early(self):
|
||||
"""Test procuring at the beginning of the day, with no work intervals
|
||||
@@ -101,11 +101,11 @@ class TestStockWarehouseCalendar(TransactionCase):
|
||||
move = self.env["stock.move"].search(
|
||||
[("product_id", "=", self.product.id)], limit=1
|
||||
)
|
||||
date_expected = fields.Date.to_date(move.date_expected)
|
||||
date = fields.Date.to_date(move.date)
|
||||
# Friday 4th Jan 2017
|
||||
friday = fields.Date.to_date("2097-01-04 09:00:00")
|
||||
|
||||
self.assertEquals(date_expected, friday)
|
||||
self.assertEqual(date, friday)
|
||||
|
||||
def test_03_wh_plan_days_future(self):
|
||||
"""Test plan days helper in warehouse."""
|
||||
@@ -113,8 +113,8 @@ class TestStockWarehouseCalendar(TransactionCase):
|
||||
# With calendar
|
||||
result = self.warehouse_2.wh_plan_days(reference, 3).date()
|
||||
next_monday = fields.Date.to_date("2097-01-14")
|
||||
self.assertEquals(result, next_monday)
|
||||
self.assertEqual(result, next_monday)
|
||||
# Without calendar
|
||||
result = self.warehouse_3.wh_plan_days(reference, 3).date()
|
||||
saturday = fields.Date.to_date("2097-01-12")
|
||||
self.assertEquals(result, saturday)
|
||||
self.assertEqual(result, saturday)
|
||||
|
||||
Reference in New Issue
Block a user