Overriding StockRecordForm in Dashboard

30 views
Skip to first unread message

Bastien Roques

unread,
Oct 19, 2016, 6:24:46 AM10/19/16
to django-oscar
I've added a field 'ecotax' to the partner stock record model as following:

   
class StockRecord(AbstractStockRecord):

    ecotax = models.DecimalField(
        _("Ecotax"), decimal_places=2, max_digits=12,
    blank=True, null=True)r code here...


I did the same to add a 'brand' field to catalogue product model.

In the forked dashboard catalogue app, I've copied the entire forms.py in order to reflect my model changes. Adding the field 'brand' to the ProductForm works. But adding 'ecotax' as following to the field list in StockRecordForm doesn't:

class Meta:
model = StockRecord
fields = [
'partner', 'partner_sku',
'price_currency', 'price_excl_tax', 'price_retail', 'cost_price',
'num_in_stock', 'low_stock_threshold', 'ecotax',
]

Is there a reason why the 'ecotax' field is not taken in account?

Bastien Roques

unread,
Oct 19, 2016, 9:40:00 AM10/19/16
to django-oscar
OK, I found the trick ! It's just HTML logic in the template. So easy !
Reply all
Reply to author
Forward
0 new messages