Skip to content

Commit

Permalink
[MIG] stock_request_kanban: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
matt454357 committed Oct 2, 2024
1 parent 92b966b commit 50805f7
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 13 deletions.
2 changes: 1 addition & 1 deletion stock_request_kanban/tests/test_inventory_kanban.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class TestKanban(TestBaseKanban):
def setUp(self):
super().setUp()
self.main_company = self.env.ref("base.main_company")
self.route = self.env["stock.location.route"].create(
self.route = self.env["stock.route"].create(
{
"name": "Transfer",
"product_categ_selectable": False,
Expand Down
36 changes: 34 additions & 2 deletions stock_request_kanban/tests/test_kanban.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def setUp(self):
self.ressuply_loc = self.env["stock.location"].create(
{"name": "Ressuply", "location_id": self.warehouse.view_location_id.id}
)
self.route = self.env["stock.location.route"].create(
self.route = self.env["stock.route"].create(
{
"name": "Transfer",
"product_categ_selectable": False,
Expand All @@ -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 Expand Up @@ -198,3 +198,35 @@ def test_barcodes(self):
self.assertTrue(
self.env["stock.request"].search([("kanban_id", "=", kanban_3.id)])
)

def test_product_kanban_count(self):
self.env["stock.request.kanban"].create(
{
"product_id": self.product.id,
"product_uom_id": self.product.uom_id.id,
"product_uom_qty": 1,
}
)
self.env["stock.request.kanban"].create(
{
"product_id": self.product.id,
"product_uom_id": self.product.uom_id.id,
"product_uom_qty": 1,
}
)
self.assertEqual(self.product.kanban_card_count, 2)
self.assertEqual(self.product.product_tmpl_id.kanban_card_count, 2)

def test_product_kanban_action(self):
prod_action = self.product.action_view_kanban_cards()
tmpl_action = self.product.product_tmpl_id.action_view_kanban_cards()
self.assertEqual(
prod_action.get("context", {}).get("default_product_id"),
self.product.id,
"Product variant not in action",
)
self.assertEqual(
tmpl_action.get("context", {}).get("default_product_id"),
self.product.id,
"Product template not in action",
)
10 changes: 2 additions & 8 deletions stock_request_kanban/views/product_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
<field name="name">product.product.stock.request.kanban</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view" />
<field
name="groups_id"
eval="[(4, ref('stock_request.group_stock_request_user'))]"
/>
<field name="arch" type="xml">
<div name="button_box" position="inside">
<button
Expand All @@ -18,6 +14,7 @@
type="object"
attrs="{'invisible':[('type', 'not in', ['product', 'consu'])]}"
icon="fa-barcode"
groups="stock_request.group_stock_request_user"
>
<field
string="Kanban Cards"
Expand All @@ -32,10 +29,6 @@
<field name="name">product.template.stock.request.kanban</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_only_form_view" />
<field
name="groups_id"
eval="[(4, ref('stock_request.group_stock_request_user'))]"
/>
<field name="arch" type="xml">
<div name="button_box" position="inside">
<button
Expand All @@ -44,6 +37,7 @@
type="object"
attrs="{'invisible':[('type', 'not in', ['product', 'consu'])]}"
icon="fa-barcode"
groups="stock_request.group_stock_request_user"
>
<field
string="Kanban Cards"
Expand Down
5 changes: 3 additions & 2 deletions stock_request_kanban/views/stock_request_kanban_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
<field name="model">stock.request.kanban</field>
<field name="arch" type="xml">
<form string="Stock Requests">
<field name="company_id" invisible="1" />
<header />
<sheet>
<div class="oe_button_box" name="button_box" />
Expand Down Expand Up @@ -193,8 +194,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>

0 comments on commit 50805f7

Please sign in to comment.