Initialize target date for new PO line and SO line (#4170)

* Initialize date for new PO line or SO line

Set new PO/SO line initial date to that of the PO/SO it belongs to.

* Changed date formatting to render_date  template tag

* Reverted the change to format the date with the render_date template tag
This commit is contained in:
bloemp 2023-01-09 23:07:54 +01:00 committed by GitHub
parent 385ed8277d
commit 49630e295d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 0 deletions

View File

@ -179,6 +179,9 @@ $('#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');
}

View File

@ -252,6 +252,9 @@
var fields = soLineItemFields({
order: {{ order.pk }},
{% if order.target_date %}
target_date: '{{ order.target_date|date:'Y-m-d' }}',
{% endif %}
});
constructForm('{% url "api-so-line-list" %}', {

View File

@ -720,6 +720,7 @@ function createPurchaseOrderLineItem(order, options={}) {
order: order,
supplier: options.supplier,
currency: options.currency,
target_date: options.target_date,
});
constructForm('{% url "api-po-line-list" %}', {
@ -753,6 +754,10 @@ function soLineItemFields(options={}) {
fields.order.value = options.order;
}
if (options.target_date) {
fields.target_date.value = options.target_date;
}
return fields;
}
@ -905,6 +910,10 @@ function poLineItemFields(options={}) {
fields.purchase_price_currency.value = options.currency;
}
if (options.target_date) {
fields.target_date.value = options.target_date;
}
return fields;
}