mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 13:05:42 +00:00
Adds notification when items are received against a purcahse order (#3259)
This commit is contained in:
@ -296,6 +296,13 @@ class InvenTreeNotificationBodies:
|
|||||||
)
|
)
|
||||||
"""Send when a new order (build, sale or purchase) was created."""
|
"""Send when a new order (build, sale or purchase) was created."""
|
||||||
|
|
||||||
|
ItemsReceived = NotificationBody(
|
||||||
|
name=_("Items Received"),
|
||||||
|
slug='purchase_order.items_received',
|
||||||
|
message=_('Items have been received against a purchase order'),
|
||||||
|
template='email/purchase_order_received.html',
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def trigger_notification(obj, category=None, obj_ref='pk', **kwargs):
|
def trigger_notification(obj, category=None, obj_ref='pk', **kwargs):
|
||||||
"""Send out a notification."""
|
"""Send out a notification."""
|
||||||
|
@ -24,6 +24,7 @@ from mptt.models import TreeForeignKey
|
|||||||
|
|
||||||
import InvenTree.helpers
|
import InvenTree.helpers
|
||||||
import InvenTree.ready
|
import InvenTree.ready
|
||||||
|
from common.notifications import InvenTreeNotificationBodies
|
||||||
from common.settings import currency_code_default
|
from common.settings import currency_code_default
|
||||||
from company.models import Company, SupplierPart
|
from company.models import Company, SupplierPart
|
||||||
from InvenTree.exceptions import log_error
|
from InvenTree.exceptions import log_error
|
||||||
@ -560,6 +561,14 @@ class PurchaseOrder(Order):
|
|||||||
self.received_by = user
|
self.received_by = user
|
||||||
self.complete_order() # This will save the model
|
self.complete_order() # This will save the model
|
||||||
|
|
||||||
|
# Issue a notification to interested parties, that this order has been "updated"
|
||||||
|
notify_responsible(
|
||||||
|
self,
|
||||||
|
PurchaseOrder,
|
||||||
|
exclude=user,
|
||||||
|
content=InvenTreeNotificationBodies.ItemsReceived,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@receiver(post_save, sender=PurchaseOrder, dispatch_uid='purchase_order_post_save')
|
@receiver(post_save, sender=PurchaseOrder, dispatch_uid='purchase_order_post_save')
|
||||||
def after_save_purchase_order(sender, instance: PurchaseOrder, created: bool, **kwargs):
|
def after_save_purchase_order(sender, instance: PurchaseOrder, created: bool, **kwargs):
|
||||||
|
11
InvenTree/templates/email/purchase_order_received.html
Normal file
11
InvenTree/templates/email/purchase_order_received.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 %}
|
Reference in New Issue
Block a user