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,
|
'default': False,
|
||||||
'validator': bool,
|
'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 / SSO
|
||||||
'LOGIN_ENABLE_PWD_FORGOT': {
|
'LOGIN_ENABLE_PWD_FORGOT': {
|
||||||
'name': _('Enable password forgot'),
|
'name': _('Enable password forgot'),
|
||||||
|
@ -779,8 +779,11 @@ class PurchaseOrder(TotalPriceMixin, Order):
|
|||||||
|
|
||||||
# Has this order been completed?
|
# Has this order been completed?
|
||||||
if len(self.pending_line_items()) == 0:
|
if len(self.pending_line_items()) == 0:
|
||||||
self.received_by = user
|
if common_models.InvenTreeSetting.get_setting(
|
||||||
self.complete_order() # This will save the model
|
'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"
|
# Issue a notification to interested parties, that this order has been "updated"
|
||||||
notify_responsible(
|
notify_responsible(
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
{% include "InvenTree/settings/setting.html" with key="PURCHASEORDER_REFERENCE_PATTERN" %}
|
{% 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_EDIT_COMPLETED_ORDERS" icon='fa-edit' %}
|
||||||
|
{% include "InvenTree/settings/setting.html" with key="PURCHASEORDER_AUTO_COMPLETE" icon='fa-check-circle' %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
@ -172,8 +172,8 @@ export function SettingItem({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Paper style={style}>
|
<Paper style={style}>
|
||||||
<Group position="apart" p="10">
|
<Group position="apart" p="3">
|
||||||
<Stack spacing="2">
|
<Stack spacing="2" p="4px">
|
||||||
<Text>{setting.name}</Text>
|
<Text>{setting.name}</Text>
|
||||||
<Text size="xs">{setting.description}</Text>
|
<Text size="xs">{setting.description}</Text>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
@ -238,7 +238,8 @@ export default function SystemSettings() {
|
|||||||
<GlobalSettingList
|
<GlobalSettingList
|
||||||
keys={[
|
keys={[
|
||||||
'PURCHASEORDER_REFERENCE_PATTERN',
|
'PURCHASEORDER_REFERENCE_PATTERN',
|
||||||
'PURCHASEORDER_EDIT_COMPLETED_ORDERS'
|
'PURCHASEORDER_EDIT_COMPLETED_ORDERS',
|
||||||
|
'PURCHASEORDER_AUTO_COMPLETE'
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user