mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Fix resource classes for order models (#6188)
- PurchaseOrder - ReturnOrder - SalesOrder Fixes https://github.com/inventree/InvenTree/issues/6155
This commit is contained in:
parent
9f01962c4e
commit
73cc39bb68
@ -79,9 +79,30 @@ class PurchaseOrderLineItemInlineAdmin(admin.StackedInline):
|
|||||||
extra = 0
|
extra = 0
|
||||||
|
|
||||||
|
|
||||||
|
class PurchaseOrderResource(ProjectCodeResourceMixin, TotalPriceResourceMixin, InvenTreeResource):
|
||||||
|
"""Class for managing import / export of PurchaseOrder data."""
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
"""Metaclass"""
|
||||||
|
model = models.PurchaseOrder
|
||||||
|
skip_unchanged = True
|
||||||
|
clean_model_instances = True
|
||||||
|
exclude = [
|
||||||
|
'metadata',
|
||||||
|
]
|
||||||
|
|
||||||
|
# Add number of line items
|
||||||
|
line_items = Field(attribute='line_count', widget=widgets.IntegerWidget(), readonly=True)
|
||||||
|
|
||||||
|
# Is this order overdue?
|
||||||
|
overdue = Field(attribute='is_overdue', widget=widgets.BooleanWidget(), readonly=True)
|
||||||
|
|
||||||
|
|
||||||
class PurchaseOrderAdmin(ImportExportModelAdmin):
|
class PurchaseOrderAdmin(ImportExportModelAdmin):
|
||||||
"""Admin class for the PurchaseOrder model"""
|
"""Admin class for the PurchaseOrder model"""
|
||||||
|
|
||||||
|
resource_class = PurchaseOrderResource
|
||||||
|
|
||||||
exclude = [
|
exclude = [
|
||||||
'reference_int',
|
'reference_int',
|
||||||
]
|
]
|
||||||
@ -107,9 +128,30 @@ class PurchaseOrderAdmin(ImportExportModelAdmin):
|
|||||||
autocomplete_fields = ('supplier',)
|
autocomplete_fields = ('supplier',)
|
||||||
|
|
||||||
|
|
||||||
|
class SalesOrderResource(ProjectCodeResourceMixin, TotalPriceResourceMixin, InvenTreeResource):
|
||||||
|
"""Class for managing import / export of SalesOrder data."""
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
"""Metaclass options"""
|
||||||
|
model = models.SalesOrder
|
||||||
|
skip_unchanged = True
|
||||||
|
clean_model_instances = True
|
||||||
|
exclude = [
|
||||||
|
'metadata',
|
||||||
|
]
|
||||||
|
|
||||||
|
# Add number of line items
|
||||||
|
line_items = Field(attribute='line_count', widget=widgets.IntegerWidget(), readonly=True)
|
||||||
|
|
||||||
|
# Is this order overdue?
|
||||||
|
overdue = Field(attribute='is_overdue', widget=widgets.BooleanWidget(), readonly=True)
|
||||||
|
|
||||||
|
|
||||||
class SalesOrderAdmin(ImportExportModelAdmin):
|
class SalesOrderAdmin(ImportExportModelAdmin):
|
||||||
"""Admin class for the SalesOrder model"""
|
"""Admin class for the SalesOrder model"""
|
||||||
|
|
||||||
|
resource_class = SalesOrderResource
|
||||||
|
|
||||||
exclude = [
|
exclude = [
|
||||||
'reference_int',
|
'reference_int',
|
||||||
]
|
]
|
||||||
@ -131,25 +173,6 @@ class SalesOrderAdmin(ImportExportModelAdmin):
|
|||||||
autocomplete_fields = ('customer',)
|
autocomplete_fields = ('customer',)
|
||||||
|
|
||||||
|
|
||||||
class PurchaseOrderResource(ProjectCodeResourceMixin, TotalPriceResourceMixin, InvenTreeResource):
|
|
||||||
"""Class for managing import / export of PurchaseOrder data."""
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
"""Metaclass"""
|
|
||||||
model = models.PurchaseOrder
|
|
||||||
skip_unchanged = True
|
|
||||||
clean_model_instances = True
|
|
||||||
exclude = [
|
|
||||||
'metadata',
|
|
||||||
]
|
|
||||||
|
|
||||||
# Add number of line items
|
|
||||||
line_items = Field(attribute='line_count', widget=widgets.IntegerWidget(), readonly=True)
|
|
||||||
|
|
||||||
# Is this order overdue?
|
|
||||||
overdue = Field(attribute='is_overdue', widget=widgets.BooleanWidget(), readonly=True)
|
|
||||||
|
|
||||||
|
|
||||||
class PurchaseOrderLineItemResource(PriceResourceMixin, InvenTreeResource):
|
class PurchaseOrderLineItemResource(PriceResourceMixin, InvenTreeResource):
|
||||||
"""Class for managing import / export of PurchaseOrderLineItem data."""
|
"""Class for managing import / export of PurchaseOrderLineItem data."""
|
||||||
|
|
||||||
@ -184,25 +207,6 @@ class PurchaseOrderExtraLineResource(PriceResourceMixin, InvenTreeResource):
|
|||||||
model = models.PurchaseOrderExtraLine
|
model = models.PurchaseOrderExtraLine
|
||||||
|
|
||||||
|
|
||||||
class SalesOrderResource(ProjectCodeResourceMixin, TotalPriceResourceMixin, InvenTreeResource):
|
|
||||||
"""Class for managing import / export of SalesOrder data."""
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
"""Metaclass options"""
|
|
||||||
model = models.SalesOrder
|
|
||||||
skip_unchanged = True
|
|
||||||
clean_model_instances = True
|
|
||||||
exclude = [
|
|
||||||
'metadata',
|
|
||||||
]
|
|
||||||
|
|
||||||
# Add number of line items
|
|
||||||
line_items = Field(attribute='line_count', widget=widgets.IntegerWidget(), readonly=True)
|
|
||||||
|
|
||||||
# Is this order overdue?
|
|
||||||
overdue = Field(attribute='is_overdue', widget=widgets.BooleanWidget(), readonly=True)
|
|
||||||
|
|
||||||
|
|
||||||
class SalesOrderLineItemResource(PriceResourceMixin, InvenTreeResource):
|
class SalesOrderLineItemResource(PriceResourceMixin, InvenTreeResource):
|
||||||
"""Class for managing import / export of SalesOrderLineItem data."""
|
"""Class for managing import / export of SalesOrderLineItem data."""
|
||||||
|
|
||||||
@ -334,6 +338,8 @@ class ReturnOrderResource(ProjectCodeResourceMixin, TotalPriceResourceMixin, Inv
|
|||||||
class ReturnOrderAdmin(ImportExportModelAdmin):
|
class ReturnOrderAdmin(ImportExportModelAdmin):
|
||||||
"""Admin class for the ReturnOrder model"""
|
"""Admin class for the ReturnOrder model"""
|
||||||
|
|
||||||
|
resource_class = ReturnOrderResource
|
||||||
|
|
||||||
exclude = [
|
exclude = [
|
||||||
'reference_int',
|
'reference_int',
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user