[MIG] stock_reserve_rule: Migration to 14.0

This commit is contained in:
Sébastien Alix
2021-08-11 12:25:23 +02:00
parent 46c12c8080
commit 02ea087509
4 changed files with 2 additions and 20 deletions

View File

@@ -3,7 +3,7 @@
{
"name": "Stock Reservation Rules",
"summary": "Configure reservation rules by location",
"version": "13.0.1.4.0",
"version": "14.0.1.0.0",
"author": "Camptocamp, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-warehouse",
"category": "Stock Management",

View File

@@ -1,18 +0,0 @@
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html)
import logging
_logger = logging.getLogger(__name__)
def migrate(cr, version):
cr.execute(
"""
INSERT INTO stock_picking_type_stock_reserve_rule_rel
(stock_reserve_rule_id, stock_picking_type_id)
SELECT id, picking_type_id
FROM stock_reserve_rule
WHERE picking_type_id IS NOT NULL
ON CONFLICT DO NOTHING;
"""
)

View File

@@ -9,5 +9,4 @@ class StockPickingType(models.Model):
reserve_rule_ids = fields.Many2many(
comodel_name="stock.reserve.rule",
inverse_name="picking_type_ids",
)

View File

@@ -8,6 +8,7 @@ class TestReserveRule(common.SavepointCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))
cls.partner_delta = cls.env.ref("base.res_partner_4")
cls.wh = cls.env["stock.warehouse"].create(
{