mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +00:00
Added order cancel notifications (#5912)
* Squashed commit of the following: commit 5e8ea099068475fd257d8c172348dc6f3edf9bcf Author: Matthias Mair <code@mjmair.com> Date: Tue Oct 24 09:22:38 2023 +0200 Update ui_plattform.spec.ts commit 49da3312beff7fd6837ea741e621df221c445d19 Author: Matthias Mair <code@mjmair.com> Date: Tue Oct 24 07:56:25 2023 +0200 more logging commit 5337be4c3990051b805a6fce2e79ca4030b4afe5 Author: Matthias Mair <code@mjmair.com> Date: Tue Oct 24 07:56:11 2023 +0200 added filter method for undefined settings that overwrite defaults commit 5df8a0b3e77cd5dcf04c39ad7638ac845df75e4c Author: Matthias Mair <code@mjmair.com> Date: Tue Oct 24 03:05:06 2023 +0200 you do not need to string a string commit 0650d3b3a0132889c2a76de38db38224e974d205 Author: Matthias Mair <code@mjmair.com> Date: Tue Oct 24 03:04:34 2023 +0200 fix things that were borken for no good reason commit a40dbfd1364cf01465037350184f59d2a2a8afab Author: Matthias Mair <code@mjmair.com> Date: Tue Oct 24 02:39:34 2023 +0200 reduce unneeded blocking timeouts commit bf9046a5361ae919e70662e717d6156434b6fe43 Author: Matthias Mair <code@mjmair.com> Date: Tue Oct 24 02:34:10 2023 +0200 catch server fetching errors commit aa01e67e8c8e789fdf755ac4481e730fe5ea4183 Author: Matthias Mair <code@mjmair.com> Date: Tue Oct 24 02:33:29 2023 +0200 move init as things are now plugged together different commit 290c33bd3125d50779497d6fc5981d5813b58f5d Author: Matthias Mair <code@mjmair.com> Date: Tue Oct 24 01:49:32 2023 +0200 do not log a failed automatic login try - why would you? * Added notifications for cancled orders * cleanup submodules * added notification to build * move import?
This commit is contained in:
parent
247ad4dcf9
commit
5be6bc8940
@ -34,7 +34,7 @@ import InvenTree.ready
|
|||||||
import InvenTree.tasks
|
import InvenTree.tasks
|
||||||
|
|
||||||
import common.models
|
import common.models
|
||||||
from common.notifications import trigger_notification
|
from common.notifications import trigger_notification, InvenTreeNotificationBodies
|
||||||
from plugin.events import trigger_event
|
from plugin.events import trigger_event
|
||||||
|
|
||||||
import part.models
|
import part.models
|
||||||
@ -605,6 +605,14 @@ class Build(MPTTModel, InvenTree.mixins.DiffMixin, InvenTree.models.InvenTreeBar
|
|||||||
self.status = BuildStatus.CANCELLED.value
|
self.status = BuildStatus.CANCELLED.value
|
||||||
self.save()
|
self.save()
|
||||||
|
|
||||||
|
# Notify users that the order has been canceled
|
||||||
|
InvenTree.helpers_model.notify_responsible(
|
||||||
|
self,
|
||||||
|
Build,
|
||||||
|
exclude=self.issued_by,
|
||||||
|
content=InvenTreeNotificationBodies.OrderCanceled
|
||||||
|
)
|
||||||
|
|
||||||
trigger_event('build.cancelled', id=self.pk)
|
trigger_event('build.cancelled', id=self.pk)
|
||||||
|
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
|
@ -294,6 +294,14 @@ class InvenTreeNotificationBodies:
|
|||||||
)
|
)
|
||||||
"""Send when a new order (build, sale or purchase) was created."""
|
"""Send when a new order (build, sale or purchase) was created."""
|
||||||
|
|
||||||
|
OrderCanceled = NotificationBody(
|
||||||
|
name=_("{verbose_name} canceled"),
|
||||||
|
slug='{app_label}.canceled_{model_name}',
|
||||||
|
message=_("A order that is assigned to you was canceled"),
|
||||||
|
template='email/canceled_order_assigned.html',
|
||||||
|
)
|
||||||
|
"""Send when a order (sale, return or purchase) was canceled."""
|
||||||
|
|
||||||
ItemsReceived = NotificationBody(
|
ItemsReceived = NotificationBody(
|
||||||
name=_("Items Received"),
|
name=_("Items Received"),
|
||||||
slug='purchase_order.items_received',
|
slug='purchase_order.items_received',
|
||||||
|
@ -549,6 +549,14 @@ class PurchaseOrder(TotalPriceMixin, Order):
|
|||||||
|
|
||||||
trigger_event('purchaseorder.cancelled', id=self.pk)
|
trigger_event('purchaseorder.cancelled', id=self.pk)
|
||||||
|
|
||||||
|
# Notify users that the order has been canceled
|
||||||
|
notify_responsible(
|
||||||
|
self,
|
||||||
|
PurchaseOrder,
|
||||||
|
exclude=self.created_by,
|
||||||
|
content=InvenTreeNotificationBodies.OrderCanceled
|
||||||
|
)
|
||||||
|
|
||||||
def pending_line_items(self):
|
def pending_line_items(self):
|
||||||
"""Return a list of pending line items for this order.
|
"""Return a list of pending line items for this order.
|
||||||
|
|
||||||
@ -935,6 +943,14 @@ class SalesOrder(TotalPriceMixin, Order):
|
|||||||
|
|
||||||
trigger_event('salesorder.cancelled', id=self.pk)
|
trigger_event('salesorder.cancelled', id=self.pk)
|
||||||
|
|
||||||
|
# Notify users that the order has been canceled
|
||||||
|
notify_responsible(
|
||||||
|
self,
|
||||||
|
SalesOrder,
|
||||||
|
exclude=self.created_by,
|
||||||
|
content=InvenTreeNotificationBodies.OrderCanceled
|
||||||
|
)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -1790,6 +1806,14 @@ class ReturnOrder(TotalPriceMixin, Order):
|
|||||||
|
|
||||||
trigger_event('returnorder.cancelled', id=self.pk)
|
trigger_event('returnorder.cancelled', id=self.pk)
|
||||||
|
|
||||||
|
# Notify users that the order has been canceled
|
||||||
|
notify_responsible(
|
||||||
|
self,
|
||||||
|
ReturnOrder,
|
||||||
|
exclude=self.created_by,
|
||||||
|
content=InvenTreeNotificationBodies.OrderCanceled
|
||||||
|
)
|
||||||
|
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
def complete_order(self):
|
def complete_order(self):
|
||||||
"""Complete this ReturnOrder (if not already completed)"""
|
"""Complete this ReturnOrder (if not already completed)"""
|
||||||
|
11
InvenTree/templates/email/canceled_order_assigned.html
Normal file
11
InvenTree/templates/email/canceled_order_assigned.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{% extends "email/email.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
{% load inventree_extras %}
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
{{ message }}
|
||||||
|
{% if link %}
|
||||||
|
<p>{% trans "Click on the following link to view this order" %}: <a href="{{ link }}">{{ link }}</a></p>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock title %}
|
Loading…
x
Reference in New Issue
Block a user