Add "description" field to extra line items (#4815)

This commit is contained in:
Oliver 2023-05-15 11:13:38 +10:00 committed by GitHub
parent caa7b84c3e
commit 3e0b57f10a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1,28 @@
# Generated by Django 3.2.19 on 2023-05-14 23:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('order', '0093_auto_20230426_0248'),
]
operations = [
migrations.AddField(
model_name='purchaseorderextraline',
name='description',
field=models.CharField(blank=True, help_text='Line item description (optional)', max_length=250, verbose_name='Description'),
),
migrations.AddField(
model_name='returnorderextraline',
name='description',
field=models.CharField(blank=True, help_text='Line item description (optional)', max_length=250, verbose_name='Description'),
),
migrations.AddField(
model_name='salesorderextraline',
name='description',
field=models.CharField(blank=True, help_text='Line item description (optional)', max_length=250, verbose_name='Description'),
),
]

View File

@ -1109,6 +1109,12 @@ class OrderExtraLine(OrderLineItem):
"""Metaclass options. Abstract ensures no database table is created."""
abstract = True
description = models.CharField(
max_length=250, blank=True,
verbose_name=_('Description'),
help_text=_('Line item description (optional)')
)
context = models.JSONField(
blank=True, null=True,
verbose_name=_('Context'),

View File

@ -147,6 +147,7 @@ class AbstractExtraLineMeta:
fields = [
'pk',
'description',
'quantity',
'reference',
'notes',

View File

@ -31,6 +31,7 @@ function extraLineFields(options={}) {
},
quantity: {},
reference: {},
description: {},
price: {
icon: 'fa-dollar-sign',
},
@ -272,6 +273,12 @@ function loadExtraLineTable(options={}) {
title: '{% trans "Reference" %}',
switchable: false,
},
{
sortable: false,
switchable: true,
field: 'description',
title: '{% trans "Description" %}',
},
{
sortable: true,
switchable: false,