mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-17 12:35:46 +00:00
Add new setting PURCHASEORDER_AUTO_COMPLETE (#6245)
* Add new setting PURCHASEORDER_AUTO_COMPLETE - Controls whether purchase orders are automatically closed - Default to True * Tweak setting component
This commit is contained in:
@ -1752,6 +1752,14 @@ class InvenTreeSetting(BaseInvenTreeSetting):
|
||||
'default': False,
|
||||
'validator': bool,
|
||||
},
|
||||
'PURCHASEORDER_AUTO_COMPLETE': {
|
||||
'name': _('Auto Complete Purchase Orders'),
|
||||
'description': _(
|
||||
'Automatically mark purchase orders as complete when all line items are received'
|
||||
),
|
||||
'default': True,
|
||||
'validator': bool,
|
||||
},
|
||||
# login / SSO
|
||||
'LOGIN_ENABLE_PWD_FORGOT': {
|
||||
'name': _('Enable password forgot'),
|
||||
|
@ -779,8 +779,11 @@ class PurchaseOrder(TotalPriceMixin, Order):
|
||||
|
||||
# Has this order been completed?
|
||||
if len(self.pending_line_items()) == 0:
|
||||
self.received_by = user
|
||||
self.complete_order() # This will save the model
|
||||
if common_models.InvenTreeSetting.get_setting(
|
||||
'PURCHASEORDER_AUTO_COMPLETE', True
|
||||
):
|
||||
self.received_by = user
|
||||
self.complete_order() # This will save the model
|
||||
|
||||
# Issue a notification to interested parties, that this order has been "updated"
|
||||
notify_responsible(
|
||||
|
@ -12,6 +12,7 @@
|
||||
<tbody>
|
||||
{% include "InvenTree/settings/setting.html" with key="PURCHASEORDER_REFERENCE_PATTERN" %}
|
||||
{% include "InvenTree/settings/setting.html" with key="PURCHASEORDER_EDIT_COMPLETED_ORDERS" icon='fa-edit' %}
|
||||
{% include "InvenTree/settings/setting.html" with key="PURCHASEORDER_AUTO_COMPLETE" icon='fa-check-circle' %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endblock content %}
|
||||
|
Reference in New Issue
Block a user