mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
more style fixes
This commit is contained in:
parent
8a163237ac
commit
377a416cbc
@ -26,7 +26,7 @@ from part.models import Part
|
|||||||
from plugin.serializers import MetadataSerializer
|
from plugin.serializers import MetadataSerializer
|
||||||
from users.models import ApiToken
|
from users.models import ApiToken
|
||||||
|
|
||||||
from .email import is_email_configured
|
from .helpers_email import is_email_configured
|
||||||
from .mixins import ListAPI, RetrieveUpdateAPI
|
from .mixins import ListAPI, RetrieveUpdateAPI
|
||||||
from .status import check_system_health, is_worker_running
|
from .status import check_system_health, is_worker_running
|
||||||
from .version import inventreeApiText
|
from .version import inventreeApiText
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
"""Provides extra global data to all templates."""
|
"""Provides extra global data to all templates."""
|
||||||
|
|
||||||
import InvenTree.email
|
import InvenTree.helpers_email
|
||||||
import InvenTree.status
|
import InvenTree.status
|
||||||
from generic.states import StatusCode
|
from generic.states import StatusCode
|
||||||
from InvenTree.helpers import inheritors
|
from InvenTree.helpers import inheritors
|
||||||
@ -25,7 +25,7 @@ def health_status(request):
|
|||||||
|
|
||||||
status = {
|
status = {
|
||||||
'django_q_running': InvenTree.status.is_worker_running(),
|
'django_q_running': InvenTree.status.is_worker_running(),
|
||||||
'email_configured': InvenTree.email.is_email_configured(),
|
'email_configured': InvenTree.helpers_email.is_email_configured(),
|
||||||
}
|
}
|
||||||
|
|
||||||
# The following keys are required to denote system health
|
# The following keys are required to denote system health
|
||||||
|
@ -9,7 +9,7 @@ from django.utils.translation import gettext_lazy as _
|
|||||||
from django_q.models import Success
|
from django_q.models import Success
|
||||||
from django_q.status import Stat
|
from django_q.status import Stat
|
||||||
|
|
||||||
import InvenTree.email
|
import InvenTree.helpers_email
|
||||||
import InvenTree.ready
|
import InvenTree.ready
|
||||||
|
|
||||||
logger = logging.getLogger('inventree')
|
logger = logging.getLogger('inventree')
|
||||||
@ -64,7 +64,7 @@ def check_system_health(**kwargs):
|
|||||||
result = False
|
result = False
|
||||||
logger.warning(_('Background worker check failed'))
|
logger.warning(_('Background worker check failed'))
|
||||||
|
|
||||||
if not InvenTree.email.is_email_configured(): # pragma: no cover
|
if not InvenTree.helpers_email.is_email_configured(): # pragma: no cover
|
||||||
result = False
|
result = False
|
||||||
logger.warning(_('Email backend not configured'))
|
logger.warning(_('Email backend not configured'))
|
||||||
|
|
||||||
|
@ -1,34 +1,31 @@
|
|||||||
"""Background task definitions for the BuildOrder app"""
|
"""Background task definitions for the BuildOrder app."""
|
||||||
|
|
||||||
|
import logging
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
import logging
|
|
||||||
|
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.utils.translation import gettext_lazy as _
|
|
||||||
from django.template.loader import render_to_string
|
from django.template.loader import render_to_string
|
||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from allauth.account.models import EmailAddress
|
from allauth.account.models import EmailAddress
|
||||||
|
|
||||||
from plugin.events import trigger_event
|
|
||||||
import common.notifications
|
|
||||||
import build.models
|
import build.models
|
||||||
import InvenTree.email
|
import common.notifications
|
||||||
import InvenTree.helpers
|
import InvenTree.helpers
|
||||||
|
import InvenTree.helpers_email
|
||||||
import InvenTree.helpers_model
|
import InvenTree.helpers_model
|
||||||
import InvenTree.tasks
|
import InvenTree.tasks
|
||||||
from InvenTree.ready import isImportingData
|
|
||||||
from build.status_codes import BuildStatusGroups
|
|
||||||
|
|
||||||
import part.models as part_models
|
import part.models as part_models
|
||||||
|
from build.status_codes import BuildStatusGroups
|
||||||
|
from InvenTree.ready import isImportingData
|
||||||
|
from plugin.events import trigger_event
|
||||||
|
|
||||||
logger = logging.getLogger('inventree')
|
logger = logging.getLogger('inventree')
|
||||||
|
|
||||||
|
|
||||||
def auto_allocate_build(build_id: int, **kwargs):
|
def auto_allocate_build(build_id: int, **kwargs):
|
||||||
"""Run auto-allocation for a specified BuildOrder."""
|
"""Run auto-allocation for a specified BuildOrder."""
|
||||||
|
|
||||||
build_order = build.models.Build.objects.filter(pk=build_id).first()
|
build_order = build.models.Build.objects.filter(pk=build_id).first()
|
||||||
|
|
||||||
if not build_order:
|
if not build_order:
|
||||||
@ -40,7 +37,6 @@ def auto_allocate_build(build_id: int, **kwargs):
|
|||||||
|
|
||||||
def complete_build_allocations(build_id: int, user_id: int):
|
def complete_build_allocations(build_id: int, user_id: int):
|
||||||
"""Complete build allocations for a specified BuildOrder."""
|
"""Complete build allocations for a specified BuildOrder."""
|
||||||
|
|
||||||
build_order = build.models.Build.objects.filter(pk=build_id).first()
|
build_order = build.models.Build.objects.filter(pk=build_id).first()
|
||||||
|
|
||||||
if user_id:
|
if user_id:
|
||||||
@ -185,11 +181,11 @@ def check_build_stock(build: build.models.Build):
|
|||||||
|
|
||||||
recipients = emails.values_list('email', flat=True)
|
recipients = emails.values_list('email', flat=True)
|
||||||
|
|
||||||
InvenTree.email.send_email(subject, '', recipients, html_message=html_message)
|
InvenTree.helpers_email.send_email(subject, '', recipients, html_message=html_message)
|
||||||
|
|
||||||
|
|
||||||
def notify_overdue_build_order(bo: build.models.Build):
|
def notify_overdue_build_order(bo: build.models.Build):
|
||||||
"""Notify appropriate users that a Build has just become 'overdue'"""
|
"""Notify appropriate users that a Build has just become 'overdue'."""
|
||||||
targets = []
|
targets = []
|
||||||
|
|
||||||
if bo.issued_by:
|
if bo.issued_by:
|
||||||
@ -229,7 +225,7 @@ def notify_overdue_build_order(bo: build.models.Build):
|
|||||||
|
|
||||||
@InvenTree.tasks.scheduled_task(InvenTree.tasks.ScheduledTask.DAILY)
|
@InvenTree.tasks.scheduled_task(InvenTree.tasks.ScheduledTask.DAILY)
|
||||||
def check_overdue_build_orders():
|
def check_overdue_build_orders():
|
||||||
"""Check if any outstanding BuildOrders have just become overdue
|
"""Check if any outstanding BuildOrders have just become overdue.
|
||||||
|
|
||||||
- This check is performed daily
|
- This check is performed daily
|
||||||
- Look at the 'target_date' of any outstanding BuildOrder objects
|
- Look at the 'target_date' of any outstanding BuildOrder objects
|
||||||
|
@ -4,7 +4,7 @@ import enum
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
||||||
class BaseEnum(enum.IntEnum):
|
class BaseEnum(enum.IntEnum): # noqa: PLW1641
|
||||||
"""An `Enum` capabile of having its members have docstrings.
|
"""An `Enum` capabile of having its members have docstrings.
|
||||||
|
|
||||||
Based on https://stackoverflow.com/questions/19330460/how-do-i-put-docstrings-on-enums
|
Based on https://stackoverflow.com/questions/19330460/how-do-i-put-docstrings-on-enums
|
||||||
|
@ -7,8 +7,8 @@ import requests
|
|||||||
from allauth.account.models import EmailAddress
|
from allauth.account.models import EmailAddress
|
||||||
|
|
||||||
import common.models
|
import common.models
|
||||||
import InvenTree.email
|
|
||||||
import InvenTree.helpers
|
import InvenTree.helpers
|
||||||
|
import InvenTree.helpers_email
|
||||||
import InvenTree.tasks
|
import InvenTree.tasks
|
||||||
from plugin import InvenTreePlugin, registry
|
from plugin import InvenTreePlugin, registry
|
||||||
from plugin.mixins import BulkNotificationMethod, SettingsContentMixin, SettingsMixin
|
from plugin.mixins import BulkNotificationMethod, SettingsContentMixin, SettingsMixin
|
||||||
@ -116,7 +116,9 @@ class InvenTreeCoreNotificationsPlugin(
|
|||||||
if instance_title:
|
if instance_title:
|
||||||
subject = f'[{instance_title}] {subject}'
|
subject = f'[{instance_title}] {subject}'
|
||||||
|
|
||||||
InvenTree.email.send_email(subject, '', targets, html_message=html_message)
|
InvenTree.helpers_email.send_email(
|
||||||
|
subject, '', targets, html_message=html_message
|
||||||
|
)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user