Skip to content

Commit

Permalink
[MIG] stock_warehouse_flow: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
RodrigoBM committed Sep 6, 2023
1 parent 12d4791 commit 7e48298
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 58 deletions.
4 changes: 2 additions & 2 deletions stock_warehouse_flow/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"author": "Camptocamp, BCIM, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/wms",
"category": "Warehouse Management",
"version": "14.0.2.0.0",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"depends": [
# core
Expand All @@ -20,7 +20,7 @@
],
"data": [
"security/ir.model.access.csv",
"views/stock_location_route.xml",
"views/stock_route.xml",
"views/stock_warehouse_flow.xml",
"views/stock_warehouse.xml",
"views/delivery_carrier.xml",
Expand Down
2 changes: 1 addition & 1 deletion stock_warehouse_flow/demo/stock_warehouse_flow.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<field name="sequence_prefix">NORMAL</field>
<field
name="carrier_ids"
eval="[(6, 0, [ref('delivery.normal_delivery_carrier')])]"
eval="[(6, 0, [ref('delivery.delivery_local_delivery')])]"
/>
</record>

Expand Down
23 changes: 0 additions & 23 deletions stock_warehouse_flow/migrations/14.0.1.0.1/pre-migrate.py

This file was deleted.

2 changes: 1 addition & 1 deletion stock_warehouse_flow/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from . import stock_warehouse_flow
from . import stock_warehouse
from . import stock_move
from . import stock_location_route
from . import stock_route
from . import delivery_carrier
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from odoo import api, fields, models


class StockLocationRoute(models.Model):
_inherit = "stock.location.route"
class StockRoute(models.Model):
_inherit = "stock.route"

flow_id = fields.Many2one(
comodel_name="stock.warehouse.flow",
Expand Down
7 changes: 3 additions & 4 deletions stock_warehouse_flow/models/stock_warehouse_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class StockWarehouseFlow(models.Model):
)
)
delivery_route_id = fields.Many2one(
comodel_name="stock.location.route",
comodel_name="stock.route",
string="Delivery Route",
ondelete="set null",
readonly=True,
Expand All @@ -111,7 +111,7 @@ class StockWarehouseFlow(models.Model):
string="Rules",
)
impacted_route_ids = fields.One2many(
comodel_name="stock.location.route",
comodel_name="stock.route",
compute="_compute_impacted_route_ids",
string="Impacted Routes",
)
Expand Down Expand Up @@ -144,7 +144,6 @@ class StockWarehouseFlow(models.Model):
),
)
qty = fields.Float(
"Qty",
default=0,
help="If a qty is set the flow can be applied on moves "
"where the move's qty >= the qty set on the flow\n",
Expand Down Expand Up @@ -366,7 +365,7 @@ def _generate_delivery_route(self):
"sequence": 1000,
}
)
self.delivery_route_id = self.env["stock.location.route"].create(vals)
self.delivery_route_id = self.env["stock.route"].create(vals)
# Subscribe the route to the warehouse
if self.delivery_route_id.warehouse_selectable:
self.warehouse_id.route_ids |= self.delivery_route_id
Expand Down
6 changes: 3 additions & 3 deletions stock_warehouse_flow/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)

from odoo import fields
from odoo.tests.common import SavepointCase
from odoo.tests.common import TransactionCase


class CommonFlow(SavepointCase):
class CommonFlow(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
Expand Down Expand Up @@ -67,7 +67,7 @@ def _run_procurement(self, product, qty, carrier=None):

def _validate_picking(self, picking):
for move_line in picking.move_line_ids:
move_line.qty_done = move_line.product_uom_qty
move_line.qty_done = move_line.reserved_uom_qty
picking._action_done()

def _prepare_split_test(self, qty=None):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<record id="stock_location_route_tree" model="ir.ui.view">
<field name="name">stock.location.route.tree.inherit</field>
<field name="model">stock.location.route</field>
<field name="model">stock.route</field>
<field name="inherit_id" ref="stock.stock_location_route_tree" />
<field name="arch" type="xml">
<field name="name" position="after">
Expand Down
47 changes: 26 additions & 21 deletions stock_warehouse_flow/views/stock_warehouse_flow.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,35 @@
attrs="{'invisible': [('active', '=', True)]}"
/>
<div class="oe_title">
<label for="name" class="oe_edit_only" />
<h1><field name="name" placeholder="Flow Name" /></h1>
<label for="name" />
<h1>
<field name="name" placeholder="Flow Name" />
</h1>
</div>
<group>
<group name="info" colspan="4" col="4">
<field
name="warehouse_id"
attrs="{'readonly': [('delivery_route_id', '!=', False)]}"
/>
<field name="sequence" />
<field name="active" invisible="1" />
<field name="company_id" invisible="1" />
<group name="info" colspan="4">
<group>
<field
name="warehouse_id"
attrs="{'readonly': [('delivery_route_id', '!=', False)]}"
/>
</group>
<group>
<field name="sequence" />
<field name="active" invisible="1" />
<field name="company_id" invisible="1" />
</group>
</group>
<group name="from" string="From">
<field name="from_picking_type_id" />
<div
colspan="2"
attrs="{'invisible': [('from_picking_type_id', '=', False)]}"
>
<span style="width: 4em;" />
=>
<field name="from_location_src_id" nolabel="1" />
to
<field name="from_location_dest_id" nolabel="1" />
<span class="text-muted"> => </span>
<field name="from_location_src_id" nolabel="1" class="oe_inline" />
<span class="text-muted"> to </span>
<field name="from_location_dest_id" nolabel="1" class="oe_inline" />
</div>
<field name="carrier_ids" widget="many2many_tags" />
<field
Expand All @@ -53,11 +58,11 @@
attrs="{'invisible': [('split_method', '!=', 'simple')]}"
/>
<div name="qty" class="o_row">
<field
<field
name="qty"
attrs="{'required': [('split_method', '=', 'simple')], 'invisible': [('split_method', '!=', 'simple')]}"
/>
<field
<field
name="uom_id"
options="{'no_open': True, 'no_create': True}"
groups="uom.group_uom"
Expand Down Expand Up @@ -113,7 +118,7 @@
<field name="action" />
<field name="picking_type_id" />
<field name="location_src_id" />
<field name="location_id" />
<field name="location_dest_id" />
<field name="group_id" />
</tree>
</field>
Expand Down Expand Up @@ -195,18 +200,18 @@
<field name="carrier_ids" />
<filter string="Archived" name="inactive" domain="[('active','=',False)]" />
<group expand='0' string='Group by...'>
<filter
<filter
string='Warehouse'
name="groupby_warehouse"
context="{'group_by': 'warehouse_id'}"
groups="stock.group_stock_multi_warehouses"
/>
<filter
<filter
string='From operation type'
name="groupby_from_picking_type"
context="{'group_by': 'from_picking_type_id'}"
/>
<filter
<filter
string='To operation type'
name="groupby_to_picking_type"
context="{'group_by': 'to_picking_type_id'}"
Expand Down

0 comments on commit 7e48298

Please sign in to comment.