Skip to content

Commit

Permalink
[MIG] stock_request_kanban: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
JasminSForgeFlow committed Sep 17, 2024
1 parent 4be3719 commit 5f19465
Show file tree
Hide file tree
Showing 21 changed files with 92 additions and 123 deletions.
9 changes: 1 addition & 8 deletions stock_request_kanban/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{
"name": "Stock Request kanban",
"version": "16.0.1.0.0",
"version": "17.0.1.0.0",
"category": "Warehouse Management",
"website": "https://github.com/OCA/stock-logistics-request",
"author": "Creu Blanca, ForgeFlow, Odoo Community Association (OCA)",
Expand All @@ -25,13 +25,6 @@
"report/stock_request_kanban_templates.xml",
"security/ir.model.access.csv",
],
"assets": {
"web.assets_backend": [
"stock_request_kanban/static/src/js/stock_request_kanban_scan_controller.esm.js",
"stock_request_kanban/static/src/js/stock_request_kanban_scan_view.esm.js",
"stock_request_kanban/static/src/xml/stock_request_kanban_scan.xml",
]
},
"installable": True,
"application": False,
}
9 changes: 2 additions & 7 deletions stock_request_kanban/models/stock_inventory_kanban.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ class StockInventoryKanban(models.Model):
_description = "Inventory for Kanban"
_inherit = ["mail.thread", "mail.activity.mixin"]

name = fields.Char(
readonly=True, states={"draft": [("readonly", False)]}, copy=False
)
name = fields.Char(readonly=True, copy=False)
state = fields.Selection(
[
("draft", "Draft"),
Expand All @@ -32,23 +30,20 @@ class StockInventoryKanban(models.Model):
string="Warehouse",
ondelete="cascade",
readonly=True,
states={"draft": [("readonly", False)]},
)
location_ids = fields.Many2many(
"stock.location",
string="Location",
domain=[("usage", "in", ["internal", "transit"])],
ondelete="cascade",
readonly=True,
states={"draft": [("readonly", False)]},
)
product_ids = fields.Many2many(
"product.product",
string="Products",
domain=[("type", "in", ["product", "consu"])],
ondelete="cascade",
readonly=True,
states={"draft": [("readonly", False)]},
)
kanban_ids = fields.Many2many(
"stock.request.kanban",
Expand All @@ -74,7 +69,7 @@ class StockInventoryKanban(models.Model):
def _compute_missing_kanban(self):
for rec in self:
rec.missing_kanban_ids = rec.kanban_ids.filtered(
lambda r: r.id not in rec.scanned_kanban_ids.ids
lambda r, rec=rec: r.id not in rec.scanned_kanban_ids.ids
)
rec.count_missing_kanbans = len(rec.missing_kanban_ids)

Expand Down
9 changes: 9 additions & 0 deletions stock_request_kanban/models/stock_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,12 @@ class StockRequest(models.Model):
_inherit = "stock.request"

kanban_id = fields.Many2one("stock.request.kanban", readonly=True)

def action_scan_kanban(self):
return {

Check warning on line 13 in stock_request_kanban/models/stock_request.py

View check run for this annotation

Codecov / codecov/patch

stock_request_kanban/models/stock_request.py#L13

Added line #L13 was not covered by tests
"res_model": "wizard.stock.request.kanban",
"views": [[False, "form"]],
"target": "new",
"type": "ir.actions.act_window",
"context": self._context,
}

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions stock_request_kanban/static/src/xml/stock_request_kanban_scan.xml

This file was deleted.

2 changes: 1 addition & 1 deletion stock_request_kanban/tests/base_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright 2017 Creu Blanca
# Copyright 2017-2020 ForgeFlow, S.L.
# Copyright 2017-2024 ForgeFlow, S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from reportlab.graphics.barcode import getCodes
Expand Down
2 changes: 1 addition & 1 deletion stock_request_kanban/tests/test_inventory_kanban.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright 2017 Creu Blanca
# Copyright 2017-2020 ForgeFlow, S.L.
# Copyright 2017-2024 ForgeFlow, S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from .base_test import TestBaseKanban
Expand Down
4 changes: 2 additions & 2 deletions stock_request_kanban/tests/test_kanban.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright 2017 Creu Blanca
# Copyright 2017-2020 ForgeFlow, S.L.
# Copyright 2017-2024 ForgeFlow, S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from odoo.exceptions import ValidationError
Expand Down Expand Up @@ -57,7 +57,7 @@ def setUp(self):
"name": "Transfer",
"route_id": self.route.id,
"location_src_id": self.ressuply_loc.id,
"location_id": self.warehouse.lot_stock_id.id,
"location_dest_id": self.warehouse.lot_stock_id.id,
"action": "pull_push",
"picking_type_id": self.warehouse.int_type_id.id,
"procure_method": "make_to_stock",
Expand Down
6 changes: 3 additions & 3 deletions stock_request_kanban/views/product_views.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2020 ForgeFlow, S.L.
<!-- Copyright 2024 ForgeFlow, S.L.
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). -->
<odoo>
<record id="product_product_form_view_kanban_card_button" model="ir.ui.view">
Expand All @@ -12,7 +12,7 @@
class="oe_stat_button"
name="action_view_kanban_cards"
type="object"
attrs="{'invisible':[('type', 'not in', ['product', 'consu'])]}"
invisible="type not in ['product', 'consu']"
icon="fa-barcode"
groups="stock_request.group_stock_request_user"
>
Expand All @@ -35,7 +35,7 @@
class="oe_stat_button"
name="action_view_kanban_cards"
type="object"
attrs="{'invisible':[('type', 'not in', ['product', 'consu'])]}"
invisible="type not in ['product', 'consu']"
icon="fa-barcode"
groups="stock_request.group_stock_request_user"
>
Expand Down
24 changes: 15 additions & 9 deletions stock_request_kanban/views/stock_inventory_kanban_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<field name="model">stock.inventory.kanban</field>
<field name="arch" type="xml">
<tree>
<field name="name" />
<field name="name" readonly="state != 'draft'" />
<field name="count_missing_kanbans" />
<field name="state" />
</tree>
Expand All @@ -21,40 +21,40 @@
name="start_inventory"
type="object"
string="Start"
states="draft"
invisible="state != 'draft'"
class="btn-primary"
/>
<button
name="finish_inventory"
type="object"
string="Finish"
states="in_progress"
invisible="state != 'in_progress'"
class="btn-primary"
/>
<button
name="print_missing_kanbans"
type="object"
string="Print missing"
states="finished"
invisible="state != 'finished'"
/>
<button
name="close_inventory"
type="object"
string="Close"
states="finished"
invisible="state != 'finished'"
class="btn-primary"
/>
<button
name="cancel"
type="object"
string="Cancel"
states="draft,in_progress,finished"
invisible="state not in ('draft', 'in_progress', 'finished')"
/>
<button
name="to_draft"
type="object"
string="Set to draft"
states="cancelled"
invisible="state != 'cancelled'"
/>
<field name="state" widget="statusbar" />
</header>
Expand All @@ -65,7 +65,7 @@
type="action"
icon="fa-barcode"
string="Scan"
states="in_progress"
invisible="state != 'in_progress'"
class="oe_read_only"
/>
</div>
Expand All @@ -80,13 +80,19 @@
name="warehouse_ids"
widget="many2many_tags"
groups="stock.group_stock_multi_locations"
readonly="state != 'draft'"
/>
<field
name="location_ids"
widget="many2many_tags"
groups="stock.group_stock_multi_locations"
readonly="state != 'draft'"
/>
<field
name="product_ids"
widget="many2many_tags"
readonly="state != 'draft'"
/>
<field name="product_ids" widget="many2many_tags" />
</group>
<notebook>
<page string="Kanban" id="kanban">
Expand Down
40 changes: 34 additions & 6 deletions stock_request_kanban/views/stock_request_kanban_views.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2017-2020 ForgeFlow, S.L.
<!-- Copyright 2017-2024 ForgeFlow, S.L.
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). -->
<odoo>
<record id="view_stock_request_kanban_tree" model="ir.ui.view">
Expand All @@ -10,8 +10,8 @@
decoration-muted="active == 'false'"
decoration-bf="message_needaction==True"
>
<field name="message_needaction" invisible="1" />
<field name="allow_virtual_location" invisible="1" />
<field name="message_needaction" column_invisible="True" />
<field name="allow_virtual_location" column_invisible="True" />
<field name="name" />
<field name="warehouse_id" groups="stock.group_stock_multi_locations" />
<field name="location_id" groups="stock.group_stock_multi_locations" />
Expand All @@ -27,7 +27,7 @@
groups="uom.group_uom"
/>
<field name="product_uom_qty" />
<field name="active" invisible="1" />
<field name="active" column_invisible="True" />
</tree>
</field>
</record>
Expand Down Expand Up @@ -88,21 +88,39 @@
<field
name="warehouse_id"
widget="selection"
force_save="1"
groups="stock.group_stock_multi_locations"
/>
<field
name="warehouse_id"
widget="selection"
force_save="1"
groups="!stock.group_stock_multi_locations"
invisible="1"
/>
<field
name="location_id"
groups="stock.group_stock_multi_locations"
force_save="1"
domain="['|', ('company_id', '=', company_id), ('company_id', '=', False)]"
/>
<field
name="location_id"
groups="!stock.group_stock_multi_locations"
force_save="1"
domain="['|', ('company_id', '=', company_id), ('company_id', '=', False)]"
invisible="1"
/>
<field
name="route_id"
options="{'no_create': True}"
force_save="1"
groups="stock.group_stock_multi_locations"
/>
<field name="route_ids" invisible="1" />
<field
name="procurement_group_id"
force_save="1"
groups="stock.group_adv_location"
/>
<field
Expand All @@ -115,12 +133,22 @@
<label for="product_uom_qty" />
<div>
<field name="product_uom_qty" class="oe_inline" />
<field name="allowed_uom_categ_id" invisible="1" />
<field
name="product_uom_id"
class="oe_inline"
force_save="1"
options="{'no_open': True, 'no_create': True}"
groups="uom.group_uom"
/>
<field
name="product_uom_id"
class="oe_inline"
force_save="1"
options="{'no_open': True, 'no_create': True}"
groups="!uom.group_uom"
invisible="1"
/>
</div>
</group>
</group>
Expand Down Expand Up @@ -195,8 +223,8 @@
<field name="view_mode">kanban,tree,form</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to add a Stock Request Kanban.
</p>
Click to add a Stock Request Kanban.
</p>
</field>
</record>
</odoo>
Loading

0 comments on commit 5f19465

Please sign in to comment.