mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[17.0][MIG] stock_mts_mto_rule: Migration to 17.0
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
Stock MTS+MTO Rule
|
||||
==================
|
||||
|
||||
..
|
||||
..
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
@@ -104,6 +104,7 @@ Contributors
|
||||
- Florian da Costa <florian.dacosta@akretion.com>
|
||||
- Jared Kipe <jared@hibou.io>
|
||||
- Alan Ramos <alan.ramos@jarsa.com.mx>
|
||||
- Aleksander Milinkevich <aleksander@versada.eu>
|
||||
|
||||
Maintainers
|
||||
-----------
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
{
|
||||
"name": "Stock MTS+MTO Rule",
|
||||
"summary": "Add a MTS+MTO route",
|
||||
"version": "16.0.1.0.0",
|
||||
"version": "17.0.1.0.0",
|
||||
"development_status": "Mature",
|
||||
"category": "Warehouse",
|
||||
"website": "https://github.com/OCA/stock-logistics-warehouse",
|
||||
|
||||
@@ -15,12 +15,12 @@ class StockWarehouse(models.Model):
|
||||
mts_mto_rule_id = fields.Many2one("stock.rule", "MTO+MTS rule", check_company=True)
|
||||
|
||||
def _get_all_routes(self):
|
||||
routes = super(StockWarehouse, self)._get_all_routes()
|
||||
routes = super()._get_all_routes()
|
||||
routes |= self.mapped("mts_mto_rule_id.route_id")
|
||||
return routes
|
||||
|
||||
def _update_name_and_code(self, new_name=False, new_code=False):
|
||||
res = super(StockWarehouse, self)._update_name_and_code(new_name, new_code)
|
||||
res = super()._update_name_and_code(new_name, new_code)
|
||||
if not new_name:
|
||||
return res
|
||||
for warehouse in self.filtered("mts_mto_rule_id"):
|
||||
@@ -36,7 +36,7 @@ class StockWarehouse(models.Model):
|
||||
def _get_route_name(self, route_type):
|
||||
if route_type == "mts_mto":
|
||||
return _("MTS+MTO")
|
||||
return super(StockWarehouse, self)._get_route_name(route_type)
|
||||
return super()._get_route_name(route_type)
|
||||
|
||||
def _get_global_route_rules_values(self):
|
||||
rule = self.get_rules_dict()[self.id][self.delivery_steps]
|
||||
@@ -44,7 +44,7 @@ class StockWarehouse(models.Model):
|
||||
location_id = rule.from_loc
|
||||
location_dest_id = rule.dest_loc
|
||||
picking_type_id = rule.picking_type
|
||||
res = super(StockWarehouse, self)._get_global_route_rules_values()
|
||||
res = super()._get_global_route_rules_values()
|
||||
res.update(
|
||||
{
|
||||
"mts_mto_rule_id": {
|
||||
@@ -75,7 +75,7 @@ class StockWarehouse(models.Model):
|
||||
return res
|
||||
|
||||
def _create_or_update_global_routes_rules(self):
|
||||
res = super(StockWarehouse, self)._create_or_update_global_routes_rules()
|
||||
res = super()._create_or_update_global_routes_rules()
|
||||
|
||||
if (
|
||||
self.mto_mts_management
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
- Florian da Costa \<<florian.dacosta@akretion.com>\>
|
||||
- Jared Kipe \<<jared@hibou.io>\>
|
||||
- Alan Ramos \<<alan.ramos@jarsa.com.mx>\>
|
||||
- Aleksander Milinkevich \<<aleksander@versada.eu>\>
|
||||
|
||||
@@ -458,6 +458,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
|
||||
<li>Florian da Costa <<a class="reference external" href="mailto:florian.dacosta@akretion.com">florian.dacosta@akretion.com</a>></li>
|
||||
<li>Jared Kipe <<a class="reference external" href="mailto:jared@hibou.io">jared@hibou.io</a>></li>
|
||||
<li>Alan Ramos <<a class="reference external" href="mailto:alan.ramos@jarsa.com.mx">alan.ramos@jarsa.com.mx</a>></li>
|
||||
<li>Aleksander Milinkevich <<a class="reference external" href="mailto:aleksander@versada.eu">aleksander@versada.eu</a>></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import exceptions
|
||||
from odoo import Command, exceptions
|
||||
from odoo.tests.common import TransactionCase
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ class TestMtoMtsRoute(TransactionCase):
|
||||
def test_standard_mto_route(self):
|
||||
mto_route = self.env.ref("stock.route_warehouse0_mto")
|
||||
mto_route.active = True
|
||||
self.product.route_ids = [(6, 0, [mto_route.id])]
|
||||
self.product.route_ids = [Command.set(mto_route.ids)]
|
||||
self.env["procurement.group"].run(
|
||||
[
|
||||
self.group.Procurement(
|
||||
@@ -56,7 +56,7 @@ class TestMtoMtsRoute(TransactionCase):
|
||||
|
||||
def test_mts_mto_route_split(self):
|
||||
mto_mts_route = self.env.ref("stock_mts_mto_rule.route_mto_mts")
|
||||
self.product.route_ids = [(6, 0, [mto_mts_route.id])]
|
||||
self.product.route_ids = [Command.set(mto_mts_route.ids)]
|
||||
self._create_quant(1.0)
|
||||
self.env["procurement.group"].run(
|
||||
[
|
||||
@@ -96,7 +96,7 @@ class TestMtoMtsRoute(TransactionCase):
|
||||
|
||||
def test_mts_mto_route_mto_only(self):
|
||||
mto_mts_route = self.env.ref("stock_mts_mto_rule.route_mto_mts")
|
||||
self.product.route_ids = [(6, 0, [mto_mts_route.id])]
|
||||
self.product.route_ids = [Command.set(mto_mts_route.ids)]
|
||||
self.env["procurement.group"].run(
|
||||
[
|
||||
self.group.Procurement(
|
||||
@@ -123,7 +123,7 @@ class TestMtoMtsRoute(TransactionCase):
|
||||
|
||||
def test_mts_mto_route_mts_only(self):
|
||||
mto_mts_route = self.env.ref("stock_mts_mto_rule.route_mto_mts")
|
||||
self.product.route_ids = [(6, 0, [mto_mts_route.id])]
|
||||
self.product.route_ids = [Command.set(mto_mts_route.ids)]
|
||||
self._create_quant(3.0)
|
||||
self.env["procurement.group"].run(
|
||||
[
|
||||
@@ -214,7 +214,7 @@ class TestMtoMtsRoute(TransactionCase):
|
||||
self.assertEqual(new_rule_name, self.warehouse.mts_mto_rule_id.name)
|
||||
|
||||
def setUp(self):
|
||||
super(TestMtoMtsRoute, self).setUp()
|
||||
super().setUp()
|
||||
self.move_obj = self.env["stock.move"]
|
||||
self.warehouse = self.env.ref("stock.warehouse0")
|
||||
self.uom = self.env["uom.uom"].browse(1)
|
||||
@@ -244,4 +244,4 @@ class TestMtoMtsRoute(TransactionCase):
|
||||
"route_id": self.dummy_route.id,
|
||||
}
|
||||
self.dummy_rule = self.env["stock.rule"].create(rule_vals)
|
||||
self.warehouse.write({"route_ids": [(4, self.dummy_route.id)]})
|
||||
self.warehouse.write({"route_ids": [Command.link(self.dummy_route.id)]})
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
<field
|
||||
name="mts_rule_id"
|
||||
groups="stock.group_adv_location"
|
||||
attrs="{'invisible': [('action', '!=', 'split_procurement')]}"
|
||||
invisible="action != 'split_procurement'"
|
||||
/>
|
||||
<field
|
||||
name="mto_rule_id"
|
||||
groups="stock.group_adv_location"
|
||||
attrs="{'invisible': [('action', '!=', 'split_procurement')]}"
|
||||
invisible="action != 'split_procurement'"
|
||||
/>
|
||||
</field>
|
||||
</field>
|
||||
@@ -28,12 +28,12 @@
|
||||
<field
|
||||
name="mts_rule_id"
|
||||
groups="stock.group_adv_location"
|
||||
attrs="{'invisible': [('action', '!=', 'split_procurement')]}"
|
||||
invisible="action != 'split_procurement'"
|
||||
/>
|
||||
<field
|
||||
name="mto_rule_id"
|
||||
groups="stock.group_adv_location"
|
||||
attrs="{'invisible': [('action', '!=', 'split_procurement')]}"
|
||||
invisible="action != 'split_procurement'"
|
||||
/>
|
||||
</field>
|
||||
</field>
|
||||
|
||||
Reference in New Issue
Block a user