[MIG] stock_warehouse_calendar: Migration to 12.0

This commit is contained in:
mreficent
2019-03-20 17:10:44 +01:00
committed by Lois Rilo
parent 0c37af8cd3
commit a94bc219dc
10 changed files with 34 additions and 30 deletions

View File

@@ -10,17 +10,17 @@ Stock Warehouse Calendar
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-warehouse/tree/11.0/stock_warehouse_calendar
:target: https://github.com/OCA/stock-logistics-warehouse/tree/12.0/stock_warehouse_calendar
:alt: OCA/stock-logistics-warehouse
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-11-0/stock-logistics-warehouse-11-0-stock_warehouse_calendar
:target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-stock_warehouse_calendar
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/153/11.0
:target: https://runbot.odoo-community.org/runbot/153/12.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -53,7 +53,7 @@ Configuration
'Multi-Step Routes option'.
* Go to *Inventory > Configuration > Warehouse Management > Routes* and
set up the proper delays in the procurement rules where 'action'
set up the proper delays in the stock rules where 'action'
is 'Move From Another Location'.
Usage
@@ -72,7 +72,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-warehouse/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_warehouse_calendar%0Aversion:%2011.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_warehouse_calendar%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
@@ -110,6 +110,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|maintainer-jbeficent|
This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/11.0/stock_warehouse_calendar>`_ project on GitHub.
This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/12.0/stock_warehouse_calendar>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -1 +1,2 @@
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from . import models

View File

@@ -4,15 +4,15 @@
{
"name": "Stock Warehouse Calendar",
"summary": "Adds a calendar to the Warehouse",
"version": "11.0.1.0.0",
"license": "AGPL-3",
"version": "12.0.1.0.0",
"license": "LGPL-3",
"website": "https://github.com/stock-logistics-warehouse",
"author": "Eficent, "
"Odoo Community Association (OCA)",
"category": "Warehouse Management",
"depends": [
"stock",
"resource"
"resource",
],
"data": [
"views/stock_warehouse_views.xml",

View File

@@ -1,2 +1,3 @@
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from . import stock_warehouse
from . import procurement_rule
from . import stock_rule

View File

@@ -5,15 +5,15 @@ from odoo import fields, models
from datetime import datetime
class ProcurementRule(models.Model):
_inherit = 'procurement.rule'
class StockRule(models.Model):
_inherit = 'stock.rule'
def _get_stock_move_values(self, product_id, product_qty, product_uom,
location_id, name, origin, values, group_id):
res = super(ProcurementRule, self)._get_stock_move_values(
res = super(StockRule, self)._get_stock_move_values(
product_id, product_qty, product_uom,
location_id, name, origin, values, group_id)
dt_planned = fields.Datetime.from_string(values['date_planned'])
dt_planned = fields.Datetime.to_datetime(values['date_planned'])
warehouse = self.propagate_warehouse_id or self.warehouse_id
if warehouse.calendar_id and self.delay:
date_expected = warehouse.calendar_id.plan_days(

View File

@@ -7,5 +7,7 @@ from odoo import fields, models
class StockWarehouse(models.Model):
_inherit = 'stock.warehouse'
calendar_id = fields.Many2one('resource.calendar',
'Working Hours')
calendar_id = fields.Many2one(
comodel_name='resource.calendar',
string='Working Hours',
)

View File

@@ -10,5 +10,5 @@
'Multi-Step Routes option'.
* Go to *Inventory > Configuration > Warehouse Management > Routes* and
set up the proper delays in the procurement rules where 'action'
set up the proper delays in the stock rules where 'action'
is 'Move From Another Location'.

View File

@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/11.0/stock_warehouse_calendar"><img alt="OCA/stock-logistics-warehouse" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-warehouse-11-0/stock-logistics-warehouse-11-0-stock_warehouse_calendar"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/153/11.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/12.0/stock_warehouse_calendar"><img alt="OCA/stock-logistics-warehouse" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-stock_warehouse_calendar"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/153/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module adds a Calendar to the Warehouse. This calendar can then used as
the basis of the proper computation of start/end dates based on lead times in
this and other modules.</p>
@@ -417,7 +417,7 @@ if the warehouse operates under a Mo-Fri working calendar.</p>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_warehouse_calendar%0Aversion:%2011.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_warehouse_calendar%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
@@ -443,7 +443,7 @@ mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external" href="https://github.com/jbeficent"><img alt="jbeficent" src="https://github.com/jbeficent.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/11.0/stock_warehouse_calendar">OCA/stock-logistics-warehouse</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/12.0/stock_warehouse_calendar">OCA/stock-logistics-warehouse</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>

View File

@@ -1,2 +1,2 @@
# -*- coding: utf-8 -*-
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from . import test_stock_warehouse_calendar

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
# Copyright 2018 Eficent Business and IT Consulting Services, S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import fields
from odoo.tests.common import TransactionCase
@@ -36,7 +36,7 @@ class TestStockWarehouseCalendar(TransactionCase):
rule_vals = {
'location_id': self.warehouse.lot_stock_id.id,
'location_src_id': self.warehouse_2.lot_stock_id.id,
'action': 'move',
'action': 'pull_push',
'warehouse_id': self.warehouse.id,
'propagate_warehouse_id': self.warehouse_2.id,
'picking_type_id': self.env.ref('stock.picking_type_internal').id,
@@ -44,7 +44,7 @@ class TestStockWarehouseCalendar(TransactionCase):
'route_id': self.transfer_route.id,
'delay': 1,
}
self.transfer_rule = self.env['procurement.rule'].create(rule_vals)
self.transfer_rule = self.env['stock.rule'].create(rule_vals)
self.product.route_ids = [(6, 0, self.transfer_route.ids)]
def test_procurement_with_calendar(self):
@@ -61,8 +61,8 @@ class TestStockWarehouseCalendar(TransactionCase):
'Test', values)
move = self.env['stock.move'].search(
[('product_id', '=', self.product.id)], limit=1)
date_expected = fields.Datetime.from_string(move.date_expected).date()
date_expected = fields.Date.to_date(move.date_expected)
# Friday 4th Jan 2017
friday = fields.Datetime.from_string('2097-01-04 09:00:00').date()
friday = fields.Date.to_date('2097-01-04 09:00:00')
self.assertEquals(date_expected, friday)