mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Line item links (#4570)
* Add 'link' field to order line and extra line models * Update serializers * Update front end forms and tables
This commit is contained in:
parent
6ebe8c61c5
commit
1622684c22
39
InvenTree/order/migrations/0088_auto_20230403_1402.py
Normal file
39
InvenTree/order/migrations/0088_auto_20230403_1402.py
Normal file
@ -0,0 +1,39 @@
|
||||
# Generated by Django 3.2.18 on 2023-04-03 14:02
|
||||
|
||||
import InvenTree.fields
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('order', '0087_alter_salesorder_status'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='purchaseorderextraline',
|
||||
name='link',
|
||||
field=InvenTree.fields.InvenTreeURLField(blank=True, help_text='Link to external page', verbose_name='Link'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='purchaseorderlineitem',
|
||||
name='link',
|
||||
field=InvenTree.fields.InvenTreeURLField(blank=True, help_text='Link to external page', verbose_name='Link'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='returnorderextraline',
|
||||
name='link',
|
||||
field=InvenTree.fields.InvenTreeURLField(blank=True, help_text='Link to external page', verbose_name='Link'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='salesorderextraline',
|
||||
name='link',
|
||||
field=InvenTree.fields.InvenTreeURLField(blank=True, help_text='Link to external page', verbose_name='Link'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='salesorderlineitem',
|
||||
name='link',
|
||||
field=InvenTree.fields.InvenTreeURLField(blank=True, help_text='Link to external page', verbose_name='Link'),
|
||||
),
|
||||
]
|
@ -1050,6 +1050,12 @@ class OrderLineItem(MetadataMixin, models.Model):
|
||||
|
||||
notes = models.CharField(max_length=500, blank=True, verbose_name=_('Notes'), help_text=_('Line item notes'))
|
||||
|
||||
link = InvenTreeURLField(
|
||||
blank=True,
|
||||
verbose_name=_('Link'),
|
||||
help_text=_('Link to external page')
|
||||
)
|
||||
|
||||
target_date = models.DateField(
|
||||
blank=True, null=True,
|
||||
verbose_name=_('Target Date'),
|
||||
@ -1876,8 +1882,6 @@ class ReturnOrderLineItem(OrderLineItem):
|
||||
help_text=_('Cost associated with return or repair for this line item'),
|
||||
)
|
||||
|
||||
link = InvenTreeURLField(blank=True, verbose_name=_('Link'), help_text=_('Link to external page'))
|
||||
|
||||
|
||||
class ReturnOrderExtraLine(OrderExtraLine):
|
||||
"""Model for a single ExtraLine in a ReturnOrder"""
|
||||
|
@ -139,6 +139,7 @@ class AbstractExtraLineMeta:
|
||||
'order_detail',
|
||||
'price',
|
||||
'price_currency',
|
||||
'link',
|
||||
]
|
||||
|
||||
|
||||
@ -304,6 +305,7 @@ class PurchaseOrderLineItemSerializer(InvenTreeModelSerializer):
|
||||
'destination_detail',
|
||||
'target_date',
|
||||
'total_price',
|
||||
'link',
|
||||
]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
@ -840,6 +842,7 @@ class SalesOrderLineItemSerializer(InvenTreeModelSerializer):
|
||||
'sale_price_currency',
|
||||
'shipped',
|
||||
'target_date',
|
||||
'link',
|
||||
]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
@ -1614,6 +1617,7 @@ class ReturnOrderLineItemSerializer(InvenTreeModelSerializer):
|
||||
'reference',
|
||||
'notes',
|
||||
'target_date',
|
||||
'link',
|
||||
]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -40,6 +40,9 @@ function extraLineFields(options={}) {
|
||||
notes: {
|
||||
icon: 'fa-sticky-note',
|
||||
},
|
||||
link: {
|
||||
icon: 'fa-link',
|
||||
}
|
||||
};
|
||||
|
||||
if (options.order) {
|
||||
@ -318,6 +321,15 @@ function loadExtraLineTable(options={}) {
|
||||
field: 'notes',
|
||||
title: '{% trans "Notes" %}',
|
||||
},
|
||||
{
|
||||
field: 'link',
|
||||
title: '{% trans "Link" %}',
|
||||
formatter: function(value) {
|
||||
if (value) {
|
||||
return renderLink(value, value);
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'buttons',
|
||||
switchable: false,
|
||||
|
@ -330,6 +330,9 @@ function poLineItemFields(options={}) {
|
||||
notes: {
|
||||
icon: 'fa-sticky-note',
|
||||
},
|
||||
link: {
|
||||
icon: 'fa-link',
|
||||
}
|
||||
};
|
||||
|
||||
if (options.order) {
|
||||
@ -2037,6 +2040,15 @@ function loadPurchaseOrderLineItemTable(table, options={}) {
|
||||
field: 'notes',
|
||||
title: '{% trans "Notes" %}',
|
||||
},
|
||||
{
|
||||
field: 'link',
|
||||
title: '{% trans "Link" %}',
|
||||
formatter: function(value) {
|
||||
if (value) {
|
||||
return renderLink(value, value);
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
switchable: false,
|
||||
field: 'buttons',
|
||||
|
@ -371,7 +371,10 @@ function returnOrderLineItemFields(options={}) {
|
||||
},
|
||||
notes: {
|
||||
icon: 'fa-sticky-note',
|
||||
}
|
||||
},
|
||||
link: {
|
||||
icon: 'fa-link',
|
||||
},
|
||||
};
|
||||
|
||||
return fields;
|
||||
@ -714,6 +717,15 @@ function loadReturnOrderLineItemTable(options={}) {
|
||||
field: 'notes',
|
||||
title: '{% trans "Notes" %}',
|
||||
},
|
||||
{
|
||||
field: 'link',
|
||||
title: '{% trans "Link" %}',
|
||||
formatter: function(value, row) {
|
||||
if (value) {
|
||||
return renderLink(value, value);
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'buttons',
|
||||
title: '',
|
||||
|
@ -149,6 +149,9 @@ function soLineItemFields(options={}) {
|
||||
notes: {
|
||||
icon: 'fa-sticky-note',
|
||||
},
|
||||
link: {
|
||||
icon: 'fa-link',
|
||||
}
|
||||
};
|
||||
|
||||
if (options.order) {
|
||||
@ -1868,6 +1871,16 @@ function loadSalesOrderLineItemTable(table, options={}) {
|
||||
title: '{% trans "Notes" %}',
|
||||
});
|
||||
|
||||
columns.push({
|
||||
field: 'link',
|
||||
title: '{% trans "Link" %}',
|
||||
formatter: function(value) {
|
||||
if (value) {
|
||||
return renderLink(value, value);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
columns.push({
|
||||
field: 'buttons',
|
||||
switchable: false,
|
||||
|
Loading…
Reference in New Issue
Block a user