|
@@ -41,10 +41,12 @@ class NewProduct(WidgetPlaceholder):
|
|
|
title = Text('Enter Product Info', align='center')
|
|
|
self.fields = OrderedDict()
|
|
|
self.autocomplete_cb = lambda widget, options: len(options) and widget._emit('open', options)
|
|
|
- for f in ('product', 'category', 'group'):
|
|
|
+ for f in ('product', 'category', 'group', 'unit'):
|
|
|
w = AutoCompleteEdit(('bg', f))
|
|
|
self.fields[f] = w
|
|
|
w.set_edit_text(under.data[f])
|
|
|
+ if f == 'unit':
|
|
|
+ continue
|
|
|
connect_signal(w, 'change', lambda w, v: under.apply_changes(w.name, v))
|
|
|
connect_signal(w, 'apply', lambda _, name: self.autocomplete_cb(
|
|
|
_, query_manager.unique_suggestions(name, **self.data)
|
|
@@ -74,7 +76,7 @@ class NewProduct(WidgetPlaceholder):
|
|
|
AttrMap(body, 'bg'),
|
|
|
self.original_widget,
|
|
|
align='center', width=('relative', 40),
|
|
|
- valign='middle', height=13,
|
|
|
+ valign='middle', height=16,
|
|
|
min_width=20)
|
|
|
|
|
|
@property
|
|
@@ -89,13 +91,13 @@ class NewProduct(WidgetPlaceholder):
|
|
|
self.fields[k].set_edit_text(v)
|
|
|
|
|
|
def insert_new_product(self):
|
|
|
- product, category, group = [ self.fields[k].get_edit_text() for k in (
|
|
|
- 'product', 'category', 'group'
|
|
|
+ product, category, group, unit = [ self.fields[k].get_edit_text() for k in (
|
|
|
+ 'product', 'category', 'group', 'unit'
|
|
|
)]
|
|
|
self.activity_manager.app.log.write(
|
|
|
- f'{get_insert_product_statement(product, category, group)};\n'
|
|
|
+ f'{get_insert_product_statement(product, category, group, unit)};\n'
|
|
|
)
|
|
|
- self.query_manager.insert_new_product(product, category, group)
|
|
|
+ self.query_manager.insert_new_product(product, category, group, unit)
|
|
|
self.activity_manager.show(self.under.update())
|
|
|
|
|
|
def apply_choice(self, name, value):
|