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