mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Do not auto-fill target_date for line items (#4275)
* Improve help_text for target_date field on lineitem model(s) * Don't auto-fill target_date for purchase order line item(s) * Refactor function to create new sales order line item * Add migration file * JS linting
This commit is contained in:
parent
ed9f93a2d6
commit
50eb81f495
33
InvenTree/order/migrations/0077_auto_20230129_0154.py
Normal file
33
InvenTree/order/migrations/0077_auto_20230129_0154.py
Normal file
@ -0,0 +1,33 @@
|
||||
# Generated by Django 3.2.16 on 2023-01-29 01:54
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('order', '0076_auto_20221111_0153'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='purchaseorderextraline',
|
||||
name='target_date',
|
||||
field=models.DateField(blank=True, help_text='Target date for this line item (leave blank to use the target date from the order)', null=True, verbose_name='Target Date'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='purchaseorderlineitem',
|
||||
name='target_date',
|
||||
field=models.DateField(blank=True, help_text='Target date for this line item (leave blank to use the target date from the order)', null=True, verbose_name='Target Date'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='salesorderextraline',
|
||||
name='target_date',
|
||||
field=models.DateField(blank=True, help_text='Target date for this line item (leave blank to use the target date from the order)', null=True, verbose_name='Target Date'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='salesorderlineitem',
|
||||
name='target_date',
|
||||
field=models.DateField(blank=True, help_text='Target date for this line item (leave blank to use the target date from the order)', null=True, verbose_name='Target Date'),
|
||||
),
|
||||
]
|
@ -945,7 +945,7 @@ class OrderLineItem(models.Model):
|
||||
target_date = models.DateField(
|
||||
blank=True, null=True,
|
||||
verbose_name=_('Target Date'),
|
||||
help_text=_('Target shipping date for this line item'),
|
||||
help_text=_('Target date for this line item (leave blank to use the target date from the order)'),
|
||||
)
|
||||
|
||||
|
||||
|
@ -179,9 +179,6 @@ $('#new-po-line').click(function() {
|
||||
currency: '{{ order.supplier.currency }}',
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if order.target_date %}
|
||||
target_date: '{{ order.target_date|date:'Y-m-d' }}',
|
||||
{% endif %}
|
||||
onSuccess: function() {
|
||||
$('#po-line-table').bootstrapTable('refresh');
|
||||
}
|
||||
|
@ -249,21 +249,16 @@
|
||||
});
|
||||
|
||||
$("#new-so-line").click(function() {
|
||||
|
||||
var fields = soLineItemFields({
|
||||
createSalesOrderLineItem({
|
||||
order: {{ order.pk }},
|
||||
{% if order.target_date %}
|
||||
target_date: '{{ order.target_date|date:'Y-m-d' }}',
|
||||
{% endif %}
|
||||
});
|
||||
|
||||
constructForm('{% url "api-so-line-list" %}', {
|
||||
fields: fields,
|
||||
method: 'POST',
|
||||
title: '{% trans "Add Line Item" %}',
|
||||
onSuccess: function() {
|
||||
$("#so-lines-table").bootstrapTable("refresh");
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
// Create a new SalesOrderLine item
|
||||
var fields = soLineItemFields({
|
||||
order: {{ order.pk }},
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
createPurchaseOrder,
|
||||
createPurchaseOrderLineItem,
|
||||
createSalesOrder,
|
||||
createSalesOrderLineItem,
|
||||
createSalesOrderShipment,
|
||||
duplicatePurchaseOrder,
|
||||
editPurchaseOrder,
|
||||
@ -519,7 +520,9 @@ function createSalesOrderShipment(options={}) {
|
||||
}
|
||||
|
||||
|
||||
// Create a new SalesOrder
|
||||
/*
|
||||
* Create a new SalesOrder
|
||||
*/
|
||||
function createSalesOrder(options={}) {
|
||||
|
||||
constructForm('{% url "api-so-list" %}', {
|
||||
@ -561,6 +564,24 @@ function createSalesOrder(options={}) {
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Launch a modal form to create a new SalesOrderLineItem
|
||||
*/
|
||||
function createSalesOrderLineItem(options={}) {
|
||||
|
||||
var fields = soLineItemFields(options);
|
||||
|
||||
constructForm('{% url "api-so-line-list" %}', {
|
||||
fields: fields,
|
||||
method: 'POST',
|
||||
title: '{% trans "Add Line Item" %}',
|
||||
onSuccess: function(response) {
|
||||
handleFormSuccess(response, options);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Construct a set of fields for a purchase order form
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user