Skip to content

Commit

Permalink
[IMP] maintenance_stock: black, isort, prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
Reyes4711-S73 committed Aug 16, 2023
1 parent a7fa359 commit b6a5612
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 17 deletions.
4 changes: 3 additions & 1 deletion maintenance_stock/models/maintenance_equipment.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ class MaintenanceEquipment(models.Model):
inverse_name="maintenance_equipment_id",
groups="stock.group_stock_user",
)
allow_consumptions = fields.Boolean(groups="stock.group_stock_user",)
allow_consumptions = fields.Boolean(
groups="stock.group_stock_user",
)
default_consumption_warehouse_id = fields.Many2one(
string="Default Consumption Warehouse",
comodel_name="stock.warehouse",
Expand Down
3 changes: 2 additions & 1 deletion maintenance_stock/models/stock_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ class StockMove(models.Model):
_inherit = "stock.move"

maintenance_request_id = fields.Many2one(
comodel_name="maintenance.request", related="picking_id.maintenance_request_id",
comodel_name="maintenance.request",
related="picking_id.maintenance_request_id",
)
maintenance_equipment_id = fields.Many2one(
comodel_name="maintenance.equipment",
Expand Down
3 changes: 2 additions & 1 deletion maintenance_stock/models/stock_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ class StockMoveLine(models.Model):
_inherit = "stock.move.line"

maintenance_request_id = fields.Many2one(
comodel_name="maintenance.request", related="picking_id.maintenance_request_id",
comodel_name="maintenance.request",
related="picking_id.maintenance_request_id",
)
maintenance_equipment_id = fields.Many2one(
comodel_name="maintenance.equipment",
Expand Down
3 changes: 2 additions & 1 deletion maintenance_stock/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ class StockPicking(models.Model):
_inherit = "stock.picking"

maintenance_request_id = fields.Many2one(
comodel_name="maintenance.request", index=True,
comodel_name="maintenance.request",
index=True,
)
maintenance_equipment_id = fields.Many2one(
comodel_name="maintenance.equipment",
Expand Down
41 changes: 28 additions & 13 deletions maintenance_stock/tests/test_maintenance_stock.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ def setUp(self):
super().setUp()

self.maintenance_warehouse = self.env["stock.warehouse"].create(
<<<<<<< HEAD
{"name": "Test warehouse", "code": "TEST",}
=======
{"name": "Test warehouse", "code": "TEST"}
>>>>>>> 9a9e9cf ([MIG] maintenance_stock: Migration to 13.0)
{
"name": "Test warehouse",
"code": "TEST",
}
)

self.product1 = self.env["product.product"].create(
Expand Down Expand Up @@ -111,22 +112,22 @@ def test_picking(self):
self.assertEqual(len(self.equipment_1.stock_picking_ids), 0)

qty_done = 5.0
<<<<<<< HEAD
=======
move_line_data = {
"product_id": self.product1.id,
"product_uom_id": self.env.ref("uom.product_uom_unit").id,
"qty_done": qty_done,
"location_id": self.maintenance_warehouse.lot_stock_id.id,
"location_dest_id": self.maintenance_warehouse.wh_cons_loc_id.id,
}
>>>>>>> 9a9e9cf ([MIG] maintenance_stock: Migration to 13.0)
location_id = self.maintenance_warehouse.lot_stock_id.id
location_dest_id = self.maintenance_warehouse.wh_cons_loc_id.id
picking_type_id = self.maintenance_warehouse.cons_type_id.id
picking = self.env["stock.picking"].create(
{
"maintenance_request_id": self.request_1.id,
"picking_type_id": self.maintenance_warehouse.cons_type_id.id,
"location_id": self.maintenance_warehouse.lot_stock_id.id,
"location_dest_id": self.maintenance_warehouse.wh_cons_loc_id.id,
"picking_type_id": picking_type_id,
"location_id": location_id,
"location_dest_id": location_dest_id,
"move_lines": [
(
0,
Expand All @@ -136,10 +137,24 @@ def test_picking(self):
"product_id": self.product1.id,
"product_uom": self.env.ref("uom.product_uom_unit").id,
"product_uom_qty": 5.0,
"picking_type_id": self.maintenance_warehouse.cons_type_id.id,
"location_id": self.maintenance_warehouse.lot_stock_id.id,
"location_dest_id": self.maintenance_warehouse.wh_cons_loc_id.id,
"move_line_ids": [(0, 0, move_line_data)],
"picking_type_id": picking_type_id,
"location_id": location_id,
"location_dest_id": location_dest_id,
"move_line_ids": [
(
0,
0,
{
"product_id": self.product1.id,
"product_uom_id": self.env.ref(
"uom.product_uom_unit"
).id,
"qty_done": qty_done,
"location_id": location_id,
"location_dest_id": location_dest_id,
},
)
],
},
)
],
Expand Down
1 change: 1 addition & 0 deletions setup/maintenance_stock/odoo/addons/maintenance_stock
6 changes: 6 additions & 0 deletions setup/maintenance_stock/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit b6a5612

Please sign in to comment.