Merge pull request #2747 from matmair/matmair/issue1697

Add field with last updated to supplier price break
This commit is contained in:
Oliver 2022-03-16 07:14:25 +11:00 committed by GitHub
commit adc44184b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 2 deletions

View File

@ -12,11 +12,14 @@ import common.models
INVENTREE_SW_VERSION = "0.7.0 dev"
# InvenTree API version
INVENTREE_API_VERSION = 30
INVENTREE_API_VERSION = 31
"""
Increment this API version number whenever there is a significant change to the API that any clients need to know about
v31 -> 2022-03-14
- Adds "updated" field to SupplierPriceBreakList and SupplierPriceBreakDetail API endpoints
v30 -> 2022-03-09
- Adds "exclude_location" field to BuildAutoAllocation API endpoint
- Allows BuildItem API endpoint to be filtered by BomItem relation

View File

@ -0,0 +1,18 @@
# Generated by Django 3.2.12 on 2022-03-14 22:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('company', '0041_alter_company_options'),
]
operations = [
migrations.AddField(
model_name='supplierpricebreak',
name='updated',
field=models.DateTimeField(auto_now=True, null=True, verbose_name='last updated'),
),
]

View File

@ -693,6 +693,7 @@ class SupplierPriceBreak(common.models.PriceBreak):
Attributes:
part: Link to a SupplierPart object that this price break applies to
updated: Automatic DateTime field that shows last time the price break was updated
quantity: Quantity required for price break
cost: Cost at specified quantity
currency: Reference to the currency of this pricebreak (leave empty for base currency)
@ -704,6 +705,8 @@ class SupplierPriceBreak(common.models.PriceBreak):
part = models.ForeignKey(SupplierPart, on_delete=models.CASCADE, related_name='pricebreaks', verbose_name=_('Part'),)
updated = models.DateTimeField(auto_now=True, null=True, verbose_name=_('last updated'))
class Meta:
unique_together = ("part", "quantity")

View File

@ -278,4 +278,5 @@ class SupplierPriceBreakSerializer(InvenTreeModelSerializer):
'quantity',
'price',
'price_currency',
'updated',
]

View File

@ -268,6 +268,14 @@ $('#price-break-table').inventreeTable({
return html;
}
},
{
field: 'updated',
title: '{% trans "Last updated" %}',
sortable: true,
formatter: function(value) {
return renderDate(value);
}
},
]
});
@ -349,4 +357,4 @@ $('#delete-part').click(function() {
enableSidebar('supplierpart');
{% endblock %}
{% endblock %}