[Stoq-devel] [Bug 2695] - SellableCategory e BaseSellableCategory devem herdar de AbstractSellableCategory ao invés de conter uma referência.

bugzilla-daemon at async.com.br bugzilla-daemon at async.com.br
Wed Jul 19 17:43:43 BRT 2006


http://bugs.async.com.br/show_bug.cgi?id=2695  





--- Comment #4 from Johan Dahlin <jdahlin at async.com.br>  2006-07-19 17:43 BRT ---
(From update of attachment 3326)
>Index: stoqlib/gui/search/category.py

>@@ -44,80 +44,62 @@
>     def __init__(self, conn):
>-        SearchEditor.__init__(self, conn, self.table, self.editor_class)
>-        self.set_searchbar_labels(_('Base Categories Matching:'))
>+        SearchEditor.__init__(self, conn, BaseSellableCategory,
>+                              BaseSellableCategoryEditor)
>         self.set_result_strings(_('base category'), _('base categories'))
>+        self.set_searchbar_labels(_('Base Categories Matching:'))

Você mudou o ordem, por que?

>-    def get_query_args(self):
>-        return dict(join=INNERJOINOn(BaseSellableCategory,
>-                                     AbstractSellableCategory,
>-                                     AbstractSellableCategory.q.id==
>-                                     BaseSellableCategory.q.category_dataID))

Não precisamos mais?

> class SellableCatSearch(SearchEditor):

>     def get_columns(self):
>-        return [ForeignKeyColumn(AbstractSellableCategory,
>-                                 'description',
>-                                 _('Base Category'), str,
>-                                 obj_field='base_category.category_data',
>-                                 sorted=True, width=210),

Nem essa?

>     def filter_results(self, abstract_objects):
>         sellable_objs = SellableCategory.select(connection=self.conn)
>-        base_ids = sets.Set([s.base_category.id for s in sellable_objs])
>+        base_ids = sets.Set([s.base_category for s in sellable_objs])

.id é mais rapio, melhor que você deixa como estava lá...


>Index: stoqlib/gui/editors/category.py

>+        return BaseSellableCategory(description=u"", connection=conn)

padrão na columna (eg u"") ?

>+        return SellableCategory(
>+            description=u"", base_category=sysparam(conn).DEFAULT_BASE_CATEGORY,
>+            connection=conn)

Ditto


More information about the Stoq-devel mailing list