コード例 #1
0
ファイル: test_person.py プロジェクト: rosalin/stoq
 def test_getactive_branches(self):
     person = self.create_person()
     Company(person=person, store=self.store)
     count = Branch.get_active_branches(self.store).count()
     manager = self.create_employee()
     branch = Branch(person=person, store=self.store,
                     manager=manager, is_active=True)
     assert branch.get_active_branches(self.store).count() == count + 1
コード例 #2
0
 def test_getactive_branches(self):
     person = self.create_person()
     Company(person=person, store=self.store)
     count = Branch.get_active_branches(self.store).count()
     manager = self.create_employee()
     branch = Branch(person=person,
                     store=self.store,
                     manager=manager,
                     is_active=True)
     assert branch.get_active_branches(self.store).count() == count + 1
コード例 #3
0
    def _setup_widgets(self):
        quote_group = str(self.wizard.quote_group.identifier)
        self.quote_group.set_text(quote_group)

        branches = Branch.get_active_branches(self.store)
        self.branch_combo.prefill(api.for_person_combo(branches))
        self.notes.set_accepts_tab(False)
コード例 #4
0
ファイル: fields.py プロジェクト: romaia/stoq
    def populate(self, person):
        from stoqlib.domain.person import (Client, Supplier, Transporter,
                                           SalesPerson, Branch)
        store = get_store_for_field(self)
        person_type = self.person_type
        if person_type == Supplier:
            objects = Supplier.get_active_suppliers(store)
            self.add_button.set_tooltip_text(_("Add a new supplier"))
            self.edit_button.set_tooltip_text(_("Edit the selected supplier"))
        elif person_type == Client:
            objects = Client.get_active_clients(store)
            self.add_button.set_tooltip_text(_("Add a new client"))
            self.edit_button.set_tooltip_text(_("Edit the selected client"))
        elif person_type == Transporter:
            objects = Transporter.get_active_transporters(store)
            self.add_button.set_tooltip_text(_("Add a new transporter"))
            self.edit_button.set_tooltip_text(_("Edit the selected transporter"))
        elif person_type == SalesPerson:
            objects = SalesPerson.get_active_salespersons(store)
            self.add_button.set_tooltip_text(_("Add a new sales person"))
            self.edit_button.set_tooltip_text(_("Edit the selected sales person"))
        elif person_type == Branch:
            objects = Branch.get_active_branches(store)
            self.add_button.set_tooltip_text(_("Add a new branch"))
            self.edit_button.set_tooltip_text(_("Edit the selected branch"))
        else:
            raise AssertionError(self.person_type)

        self.widget.prefill(api.for_person_combo(objects))

        if person:
            assert isinstance(person, person_type)
            self.widget.select(person)
コード例 #5
0
ファイル: fields.py プロジェクト: tmaxter/stoq
    def populate(self, person):
        from stoqlib.domain.person import (Client, Supplier, Transporter,
                                           SalesPerson, Branch)
        store = get_store_for_field(self)
        person_type = self.person_type
        if person_type == Supplier:
            objects = Supplier.get_active_suppliers(store)
            self.add_button.set_tooltip_text(_("Add a new supplier"))
            self.edit_button.set_tooltip_text(_("Edit the selected supplier"))
        elif person_type == Client:
            objects = Client.get_active_clients(store)
            self.add_button.set_tooltip_text(_("Add a new client"))
            self.edit_button.set_tooltip_text(_("Edit the selected client"))
        elif person_type == Transporter:
            objects = Transporter.get_active_transporters(store)
            self.add_button.set_tooltip_text(_("Add a new transporter"))
            self.edit_button.set_tooltip_text(
                _("Edit the selected transporter"))
        elif person_type == SalesPerson:
            objects = SalesPerson.get_active_salespersons(store)
            self.add_button.set_tooltip_text(_("Add a new sales person"))
            self.edit_button.set_tooltip_text(
                _("Edit the selected sales person"))
        elif person_type == Branch:
            objects = Branch.get_active_branches(store)
            self.add_button.set_tooltip_text(_("Add a new branch"))
            self.edit_button.set_tooltip_text(_("Edit the selected branch"))
        else:
            raise AssertionError(self.person_type)

        self.widget.prefill(api.for_person_combo(objects))

        if person:
            assert isinstance(person, person_type)
            self.widget.select(person)
コード例 #6
0
    def _setup_widgets(self):
        quote_group = "%05d" % self.wizard.quote_group.id
        self.quote_group.set_text(quote_group)

        branches = Branch.get_active_branches(self.store)
        self.branch_combo.prefill(api.for_person_combo(branches))
        self.notes.set_accepts_tab(False)
コード例 #7
0
ファイル: stock.py プロジェクト: coletivoEITA/stoq
 def create_filters(self):
     self.search.set_query(self._query)
     self.set_text_field_columns(["description", "code", "barcode", "category_description", "manufacturer"])
     branches = Branch.get_active_branches(self.store)
     self.branch_filter = ComboSearchFilter(_("Show by:"), api.for_combo(branches, empty=_("All branches")))
     self.branch_filter.select(api.get_current_branch(self.store))
     self.add_filter(self.branch_filter, position=SearchFilterPosition.TOP)
コード例 #8
0
ファイル: stock.py プロジェクト: LeonamSilva/stoq
 def create_filters(self):
     self.search.set_query(self._query)
     self.set_text_field_columns(['description'])
     branches = Branch.get_active_branches(self.store)
     self.branch_filter = ComboSearchFilter(
         _('Show by:'), api.for_combo(branches, empty=_("All branches")))
     self.branch_filter.select(api.get_current_branch(self.store))
     self.add_filter(self.branch_filter, position=SearchFilterPosition.TOP)
コード例 #9
0
ファイル: initialstockdialog.py プロジェクト: 5l1v3r1/stoq-1
    def setup_proxies(self):
        if api.sysparam.get_bool('SYNCHRONIZED_MODE'):
            current = api.get_current_branch(self.store)
            branches = [(current.get_description(), current)]
        else:
            branches = api.for_combo(Branch.get_active_branches(self.store))

        self.branch.prefill(branches)
        self.add_proxy(self.model, self.proxy_widgets)
コード例 #10
0
 def create_filters(self):
     self.search.set_query(self._query)
     self.set_text_field_columns(['description', 'code', 'barcode',
                                  'category_description', 'manufacturer'])
     branches = Branch.get_active_branches(self.store)
     self.branch_filter = ComboSearchFilter(
         _('Show by:'), api.for_combo(branches, empty=_("All branches")))
     self.branch_filter.select(api.get_current_branch(self.store))
     self.add_filter(self.branch_filter, position=SearchFilterPosition.TOP)
コード例 #11
0
ファイル: salesearch.py プロジェクト: pkaislan/stoq
 def _get_branch_values(self):
     if api.sysparam.get_bool('SYNCHRONIZED_MODE'):
         current = api.get_current_branch(self.store)
         items = [(current.get_description(), current.id)]
     else:
         items = [(b.get_description(), b.id) for b
                  in Branch.get_active_branches(self.store)]
         items.insert(0, (_('Any'), None))
     return items
コード例 #12
0
ファイル: initialstockdialog.py プロジェクト: Guillon88/stoq
    def setup_proxies(self):
        if api.sysparam.get_bool('SYNCHRONIZED_MODE'):
            current = api.get_current_branch(self.store)
            branches = [(current.get_description(), current)]
        else:
            branches = api.for_combo(Branch.get_active_branches(self.store))

        self.branch.prefill(branches)
        self.add_proxy(self.model, self.proxy_widgets)
コード例 #13
0
ファイル: purchasequotewizard.py プロジェクト: 5l1v3r1/stoq-1
    def _setup_widgets(self):
        quote_group = str(self.wizard.quote_group.identifier)
        self.quote_group.set_text(quote_group)

        branches = Branch.get_active_branches(self.store)
        self.branch_combo.prefill(api.for_person_combo(branches))
        sync_mode = api.sysparam.get_bool('SYNCHRONIZED_MODE')
        self.branch_combo.set_sensitive(not sync_mode)

        self.notes.set_accepts_tab(False)
コード例 #14
0
ファイル: purchasequotewizard.py プロジェクト: pkaislan/stoq
    def _setup_widgets(self):
        quote_group = str(self.wizard.quote_group.identifier)
        self.quote_group.set_text(quote_group)

        branches = Branch.get_active_branches(self.store)
        self.branch_combo.prefill(api.for_person_combo(branches))
        sync_mode = api.sysparam.get_bool('SYNCHRONIZED_MODE')
        self.branch_combo.set_sensitive(not sync_mode)

        self.notes.set_accepts_tab(False)
コード例 #15
0
ファイル: searchdialog.py プロジェクト: rg3915/stoq
    def create_branch_filter(self, label=None):
        from stoqlib.domain.person import Branch

        branches = Branch.get_active_branches(self.store)
        items = [(b.get_description(), b.id) for b in branches]
        items.insert(0, (_("Any"), None))

        if not label:
            label = _("Branch:")
        branch_filter = ComboSearchFilter(label, items)
        current = api.get_current_branch(self.store)
        if current:
            branch_filter.select(current.id)

        return branch_filter
コード例 #16
0
ファイル: searchdialog.py プロジェクト: pkaislan/stoq
    def create_branch_filter(self, label=None):
        from stoqlib.domain.person import Branch
        current = api.get_current_branch(self.store)
        if api.sysparam.get_bool('SYNCHRONIZED_MODE'):
            items = [(current.get_description(), current.id)]
        else:
            branches = Branch.get_active_branches(self.store)
            items = [(b.get_description(), b.id) for b in branches]
            items.insert(0, (_("Any"), None))

        if not label:
            label = _('Branch:')
        branch_filter = ComboSearchFilter(label, items)
        if current:
            branch_filter.select(current.id)

        return branch_filter
コード例 #17
0
ファイル: searchdialog.py プロジェクト: leandrorchaves/stoq
    def create_branch_filter(self, label=None):
        from stoqlib.domain.person import Branch
        branches = Branch.get_active_branches(self.store)
        items = [(b.person.name, b.id) for b in branches]
        # if not items:
        #    raise ValueError('You should have at least one branch at '
        #                      'this point')
        items.insert(0, (_("Any"), None))

        if not label:
            label = _('Branch:')
        branch_filter = ComboSearchFilter(label, items)
        current = api.get_current_branch(self.store)
        if current:
            branch_filter.select(current.id)

        return branch_filter
コード例 #18
0
    def create_branch_filter(self, label=None):
        from stoqlib.domain.person import Branch
        branches = Branch.get_active_branches(self.store)
        items = [(b.person.name, b.id) for b in branches]
        # if not items:
        #    raise ValueError('You should have at least one branch at '
        #                      'this point')
        items.insert(0, (_("Any"), None))

        if not label:
            label = _('Branch:')
        branch_filter = ComboSearchFilter(label, items)
        current = api.get_current_branch(self.store)
        if current:
            branch_filter.select(current.id)

        return branch_filter
コード例 #19
0
ファイル: api.py プロジェクト: adrianoaguiar/stoq
    def get_branches_for_filter(self, store, use_id=False):
        """Returns a list of branches to be used in a combo.

        :param use_id: If True, we will return the options using the object id
          instead of the real object.
        """
        if not api.can_see_all_branches():
            current = self.get_current_branch(store)
            if use_id:
                value = current.id
            else:
                value = current
            items = [(current.get_description(), value)]
        else:
            branches = Branch.get_active_branches(store)
            if use_id:
                items = [(b.get_description(), b.id) for b in branches]
            else:
                items = [(b.get_description(), b) for b in branches]
            items.insert(0, (_("Any"), None))
        return items
コード例 #20
0
ファイル: api.py プロジェクト: sarkis89/stoq
    def get_branches_for_filter(self, store, use_id=False):
        """Returns a list of branches to be used in a combo.

        :param use_id: If True, we will return the options using the object id
          instead of the real object.
        """
        if not api.can_see_all_branches():
            current = self.get_current_branch(store)
            if use_id:
                value = current.id
            else:
                value = current
            items = [(current.get_description(), value)]
        else:
            branches = Branch.get_active_branches(store)
            if use_id:
                items = [(b.get_description(), b.id) for b in branches]
            else:
                items = [(b.get_description(), b) for b in branches]
            items.insert(0, (_("Any"), None))
        return items
コード例 #21
0
 def get_targets(self):
     branches = Branch.get_active_branches(self._store)
     return api.for_person_combo(branches)
コード例 #22
0
ファイル: productionwizard.py プロジェクト: tmaxter/stoq
 def _fill_branch_combo(self):
     branches = Branch.get_active_branches(self.store)
     self.branch.prefill(api.for_person_combo(branches))
コード例 #23
0
 def _fill_branch_combo(self):
     branches = Branch.get_active_branches(self.store)
     self.branch.prefill(api.for_person_combo(branches))
     self.branch.set_sensitive(api.can_see_all_branches())
コード例 #24
0
 def _get_branch_values(self):
     items = [(b.person.name, b.id)
              for b in Branch.get_active_branches(self.store)]
     items.insert(0, (_('Any'), None))
     return items
コード例 #25
0
ファイル: stockdecreasewizard.py プロジェクト: Guillon88/stoq
 def _fill_branch_combo(self):
     branches = Branch.get_active_branches(self.store)
     self.branch.prefill(api.for_person_combo(branches))
     sync_mode = api.sysparam.get_bool('SYNCHRONIZED_MODE')
     self.branch.set_sensitive(not sync_mode)
コード例 #26
0
 def _fill_branch_combo(self):
     branches = Branch.get_active_branches(self.store)
     self.branch.prefill(api.for_person_combo(branches))
     sync_mode = api.sysparam.get_bool('SYNCHRONIZED_MODE')
     self.branch.set_sensitive(not sync_mode)
コード例 #27
0
 def get_targets(self):
     branches = Branch.get_active_branches(self._store)
     return stoq_api.for_person_combo(branches)
コード例 #28
0
 def setup_proxies(self):
     self.branch.prefill(
         api.for_combo(Branch.get_active_branches(self.store)))
     self.add_proxy(self.model, self.proxy_widgets)
コード例 #29
0
ファイル: test_person.py プロジェクト: rosalin/stoq
 def test_get_active_remote_branches(self):
     current_branch = get_current_branch(self.store)
     self.assertIn(current_branch, Branch.get_active_branches(self.store))
     self.assertNotIn(current_branch,
                      Branch.get_active_remote_branches(self.store))
コード例 #30
0
ファイル: salesearch.py プロジェクト: marianaanselmo/stoq
 def _get_branch_values(self):
     items = [(b.person.name, b.id) for b
              in Branch.get_active_branches(self.store)]
     items.insert(0, (_('Any'), None))
     return items
コード例 #31
0
 def test_get_active_remote_branches(self):
     current_branch = get_current_branch(self.store)
     self.assertIn(current_branch, Branch.get_active_branches(self.store))
     self.assertNotIn(current_branch,
                      Branch.get_active_remote_branches(self.store))
コード例 #32
0
ファイル: salesearch.py プロジェクト: LeonamSilva/stoq
 def _get_branch_values(self):
     items = [(b.get_description(), b.id) for b
              in Branch.get_active_branches(self.store)]
     items.insert(0, (_('Any'), None))
     return items