Unable to edit StockRecord form in admin

39 views
Skip to first unread message

Michal Plsek

unread,
Jun 19, 2021, 10:37:39 AM6/19/21
to django-oscar
Hello, I update StockRecord with attribute:

class StockRecord(AbstractStockRecord):
    b2b = models.BooleanField(default=False, verbose_name=_("B2B"),)


I also edited admin.py to reflect changes:

StockRecord = get_model('partner', 'StockRecord')
class StockRecordAdmin(admin.ModelAdmin):
    list_display = ('product', 'partner', 'partner_sku', 'price', 'num_in_stock', 'b2b')


New  does not reflect in Oscar dashboard (Products > Stock and pricing). Am I doing something wrong? Thanks for tip.

m

Michal Plsek

unread,
Jun 19, 2021, 11:24:04 AM6/19/21
to django-oscar
Corrected (forgot admin.py does not work with custom oscar administration): I edited myapps.dashboard.catalogue.forms:

class StockRecordForm(CoreStockRecordForm)
    class Meta(CoreStockRecordForm.Meta):
        fields = [
            'partner', 'partner_sku',
            'price_currency', 'price',
            'num_in_stock', 'low_stock_threshold', 'mike_b2b',
        ]
from oscar.apps.dashboard.catalogue.forms import *


But still does not work. Any ideas?

thanks,m
Dne sobota 19. června 2021 v 16:37:39 UTC+2 uživatel Michal Plsek napsal:

Michal Plsek

unread,
Jun 20, 2021, 1:38:48 AM6/20/21
to django-oscar
Allright, I am surprised that in this case I have to actually modify template to show the new fields (unlike ProductForm etc.). Sorry to bother.
Dne sobota 19. června 2021 v 17:24:04 UTC+2 uživatel Michal Plsek napsal:
Reply all
Reply to author
Forward
0 new messages