示例#1
0
 def __init__(self,
              store,
              hide_footer=True,
              hide_toolbar=False,
              selection_mode=gtk.SELECTION_BROWSE,
              hide_cost_column=False,
              use_product_statuses=None,
              hide_price_column=False):
     """
     Create a new ProductSearch object.
     :param store: a store
     :param hide_footer: do I have to hide the dialog footer?
     :param hide_toolbar: do I have to hide the dialog toolbar?
     :param selection_mode: the kiwi list selection mode
     :param hide_cost_column: if it's True, no need to show the
                              column 'cost'
     :param use_product_statuses: a list instance that, if provided, will
                                  overwrite the statuses list defined in
                                  get_filter_slave method
     :param hide_price_column: if it's True no need to show the
                               column 'price'
     """
     self.use_product_statuses = use_product_statuses
     self.hide_cost_column = hide_cost_column
     self.hide_price_column = hide_price_column
     SearchEditor.__init__(self,
                           store,
                           hide_footer=hide_footer,
                           hide_toolbar=hide_toolbar,
                           selection_mode=selection_mode)
     self._setup_print_slave()
示例#2
0
 def __init__(self, store, title='', hide_footer=True):
     self.title = title or self.title
     SearchEditor.__init__(self,
                           store,
                           self.editor_class,
                           interface=self.interface,
                           hide_footer=hide_footer)
示例#3
0
    def __init__(self, store, table, query=None, search_str=None, supplier=None, hide_toolbar=False):
        """
        :param item_step: The item step this search is for.
        :param search_str: If this search should already filter for some string
        :param supplier: If provided and a new product is created from this
          search, then the created product will be associated with this
          supplier.
        :param hide_toolbar: if the search's toolbar, not allowing you
          to create/edit sellables
        """
        self._table = table
        self._query = query
        self._supplier = supplier

        SearchEditor.__init__(
            self,
            store,
            selection_mode=gtk.SELECTION_BROWSE,
            hide_footer=False,
            search_spec=self._table,
            double_click_confirm=True,
            hide_toolbar=hide_toolbar,
        )
        if search_str:
            self.set_searchbar_search_string(search_str)
            self.search.refresh()

        self.set_ok_label(_("_Select item"))
示例#4
0
    def __init__(self, store, hide_footer=False, hide_toolbar=True,
                 selection_mode=None, search_str=None, search_spec=None,
                 search_query=None, double_click_confirm=True, info_message=None):
        """
        :param store: a store
        :param hide_footer: do I have to hide the dialog footer?
        :param hide_toolbar: do I have to hide the dialog toolbar?
        :param selection_mode: the kiwi list selection mode
        :param search_str: If this search should already filter for some string
        :param double_click_confirm: If double click a item in the list should
            automatically confirm
        """
        if selection_mode is None:
            selection_mode = gtk.SELECTION_BROWSE

        self._image_viewer = None
        self._first_search = True
        self._first_search_string = search_str
        self._search_query = search_query
        self._delivery_sellable = sysparam.get_object(
            store, 'DELIVERY_SERVICE').sellable

        SearchEditor.__init__(self, store, search_spec=search_spec,
                              editor_class=self.editor_class,
                              hide_footer=hide_footer,
                              hide_toolbar=hide_toolbar,
                              selection_mode=selection_mode,
                              double_click_confirm=double_click_confirm)

        if info_message:
            self.set_message(info_message)

        if search_str:
            self.set_searchbar_search_string(search_str)
            self.search.refresh()
示例#5
0
    def __init__(self,
                 store,
                 table,
                 query=None,
                 search_str=None,
                 supplier=None,
                 hide_toolbar=False):
        """
        :param item_step: The item step this search is for.
        :param search_str: If this search should already filter for some string
        :param supplier: If provided and a new product is created from this
          search, then the created product will be associated with this
          supplier.
        :param hide_toolbar: if the search's toolbar, not allowing you
          to create/edit sellables
        """
        self._table = table
        self._query = query
        self._supplier = supplier

        SearchEditor.__init__(self,
                              store,
                              selection_mode=gtk.SELECTION_BROWSE,
                              hide_footer=False,
                              search_spec=self._table,
                              double_click_confirm=True,
                              hide_toolbar=hide_toolbar)
        if search_str:
            self.set_searchbar_search_string(search_str)
            self.search.refresh()

        self.set_ok_label(_('_Select item'))
示例#6
0
 def __init__(self, store, hide_footer=True, hide_toolbar=False,
              selection_mode=None,
              hide_cost_column=False, use_product_statuses=None,
              hide_price_column=False):
     """
     Create a new ProductSearch object.
     :param store: a store
     :param hide_footer: do I have to hide the dialog footer?
     :param hide_toolbar: do I have to hide the dialog toolbar?
     :param selection_mode: the kiwi list selection mode
     :param hide_cost_column: if it's True, no need to show the
                              column 'cost'
     :param use_product_statuses: a list instance that, if provided, will
                                  overwrite the statuses list defined in
                                  get_filter_slave method
     :param hide_price_column: if it's True no need to show the
                               column 'price'
     """
     if selection_mode is None:
         selection_mode = gtk.SELECTION_BROWSE
     self.use_product_statuses = use_product_statuses
     self.hide_cost_column = hide_cost_column
     self.hide_price_column = hide_price_column
     SearchEditor.__init__(self, store, hide_footer=hide_footer,
                           hide_toolbar=hide_toolbar,
                           selection_mode=selection_mode)
     self._setup_print_slave()
示例#7
0
 def __init__(self, store, initial_string=None, hide_toolbar=False,
              hide_footer=False, double_click_confirm=False):
     SearchEditor.__init__(self, store, search_spec=self.search_spec,
                           editor_class=self.editor_class,
                           initial_string=initial_string,
                           hide_toolbar=hide_toolbar,
                           hide_footer=hide_footer,
                           double_click_confirm=double_click_confirm)
示例#8
0
    def __init__(self, store, hide_footer=False, hide_toolbar=True,
                 selection_mode=None, search_str=None,
                 sale_items=None, quantity=None, double_click_confirm=False,
                 info_message=None):
        """
        Create a new SellableSearch object.
        :param store: a store
        :param hide_footer: do I have to hide the dialog footer?
        :param hide_toolbar: do I have to hide the dialog toolbar?
        :param selection_mode: the kiwi list selection mode
        :param search_str: FIXME
        :param sale_items: optionally, a list of sellables which will be
            used to deduct stock values
        :param quantity: the quantity of stock to add to the order,
            is necessary to supply if you supply an order.
        :param double_click_confirm: If double click a item in the list should
            automatically confirm
        """
        if selection_mode is None:
            selection_mode = gtk.SELECTION_BROWSE
        self._first_search = True
        self._first_search_string = search_str
        self.quantity = quantity
        self._delivery_sellable = sysparam(store).DELIVERY_SERVICE.sellable

        # FIXME: This dictionary should be used to deduct from the
        #        current stock (in the current branch) and not others
        self.current_sale_stock = {}
        if sale_items:
            if selection_mode == gtk.SELECTION_MULTIPLE:
                raise TypeError("gtk.SELECTION_MULTIPLE is not supported "
                                "when supplying an order")
            if self.quantity is None:
                raise TypeError("You need to specify a quantity "
                                "when supplying an order")
            for item in sale_items:
                if item.sellable.product_storable:
                    quantity = self.current_sale_stock.get(item.sellable.id, 0)
                    quantity += item.quantity
                    self.current_sale_stock[item.sellable.id] = quantity

        SearchEditor.__init__(self, store, search_spec=self.search_spec,
                              editor_class=self.editor_class,
                              hide_footer=hide_footer,
                              hide_toolbar=hide_toolbar,
                              selection_mode=selection_mode,
                              double_click_confirm=double_click_confirm)
        self.set_ok_label(self.footer_ok_label)

        if info_message:
            self.set_message(info_message)

        if search_str:
            self.set_searchbar_search_string(search_str)
            self.search.refresh()
示例#9
0
 def __init__(self,
              store,
              search_str=None,
              hide_toolbar=False,
              hide_footer=False):
     SearchEditor.__init__(self,
                           store,
                           search_spec=self.search_spec,
                           editor_class=self.editor_class,
                           hide_toolbar=hide_toolbar,
                           hide_footer=hide_footer)
示例#10
0
 def __init__(self, store, hide_footer=True, hide_toolbar=False,
              selection_mode=gtk.SELECTION_BROWSE,
              hide_cost_column=False, use_product_statuses=None,
              hide_price_column=False):
     self.hide_cost_column = hide_cost_column
     self.hide_price_column = hide_price_column
     self.use_product_statuses = use_product_statuses
     SearchEditor.__init__(self, store, hide_footer=hide_footer,
                           hide_toolbar=hide_toolbar,
                           selection_mode=selection_mode)
     self._setup_print_slave()
示例#11
0
 def __init__(self, store, client=None, reuse_store=False):
     """
     :param store: a store
     :param client: If not None, the search will show only call made to
         this client.
     :param reuse_store: When False, a new transaction will be
         created/commited when creating a new call. When True, no transaction
         will be created. In this case, I{store} will be utilized.
     """
     self.store = store
     self.client = client
     self._reuse_store = reuse_store
     SearchEditor.__init__(self, store)
     self.set_edit_button_label(_('Details'), Gtk.STOCK_INFO)
 def __init__(self, store, client=None, reuse_store=False):
     """
     :param store: a store
     :param client: If not None, the search will show only call made to
         this client.
     :param reuse_store: When False, a new transaction will be
         created/commited when creating a new call. When True, no transaction
         will be created. In this case, I{store} will be utilized.
     """
     self.store = store
     self.client = client
     self._reuse_store = reuse_store
     SearchEditor.__init__(self, store)
     self.set_edit_button_label(_('Details'), gtk.STOCK_INFO)
示例#13
0
 def __init__(self,
              store,
              initial_string=None,
              hide_toolbar=False,
              hide_footer=False,
              double_click_confirm=False):
     SearchEditor.__init__(self,
                           store,
                           search_spec=self.search_spec,
                           editor_class=self.editor_class,
                           initial_string=initial_string,
                           hide_toolbar=hide_toolbar,
                           hide_footer=hide_footer,
                           double_click_confirm=double_click_confirm)
示例#14
0
    def __init__(self,
                 store,
                 hide_footer=False,
                 hide_toolbar=True,
                 selection_mode=None,
                 search_str=None,
                 search_spec=None,
                 search_query=None,
                 double_click_confirm=True,
                 info_message=None,
                 show_closed_items=False):
        """
        :param store: a store
        :param hide_footer: do I have to hide the dialog footer?
        :param hide_toolbar: do I have to hide the dialog toolbar?
        :param selection_mode: the kiwi list selection mode
        :param search_str: If this search should already filter for some string
        :param double_click_confirm: If double click a item in the list should
            automatically confirm
        :param show_closed_items: if this parameter is True, shows sellable with
            status closed
        """
        if selection_mode is None:
            selection_mode = Gtk.SelectionMode.BROWSE

        self._image_viewer = None
        self._first_search = True
        self._first_search_string = search_str
        self._search_query = search_query
        self._show_closed_items = show_closed_items
        self._delivery_sellable = sysparam.get_object(
            store, 'DELIVERY_SERVICE').sellable

        SearchEditor.__init__(self,
                              store,
                              search_spec=search_spec,
                              editor_class=self.editor_class,
                              hide_footer=hide_footer,
                              hide_toolbar=hide_toolbar,
                              selection_mode=selection_mode,
                              double_click_confirm=double_click_confirm)

        if info_message:
            self.set_message(info_message)

        if search_str:
            self.set_searchbar_search_string(search_str)
            self.search.refresh()
示例#15
0
 def __init__(self, store, person=None, date=None, reuse_store=False):
     """
     :param store: a store
     :param person: If not None, the search will show only call made to
         this person.
     :param date: If not None, the search will be filtered using this date by
         default
     :param reuse_store: When False, a new store will be
         created/commited when creating a new call. When True, no store
         will be created. In this case, I{store} will be utilized.
     """
     self.store = store
     self.person = person
     self._date = date
     self._reuse_store = reuse_store
     SearchEditor.__init__(self, store)
示例#16
0
 def __init__(self, store, person=None, date=None, reuse_store=False):
     """
     :param store: a store
     :param person: If not None, the search will show only call made to
         this person.
     :param date: If not None, the search will be filtered using this date by
         default
     :param reuse_store: When False, a new store will be
         created/commited when creating a new call. When True, no store
         will be created. In this case, I{store} will be utilized.
     """
     self.store = store
     self.person = person
     self._date = date
     self._reuse_store = reuse_store
     SearchEditor.__init__(self, store)
示例#17
0
 def _has_rows(self, results, obj):
     SearchEditor._has_rows(self, results, obj)
     self._print_slave.print_price_button.set_sensitive(obj)
示例#18
0
 def run_dialog(self, *args, **kwargs):
     parent_view = self.results.get_selected()
     kwargs['parent_category'] = parent_view and parent_view.category
     return SearchEditor.run_dialog(self, *args, **kwargs)
示例#19
0
 def __init__(self, store, search_str=None, hide_toolbar=False,
              hide_footer=False):
     SearchEditor.__init__(self, store, search_spec=self.search_spec,
                           editor_class=self.editor_class,
                           hide_toolbar=hide_toolbar,
                           hide_footer=hide_footer)
示例#20
0
 def __init__(self, store, **kwargs):
     self.company_doc_l10n = api.get_l10n_field("company_document")
     SearchEditor.__init__(self, store, **kwargs)
示例#21
0
 def __init__(self, store):
     SearchEditor.__init__(self, store, hide_footer=True,
                           hide_toolbar=True)
示例#22
0
 def _has_rows(self, results, obj):
     SearchEditor._has_rows(self, results, obj)
     self._print_slave.print_price_button.set_sensitive(obj)
示例#23
0
 def __init__(self, store):
     SearchEditor.__init__(self, store)
     self.set_details_button_sensitive(False)
     self.hide_new_button()
示例#24
0
 def run_dialog(self, *args, **kwargs):
     parent_view = self.results.get_selected()
     kwargs['parent_category'] = parent_view and parent_view.category
     return SearchEditor.run_dialog(self, *args, **kwargs)
示例#25
0
 def __init__(self, store):
     SearchEditor.__init__(self, store)
     self.set_details_button_sensitive(False)
     self.hide_new_button()
示例#26
0
 def __init__(self, store, birth_date=None, **kwargs):
     self._birth_date = birth_date
     self.company_doc_l10n = api.get_l10n_field('company_document')
     self.person_doc_l10n = api.get_l10n_field('person_document')
     SearchEditor.__init__(self, store, **kwargs)
示例#27
0
 def __init__(self, store):
     SearchEditor.__init__(self, store, hide_footer=True, hide_toolbar=True)
示例#28
0
    def __init__(self,
                 store,
                 hide_footer=False,
                 hide_toolbar=True,
                 selection_mode=gtk.SELECTION_BROWSE,
                 search_str=None,
                 sale_items=None,
                 quantity=None,
                 double_click_confirm=False,
                 info_message=None):
        """
        Create a new SellableSearch object.
        :param store: a store
        :param hide_footer: do I have to hide the dialog footer?
        :param hide_toolbar: do I have to hide the dialog toolbar?
        :param selection_mode: the kiwi list selection mode
        :param search_str: FIXME
        :param sale_items: optionally, a list of sellables which will be
            used to deduct stock values
        :param quantity: the quantity of stock to add to the order,
            is necessary to supply if you supply an order.
        :param double_click_confirm: If double click a item in the list should
            automatically confirm
        """
        self._first_search = True
        self._first_search_string = search_str
        self.quantity = quantity
        self._delivery_sellable = sysparam(store).DELIVERY_SERVICE.sellable

        # FIXME: This dictionary should be used to deduct from the
        #        current stock (in the current branch) and not others
        self.current_sale_stock = {}
        if sale_items:
            if selection_mode == gtk.SELECTION_MULTIPLE:
                raise TypeError("gtk.SELECTION_MULTIPLE is not supported "
                                "when supplying an order")
            if self.quantity is None:
                raise TypeError("You need to specify a quantity "
                                "when supplying an order")
            for item in sale_items:
                if item.sellable.product_storable:
                    quantity = self.current_sale_stock.get(item.sellable.id, 0)
                    quantity += item.quantity
                    self.current_sale_stock[item.sellable.id] = quantity

        SearchEditor.__init__(self,
                              store,
                              search_table=self.search_table,
                              editor_class=self.editor_class,
                              hide_footer=hide_footer,
                              hide_toolbar=hide_toolbar,
                              selection_mode=selection_mode,
                              double_click_confirm=double_click_confirm)
        self.set_ok_label(self.footer_ok_label)

        if info_message:
            self.set_message(info_message)

        if search_str:
            self.set_searchbar_search_string(search_str)
            self.search.refresh()
示例#29
0
 def __init__(self, store):
     SearchEditor.__init__(self, store=store)
     self.hide_new_button()
示例#30
0
 def __init__(self, store, **kwargs):
     self.company_doc_l10n = api.get_l10n_field(store, 'company_document')
     self.person_doc_l10n = api.get_l10n_field(store, 'person_document')
     SearchEditor.__init__(self, store, **kwargs)
示例#31
0
 def __init__(self, store, birth_date=None, **kwargs):
     self._birth_date = birth_date
     self.company_doc_l10n = api.get_l10n_field('company_document')
     self.person_doc_l10n = api.get_l10n_field('person_document')
     SearchEditor.__init__(self, store, **kwargs)
示例#32
0
 def __init__(self, store, title='', hide_footer=True):
     self.title = title or self.title
     SearchEditor.__init__(self, store,
                           self.editor_class,
                           interface=self.interface,
                           hide_footer=hide_footer)
示例#33
0
 def _has_rows(self, results, obj):
     SearchEditor._has_rows(self, results, obj)
示例#34
0
 def _has_rows(self, results, obj):
     SearchEditor._has_rows(self, results, obj)