Skip to content

Commit

Permalink
[IMP] black, isort, prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienbeau committed Dec 10, 2020
1 parent 25997d6 commit 2c4e01c
Show file tree
Hide file tree
Showing 100 changed files with 811 additions and 543 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ exclude: |
# Maybe reactivate this when all README files include prettier ignore tags?
^README\.md$|
# Library files can have extraneous formatting (even minimized)
/static/(src/)?lib/|
lib/|
# Repos using Sphinx to generate docs don't need prettying
^docs/_templates/.*\.html$|
# You don't usually want a bot to modify your legal texts
Expand Down
4 changes: 1 addition & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
# tests
# TODO: check https://github.com/OCA/maintainer-quality-tools/pull/646
freezegun
# generated from manifests external_dependencies
5 changes: 4 additions & 1 deletion shopfloor/actions/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ def _move_line_parser(self):
("lot_id:lot", self._lot_parser),
("location_id:location_src", self._location_parser),
("location_dest_id:location_dest", self._location_parser),
("move_id:priority", lambda rec, fname: rec.move_id.priority or "",),
(
"move_id:priority",
lambda rec, fname: rec.move_id.priority or "",
),
]

def package_level(self, record, **kw):
Expand Down
3 changes: 1 addition & 2 deletions shopfloor/actions/data_detail.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@


class DataDetailAction(Component):
"""Provide extra data on top of data action.
"""
"""Provide extra data on top of data action."""

_name = "shopfloor.data.detail.action"
_inherit = "shopfloor.data.action"
Expand Down
3 changes: 2 additions & 1 deletion shopfloor/models/shopfloor_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class ShopfloorLog(models.Model):
exception_name = fields.Char(readonly=True, string="Exception")
exception_message = fields.Text(readonly=True)
state = fields.Selection(
selection=[("success", "Success"), ("failed", "Failed")], readonly=True,
selection=[("success", "Success"), ("failed", "Failed")],
readonly=True,
)
severity = fields.Selection(
selection=[
Expand Down
3 changes: 2 additions & 1 deletion shopfloor/models/stock_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ class StockLocation(models.Model):
comodel_name="stock.move.line", inverse_name="location_id", readonly=True
)
reserved_move_line_ids = fields.One2many(
comodel_name="stock.move.line", compute="_compute_reserved_move_lines",
comodel_name="stock.move.line",
compute="_compute_reserved_move_lines",
)

def is_sublocation_of(self, others, func=any):
Expand Down
3 changes: 2 additions & 1 deletion shopfloor/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class StockPicking(models.Model):
related="picking_type_id.shopfloor_display_packing_info",
)
shopfloor_packing_info = fields.Text(
string="Packing information", related="partner_id.shopfloor_packing_info",
string="Packing information",
related="partner_id.shopfloor_packing_info",
)

@api.depends(
Expand Down
4 changes: 3 additions & 1 deletion shopfloor/models/stock_picking_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ class StockPickingType(models.Model):
_inherit = "stock.picking.type"

shopfloor_menu_ids = fields.Many2many(
comodel_name="shopfloor.menu", string="Shopfloor Menus", readonly=True,
comodel_name="shopfloor.menu",
string="Shopfloor Menus",
readonly=True,
)
shopfloor_zero_check = fields.Boolean(
string="Activate Zero Check",
Expand Down
2 changes: 1 addition & 1 deletion shopfloor/models/stock_quant.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class StockQuant(models.Model):
_inherit = "stock.quant"

def _is_inventory_mode(self):
""" Used to control whether a quant was written on or created during an
"""Used to control whether a quant was written on or created during an
"inventory session", meaning a mode where we need to create the stock.move
record necessary to be consistent with the `inventory_quantity` field.
"""
Expand Down
3 changes: 2 additions & 1 deletion shopfloor/models/stock_quant_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class StockQuantPackage(models.Model):
)
# TODO: review other fields
reserved_move_line_ids = fields.One2many(
comodel_name="stock.move.line", compute="_compute_reserved_move_lines",
comodel_name="stock.move.line",
compute="_compute_reserved_move_lines",
)

def _get_reserved_move_lines(self):
Expand Down
4 changes: 3 additions & 1 deletion shopfloor/services/checkout.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,9 @@ def _change_line_qty(
new_line = self.env["stock.move.line"]
if qty_done > 0:
new_line, qty_check = move_line._split_qty_to_be_done(
qty_done, split_partial=True, result_package_id=False,
qty_done,
split_partial=True,
result_package_id=False,
)
if qty_check == "greater":
qty_done = move_line.product_uom_qty
Expand Down
3 changes: 2 additions & 1 deletion shopfloor/services/cluster_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,8 @@ def change_pack_lot(self, picking_batch_id, move_line_id, barcode):
)

return self._response_for_change_pack_lot(
move_line, message=self.msg_store.no_package_or_lot_for_barcode(barcode),
move_line,
message=self.msg_store.no_package_or_lot_for_barcode(barcode),
)

def set_destination_all(self, picking_batch_id, barcode, confirmation=False):
Expand Down
9 changes: 6 additions & 3 deletions shopfloor/services/delivery.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,8 @@ def set_qty_done_line(self, picking_id, move_line_id):
)
return self._response_for_deliver(picking)
return self._response_for_deliver(
picking=picking, message=self.msg_store.record_not_found(),
picking=picking,
message=self.msg_store.record_not_found(),
)

def reset_qty_done_pack(self, picking_id, package_id):
Expand Down Expand Up @@ -474,7 +475,8 @@ def reset_qty_done_line(self, picking_id, move_line_id):
self._reset_lines(line)
return self._response_for_deliver(picking)
return self._response_for_deliver(
picking=picking, message=self.msg_store.record_not_found(),
picking=picking,
message=self.msg_store.record_not_found(),
)

def done(self, picking_id, confirm=False):
Expand Down Expand Up @@ -511,7 +513,8 @@ def done(self, picking_id, confirm=False):
message=self.msg_store.transfer_complete(picking)
)
return self._response_for_confirm_done(
picking, message=self.msg_store.transfer_confirm_done(),
picking,
message=self.msg_store.transfer_confirm_done(),
)


Expand Down
3 changes: 1 addition & 2 deletions shopfloor/services/forms/form_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@


class ShopfloorFormMixin(AbstractComponent):
"""Allow to edit records.
"""
"""Allow to edit records."""

_inherit = "base.shopfloor.service"
_name = "shopfloor.form.mixin"
Expand Down
3 changes: 1 addition & 2 deletions shopfloor/services/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ def _convert_one_record(self, record):
return values

def _get_move_line_counters(self, record):
"""Lookup for all lines per menu item and compute counters.
"""
"""Lookup for all lines per menu item and compute counters."""
# TODO: maybe to be improved w/ raw SQL as this run for each menu item
# and it's called every time the menu is opened/gets refreshed
move_line_search = self.actions_for(
Expand Down
12 changes: 10 additions & 2 deletions shopfloor/services/single_pack_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,22 @@ def _response_for_start(self, message=None, popup=None):
def _response_for_confirm_start(self, package_level, message=None):
data = self._data_after_package_scanned(package_level)
data["confirmation_required"] = True
return self._response(next_state="start", data=data, message=message,)
return self._response(
next_state="start",
data=data,
message=message,
)

def _response_for_scan_location(
self, package_level, message=None, confirmation_required=False
):
data = self._data_after_package_scanned(package_level)
data["confirmation_required"] = confirmation_required
return self._response(next_state="scan_location", data=data, message=message,)
return self._response(
next_state="scan_location",
data=data,
message=message,
)

def _response_for_show_completion_info(self, message=None):
return self._response(next_state="show_completion_info", message=message)
Expand Down
6 changes: 4 additions & 2 deletions shopfloor/tests/test_checkout_cancel_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,13 @@ def test_cancel_line_ok(self):

# and now, we want to drop the new_package
response = self.service.dispatch(
"cancel_line", params={"picking_id": picking.id, "line_id": raw_line.id},
"cancel_line",
params={"picking_id": picking.id, "line_id": raw_line.id},
)

self.assertRecordValues(
raw_line, [{"qty_done": 0, "shopfloor_checkout_done": False}],
raw_line,
[{"qty_done": 0, "shopfloor_checkout_done": False}],
)

self.assert_response(
Expand Down
6 changes: 4 additions & 2 deletions shopfloor/tests/test_checkout_no_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@ def test_no_package_ok(self):
)

self.assertRecordValues(
move_line1, [{"result_package_id": False, "shopfloor_checkout_done": True}],
move_line1,
[{"result_package_id": False, "shopfloor_checkout_done": True}],
)
self.assertRecordValues(
move_line2, [{"result_package_id": False, "shopfloor_checkout_done": True}],
move_line2,
[{"result_package_id": False, "shopfloor_checkout_done": True}],
)
self.assertRecordValues(
move_line3,
Expand Down
28 changes: 21 additions & 7 deletions shopfloor/tests/test_cluster_picking_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ def test_find_batch_in_progress_current_user(self):
# user and in progress (first priority)
data = self.data.picking_batch(self.batch3, with_pickings=True)
self.assert_response(
response, next_state="confirm_start", data=data,
response,
next_state="confirm_start",
data=data,
)

def test_find_batch_assigned(self):
Expand All @@ -78,7 +80,9 @@ def test_find_batch_assigned(self):
# we expect to find batch 2 as it's assigned to the current user
data = self.data.picking_batch(self.batch2, with_pickings=True)
self.assert_response(
response, next_state="confirm_start", data=data,
response,
next_state="confirm_start",
data=data,
)

def test_find_batch_unassigned_draft(self):
Expand All @@ -97,7 +101,9 @@ def test_find_batch_unassigned_draft(self):
# available
data = self.data.picking_batch(self.batch2, with_pickings=True)
self.assert_response(
response, next_state="confirm_start", data=data,
response,
next_state="confirm_start",
data=data,
)

def test_find_batch_not_found(self):
Expand Down Expand Up @@ -153,7 +159,9 @@ def test_select_in_progress_assigned(self):
# we don't care in these tests, 'find_batch' tests them already
data["pickings"] = self.ANY
self.assert_response(
response, next_state="confirm_start", data=data,
response,
next_state="confirm_start",
data=data,
)

def test_select_draft_assigned(self):
Expand All @@ -171,7 +179,9 @@ def test_select_draft_assigned(self):
# we don't care in these tests, 'find_batch' tests them already
data["pickings"] = self.ANY
self.assert_response(
response, next_state="confirm_start", data=data,
response,
next_state="confirm_start",
data=data,
)

def test_select_draft_unassigned(self):
Expand All @@ -188,7 +198,9 @@ def test_select_draft_unassigned(self):
# we don't care in these tests, 'find_batch' tests them already
data["pickings"] = self.ANY
self.assert_response(
response, next_state="confirm_start", data=data,
response,
next_state="confirm_start",
data=data,
)

def test_select_not_exists(self):
Expand Down Expand Up @@ -323,7 +335,9 @@ def test_confirm_start_ok(self):
data["picking"] = self.data.picking(picking)
data["batch"] = self.data.picking_batch(batch)
self.assert_response(
response, data=data, next_state="start_line",
response,
data=data,
next_state="start_line",
)

def test_confirm_start_not_exists(self):
Expand Down
3 changes: 1 addition & 2 deletions shopfloor/tests/test_cluster_picking_skip.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@


class ClusterPickingSkipLineCase(ClusterPickingCommonCase):
"""Tests covering the /skip_line endpoint
"""
"""Tests covering the /skip_line endpoint"""

@classmethod
def setUpClassBaseData(cls, *args, **kwargs):
Expand Down
3 changes: 1 addition & 2 deletions shopfloor/tests/test_cluster_picking_stock_issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@


class ClusterPickingStockIssue(ClusterPickingCommonCase):
"""Tests covering the /stock_issue endpoint
"""
"""Tests covering the /stock_issue endpoint"""

@classmethod
def setUpClassBaseData(cls, *args, **kwargs):
Expand Down
Loading

0 comments on commit 2c4e01c

Please sign in to comment.