Skip to content

Commit 921a16a

Browse files
mamcodeReyes4711-S73
authored andcommitted
[MIG] maintenance_stock: Migration to 13.0
1 parent 4a66cc0 commit 921a16a

File tree

6 files changed

+32
-24
lines changed

6 files changed

+32
-24
lines changed

maintenance_stock/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"summary": "Links maintenance requests to stock",
66
"author": "Odoo Community Association (OCA), Solvos",
77
"license": "AGPL-3",
8-
"version": "12.0.1.0.0",
8+
"version": "13.0.1.0.0",
99
"category": "Warehouse",
1010
"website": "https://github.com/OCA/maintenance",
1111
"depends": ["base_maintenance", "stock",],

maintenance_stock/data/demo_maintenance_stock.xml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
<record id="stock_warehouse_maintenance" model="stock.warehouse">
66
<field name="name">Maintenance Warehouse</field>
77
<field name="partner_id" ref="stock.res_partner_address_41" />
8-
<field name="company_id" ref="stock.res_company_1" />
98
<field name="code">Main</field>
109
</record>
1110

@@ -37,7 +36,6 @@
3736
<field name="standard_price">70.0</field>
3837
<field name="uom_id" ref="uom.product_uom_unit" />
3938
<field name="uom_po_id" ref="uom.product_uom_unit" />
40-
<field name="property_stock_inventory" ref="stock.location_inventory" />
4139
<field
4240
name="image"
4341
type="base64"
@@ -47,8 +45,10 @@
4745

4846
<record id="stock_inventory_toner" model="stock.inventory">
4947
<field name="name">Inventory for Toner</field>
50-
<field name="filter">product</field>
51-
<field name="product_id" ref="maintenance_stock.product_toner" />
48+
<field
49+
name="product_ids"
50+
eval="[(4, ref('maintenance_stock.product_toner'))]"
51+
/>
5252
</record>
5353

5454
<record id="stock_inventory_toner_line" model="stock.inventory.line">
@@ -59,14 +59,22 @@
5959
<field name="location_id" ref="maintenance_stock.main_location_stock" />
6060
</record>
6161

62-
<function model="stock.inventory" name="action_validate">
62+
<function model="stock.inventory" name="_action_start">
6363
<function
6464
eval="[[('state','=','draft'),('id', '=', ref('maintenance_stock.stock_inventory_toner'))]]"
6565
model="stock.inventory"
6666
name="search"
6767
/>
6868
</function>
6969

70+
<function model="stock.inventory" name="action_validate">
71+
<function
72+
eval="[[('state','=','confirm'),('id', '=', ref('maintenance_stock.stock_inventory_toner'))]]"
73+
model="stock.inventory"
74+
name="search"
75+
/>
76+
</function>
77+
7078
<record id="maintenance.equipment_printer1" model="maintenance.equipment">
7179
<field name="allow_consumptions" eval="True" />
7280
<field

maintenance_stock/models/stock_picking.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ class StockPicking(models.Model):
1212
maintenance_equipment_id = fields.Many2one(
1313
comodel_name="maintenance.equipment",
1414
related="maintenance_request_id.equipment_id",
15+
store=True,
1516
)

maintenance_stock/models/stock_warehouse.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ def _create_or_update_sequences_and_picking_types(self):
1616
PickingType = self.env["stock.picking.type"]
1717

1818
# TODO when is called for an existing warehouse (e.g. during the
19-
# module installation in_type_id is not accesible). Temporary
20-
# solved with a hook
19+
# module installation in_type_id is not accesible). Temporary
20+
# solved with a hook
2121
if "cons_type_id" in warehouse_data:
2222
PickingType.browse(warehouse_data["cons_type_id"]).write(
2323
{"return_picking_type_id": warehouse_data.get("in_type_id", False),}

maintenance_stock/tests/test_maintenance_stock.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ def setUp(self):
88
super().setUp()
99

1010
self.maintenance_warehouse = self.env["stock.warehouse"].create(
11+
<<<<<<< HEAD
1112
{"name": "Test warehouse", "code": "TEST",}
13+
=======
14+
{"name": "Test warehouse", "code": "TEST"}
15+
>>>>>>> 9a9e9cf ([MIG] maintenance_stock: Migration to 13.0)
1216
)
1317

1418
self.product1 = self.env["product.product"].create(
@@ -107,6 +111,16 @@ def test_picking(self):
107111
self.assertEqual(len(self.equipment_1.stock_picking_ids), 0)
108112

109113
qty_done = 5.0
114+
<<<<<<< HEAD
115+
=======
116+
move_line_data = {
117+
"product_id": self.product1.id,
118+
"product_uom_id": self.env.ref("uom.product_uom_unit").id,
119+
"qty_done": qty_done,
120+
"location_id": self.maintenance_warehouse.lot_stock_id.id,
121+
"location_dest_id": self.maintenance_warehouse.wh_cons_loc_id.id,
122+
}
123+
>>>>>>> 9a9e9cf ([MIG] maintenance_stock: Migration to 13.0)
110124
picking = self.env["stock.picking"].create(
111125
{
112126
"maintenance_request_id": self.request_1.id,
@@ -125,21 +139,7 @@ def test_picking(self):
125139
"picking_type_id": self.maintenance_warehouse.cons_type_id.id,
126140
"location_id": self.maintenance_warehouse.lot_stock_id.id,
127141
"location_dest_id": self.maintenance_warehouse.wh_cons_loc_id.id,
128-
"move_line_ids": [
129-
(
130-
0,
131-
0,
132-
{
133-
"product_id": self.product1.id,
134-
"product_uom_id": self.env.ref(
135-
"uom.product_uom_unit"
136-
).id,
137-
"qty_done": qty_done,
138-
"location_id": self.maintenance_warehouse.lot_stock_id.id,
139-
"location_dest_id": self.maintenance_warehouse.wh_cons_loc_id.id,
140-
},
141-
)
142-
],
142+
"move_line_ids": [(0, 0, move_line_data)],
143143
},
144144
)
145145
],

maintenance_stock/views/stock_move_views.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
<field name="name">Stock Moves</field>
5555
<field name="res_model">stock.move</field>
5656
<field name="type">ir.actions.act_window</field>
57-
<field name="view_type">form</field>
5857
<field name="view_id" ref="stock.view_move_tree" />
5958
<field name="search_view_id" ref="stock.view_move_search" />
6059
<field name="domain">[('maintenance_request_id', '!=', False)]</field>

0 commit comments

Comments
 (0)