mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +00:00
- Does not work with custom backend - Throws error if the button is pressed - So, remove the button (cherry picked from commit a2f614ad41853b7c45232cb15929e5d217088fd5) Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
parent
b8e726d8a4
commit
89d8e47bab
@ -1,5 +1,10 @@
|
|||||||
"""Admin classes"""
|
"""Admin classes"""
|
||||||
|
|
||||||
|
from django.contrib import admin
|
||||||
|
from django.http.request import HttpRequest
|
||||||
|
|
||||||
|
from djmoney.contrib.exchange.admin import RateAdmin
|
||||||
|
from djmoney.contrib.exchange.models import Rate
|
||||||
from import_export.resources import ModelResource
|
from import_export.resources import ModelResource
|
||||||
|
|
||||||
|
|
||||||
@ -43,3 +48,15 @@ class InvenTreeResource(ModelResource):
|
|||||||
]
|
]
|
||||||
|
|
||||||
return [f for f in fields if f.column_name not in fields_to_exclude]
|
return [f for f in fields if f.column_name not in fields_to_exclude]
|
||||||
|
|
||||||
|
|
||||||
|
class CustomRateAdmin(RateAdmin):
|
||||||
|
"""Admin interface for the Rate class"""
|
||||||
|
|
||||||
|
def has_add_permission(self, request: HttpRequest) -> bool:
|
||||||
|
"""Disable the 'add' permission for Rate objects"""
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
admin.site.unregister(Rate)
|
||||||
|
admin.site.register(Rate, CustomRateAdmin)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user