mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +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:
parent
3511450b3d
commit
576bef5d82
@ -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 %}
|
||||
|
@ -172,8 +172,8 @@ export function SettingItem({
|
||||
|
||||
return (
|
||||
<Paper style={style}>
|
||||
<Group position="apart" p="10">
|
||||
<Stack spacing="2">
|
||||
<Group position="apart" p="3">
|
||||
<Stack spacing="2" p="4px">
|
||||
<Text>{setting.name}</Text>
|
||||
<Text size="xs">{setting.description}</Text>
|
||||
</Stack>
|
||||
|
@ -238,7 +238,8 @@ export default function SystemSettings() {
|
||||
<GlobalSettingList
|
||||
keys={[
|
||||
'PURCHASEORDER_REFERENCE_PATTERN',
|
||||
'PURCHASEORDER_EDIT_COMPLETED_ORDERS'
|
||||
'PURCHASEORDER_EDIT_COMPLETED_ORDERS',
|
||||
'PURCHASEORDER_AUTO_COMPLETE'
|
||||
]}
|
||||
/>
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user