Skip to content

Commit

Permalink
chore: black / prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
agritheory committed Jul 26, 2024
1 parent ecd9f49 commit 2bdbd5c
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 19 deletions.
4 changes: 0 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,8 @@ repos:
- id: flake8
additional_dependencies: ['flake8-bugbear']


- repo: https://github.com/agritheory/test_utils
rev: v0.14.1

- repo: https://github.com/agritheory/test_utils
rev: v0.14.0
hooks:
- id: update_pre_commit_config
- id: mypy
Expand Down
8 changes: 6 additions & 2 deletions inventory_tools/customize.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@

def load_customizations():
customizations_directory = (
Path().cwd().parent / "apps" / "inventory_tools" / "inventory_tools" / "inventory_tools" / "custom"

Path().cwd().parent
/ "apps"
/ "inventory_tools"
/ "inventory_tools"
/ "inventory_tools"
/ "custom"
)
files = list(customizations_directory.glob("**/*.json"))
for file in files:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"faceted_search_tab",
"show_on_website",
"show_in_listview"

],
"fields": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from erpnext.manufacturing.doctype.work_order.work_order import get_default_warehouse



class InventoryToolsProductionPlan(ProductionPlan):
@frappe.whitelist()
def make_work_order(self):
Expand Down
8 changes: 4 additions & 4 deletions inventory_tools/inventory_tools/overrides/uom.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@

@frappe.whitelist()
def uom_restricted_query(doctype, txt, searchfield, start, page_len, filters):
if 'company' in filters:
company = filters.pop('company')
if "company" in filters:
company = filters.pop("company")
else:
company = frappe.defaults.get_defaults().get("company")

if frappe.get_cached_value("Inventory Tools Settings", company, "enforce_uoms"):
return frappe.get_all(
'UOM Conversion Detail',
"UOM Conversion Detail",
filters=filters,
fields=["uom", "conversion_factor"],
limit_start=start,
limit_page_length=page_len,
as_list=True,
)
)
if "parent" in filters:
filters.pop("parent")
return execute(
Expand Down
2 changes: 1 addition & 1 deletion inventory_tools/inventory_tools/overrides/workstation.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def get_alternative_workstations(doctype, txt, searchfield, start, page_len, fil
"Workstation", default_workstation_name, searchfields, as_dict=True
)
if default_workstation_name not in [row[0] for row in workstation]:
field_values = ','.join([v for k, v in default_workstation_fields[0].items() if k != 'name'])
field_values = ",".join([v for k, v in default_workstation_fields[0].items() if k != "name"])
_default = tuple(
[
default_workstation_fields[0].name,
Expand Down
4 changes: 3 additions & 1 deletion inventory_tools/tests/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,9 @@ def setup_manufacturing_settings(settings):
)
frappe.set_value("Inventory Tools Settings", settings.company, "create_purchase_orders", 0)
frappe.set_value("Inventory Tools Settings", settings.company, "enforce_uoms", 1)
frappe.set_value("Inventory Tools Settings", settings.company, "allow_alternative_workstations", 1)
frappe.set_value(
"Inventory Tools Settings", settings.company, "allow_alternative_workstations", 1
)
frappe.set_value("Inventory Tools Settings", settings.company, "create_purchase_orders", 0)
frappe.set_value(
"Inventory Tools Settings", settings.company, "overproduction_percentage_for_work_order", 50
Expand Down
5 changes: 4 additions & 1 deletion inventory_tools/tests/test_overproduction.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,10 @@ def test_validate_job_card():
"Job Card", {"work_order": work_order.name, "operation": work_order.operations[0].operation}
)
jc.delete()
start_time = frappe.get_value("Job Card Time Log", {"docstatus": 1}, "MAX(to_time) AS to_time") or get_datetime()
start_time = (
frappe.get_value("Job Card Time Log", {"docstatus": 1}, "MAX(to_time) AS to_time")
or get_datetime()
)
job_card = create_job_card(work_order, work_order.operations[0].as_dict(), auto_create=True)
batch_size, total_operation_time = frappe.get_value(
"Operation", job_card.operation, ["batch_size", "total_operation_time"]
Expand Down
6 changes: 2 additions & 4 deletions inventory_tools/tests/test_uom.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,11 @@ def test_uom_enforcement_validation():
@pytest.mark.order(41)
def test_uom_enforcement_query():
inventory_tools_settings = frappe.get_cached_doc(
"Inventory Tools Settings", 'Ambrosia Pie Company'
"Inventory Tools Settings", "Ambrosia Pie Company"
)
inventory_tools_settings.enforce_uoms = True
inventory_tools_settings.save()
inventory_tools_settings = frappe.get_cached_doc(
"Inventory Tools Settings", 'Chelsea Fruit Co'
)
inventory_tools_settings = frappe.get_cached_doc("Inventory Tools Settings", "Chelsea Fruit Co")
inventory_tools_settings.enforce_uoms = True
inventory_tools_settings.save()
response = frappe.call(
Expand Down

0 comments on commit 2bdbd5c

Please sign in to comment.