Update stock translations

This commit is contained in:
Skia 2017-04-25 09:16:38 +02:00
parent df20bf6dde
commit 423313f008
5 changed files with 745 additions and 524 deletions

View File

@ -118,7 +118,7 @@ class RefillForm(forms.ModelForm):
class CounterTabsMixin(TabedViewMixin): class CounterTabsMixin(TabedViewMixin):
def get_tabs_title(self): def get_tabs_title(self):
if hasattr(self.object, 'stock_owner') : if hasattr(self.object, 'stock_owner') :
return self.object.stock_owner.counter return self.object.stock_owner.counter
else: else:
return self.object return self.object
@ -132,19 +132,19 @@ class CounterTabsMixin(TabedViewMixin):
}) })
if self.object.stock_owner.counter.type if hasattr(self.object, 'stock_owner') else self.object.type == "BAR": if self.object.stock_owner.counter.type if hasattr(self.object, 'stock_owner') else self.object.type == "BAR":
tab_list.append({ tab_list.append({
'url': reverse_lazy('counter:cash_summary', 'url': reverse_lazy('counter:cash_summary',
kwargs={'counter_id': self.object.stock_owner.counter.id if hasattr(self.object, 'stock_owner') else self.object.id}), kwargs={'counter_id': self.object.stock_owner.counter.id if hasattr(self.object, 'stock_owner') else self.object.id}),
'slug': 'cash_summary', 'slug': 'cash_summary',
'name': _("Cash summary"), 'name': _("Cash summary"),
}) })
tab_list.append({ tab_list.append({
'url': reverse_lazy('counter:last_ops', 'url': reverse_lazy('counter:last_ops',
kwargs={'counter_id': self.object.stock_owner.counter.id if hasattr(self.object, 'stock_owner') else self.object.id}), kwargs={'counter_id': self.object.stock_owner.counter.id if hasattr(self.object, 'stock_owner') else self.object.id}),
'slug': 'last_ops', 'slug': 'last_ops',
'name': _("Last operations"), 'name': _("Last operations"),
}) })
tab_list.append({ tab_list.append({
'url': reverse_lazy('stock:take_items', 'url': reverse_lazy('stock:take_items',
kwargs={'stock_id': self.object.stock.id if hasattr(self.object, 'stock') else self.object.stock_owner.id}), kwargs={'stock_id': self.object.stock.id if hasattr(self.object, 'stock') else self.object.stock_owner.id}),
'slug': 'take_items_from_stock', 'slug': 'take_items_from_stock',
'name': _("Take items from stock"), 'name': _("Take items from stock"),

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -85,6 +85,7 @@ INSTALLED_APPS = (
'com', 'com',
'election', 'election',
'forum', 'forum',
'stock',
) )
MIDDLEWARE_CLASSES = ( MIDDLEWARE_CLASSES = (

View File

@ -373,7 +373,7 @@ class StockTakeItemsBaseFormView(CounterTabsMixin, CanEditMixin, DetailView, Bas
for i in self.stock.items.filter(type=t).order_by('name').all(): for i in self.stock.items.filter(type=t).order_by('name').all():
field_name = "item-%s" % (str(i.id)) field_name = "item-%s" % (str(i.id))
fields[field_name] = forms.IntegerField(required=False, label=str(i), initial=0, min_value=0, max_value=i.effective_quantity, fields[field_name] = forms.IntegerField(required=False, label=str(i), initial=0, min_value=0, max_value=i.effective_quantity,
help_text=_("(%(effective_quantity)s left" % {"effective_quantity": str(i.effective_quantity)})) help_text=_("%(effective_quantity)s left" % {"effective_quantity": str(i.effective_quantity)}))
kwargs[field_name] = i.effective_quantity kwargs[field_name] = i.effective_quantity
kwargs['stock_id'] = self.stock.id kwargs['stock_id'] = self.stock.id
kwargs['counter_id'] = self.stock.counter.id kwargs['counter_id'] = self.stock.counter.id