コード例 #1
0
ファイル: branchimporter.py プロジェクト: 5l1v3r1/stoq-1
    def when_done(self, store):
        if sysparam.has_object('MAIN_COMPANY'):
            return

        if not self.branches:
            return

        sysparam.set_object(store, 'MAIN_COMPANY', self.branches[0])
        assert sysparam.has_object('MAIN_COMPANY')
コード例 #2
0
ファイル: branchimporter.py プロジェクト: Guillon88/stoq
    def when_done(self, store):
        if sysparam.has_object('MAIN_COMPANY'):
            return

        if not self.branches:
            return

        sysparam.set_object(store, 'MAIN_COMPANY', self.branches[0])
        assert sysparam.has_object('MAIN_COMPANY')
コード例 #3
0
    def _check_branch(self):
        from stoqlib.database.runtime import (get_default_store, new_store,
                                              get_current_station,
                                              set_current_branch_station)
        from stoqlib.domain.person import Company
        from stoqlib.lib.parameters import sysparam
        from stoqlib.lib.message import info

        default_store = get_default_store()

        compaines = default_store.find(Company)
        if (compaines.count() == 0 or
                not sysparam.has_object('MAIN_COMPANY')):
            from stoqlib.gui.base.dialogs import run_dialog
            from stoqlib.gui.dialogs.branchdialog import BranchDialog
            if self._ran_wizard:
                info(_("You need to register a company before start using Stoq"))
            else:
                info(_("Could not find a company. You'll need to register one "
                       "before start using Stoq"))
            store = new_store()
            person = run_dialog(BranchDialog, None, store)
            if not person:
                raise SystemExit
            branch = person.branch
            sysparam.set_object(store, 'MAIN_COMPANY', branch)
            current_station = get_current_station(store)
            if current_station is not None:
                current_station.branch = branch
            store.commit()
            store.close()

        set_current_branch_station(default_store, station_name=None)
コード例 #4
0
ファイル: supplierimporter.py プロジェクト: 5l1v3r1/stoq-1
    def when_done(self, store):
        if sysparam.has_object('SUGGESTED_SUPPLIER'):
            return

        if not self.suppliers:
            return
        sysparam.set_object(store, 'SUGGESTED_SUPPLIER', self.suppliers[0])
コード例 #5
0
 def on_confirm(self):
     if (isinstance(self.model, Supplier) and
         not sysparam.has_object('SUGGESTED_SUPPLIER')):
         sysparam.set_object(self.store, 'SUGGESTED_SUPPLIER', self.model)
コード例 #6
0
 def on_confirm(self):
     if (isinstance(self.model, Supplier)
             and not sysparam.has_object('SUGGESTED_SUPPLIER')):
         sysparam.set_object(self.store, 'SUGGESTED_SUPPLIER', self.model)