コード例 #1
0
ファイル: clientdetails.py プロジェクト: hackedbellini/stoq
 def on_further_details_button__clicked(self, *args):
     store = api.new_store()
     model = store.fetch(self.model)
     run_person_role_dialog(ClientEditor, self, store,
                            model, visual_mode=True)
     store.confirm(False)
     store.close()
コード例 #2
0
ファイル: clientdetails.py プロジェクト: sarkis89/stoq
 def on_further_details_button__clicked(self, *args):
     store = api.new_store()
     model = store.fetch(self.model)
     run_person_role_dialog(ClientEditor, self, store,
                            model, visual_mode=True)
     store.confirm(False)
     store.close()
コード例 #3
0
ファイル: salewizard.py プロジェクト: esosaja/stoq
    def _create_client(self):
        store = api.new_store()
        client = run_person_role_dialog(ClientEditor, self.wizard, store, None)
        store.confirm(client)

        if not client:
            return
        if len(self.client) == 0:
            self._setup_clients_widget()
            return
        clients = self.client.get_model_items().values()
        if client.id in clients:
            if client.is_active:
                self.client.select(client.id)
            else:
                # remove client from combo
                self.client.select_item_by_data(client.id)
                iter = self.client.get_active_iter()
                model = self.client.get_model()
                model.remove(iter)
                # just in case the inactive client was selected before.
                self.client.select_item_by_position(0)
        elif client.is_active:
            self.client.append_item(client.person.name, client.id)
            self.client.select(client.id)
        store.close()
コード例 #4
0
    def run_dialog(self, store, person):
        from stoqlib.domain.person import (Branch, Client, Supplier,
                                           Transporter, SalesPerson)
        from stoqlib.gui.editors.personeditor import (BranchEditor,
                                                      ClientEditor,
                                                      EmployeeEditor,
                                                      SupplierEditor,
                                                      TransporterEditor)
        editors = {
            Branch: BranchEditor,
            Client: ClientEditor,
            Supplier: SupplierEditor,
            Transporter: TransporterEditor,
            SalesPerson: EmployeeEditor,
        }
        editor = editors.get(self.person_type)
        if editor is None:  # pragma no cover
            raise NotImplementedError(self.person_type)

        # FIXME: Salesperson is edited on EmployeeEditor, so we need to get
        # that facet for the editor
        if isinstance(person, SalesPerson):
            person = person.person.employee

        from stoqlib.gui.wizards.personwizard import run_person_role_dialog
        return run_person_role_dialog(editor,
                                      self.toplevel,
                                      store,
                                      person,
                                      visual_mode=not self.can_edit)
コード例 #5
0
ファイル: saleeditor.py プロジェクト: barkinet/stoq
    def on_create_client__clicked(self, button):
        with api.new_store() as store:
            client = run_person_role_dialog(ClientEditor, self, store, None)

        if store.committed:
            self._fill_clients_combo()
            self.client.select(client.id)
コード例 #6
0
ファイル: opticalslave.py プロジェクト: rosalin/stoq
 def _run_medic_editor(self, medic=None, visual_mode=False):
     with api.trans() as store:
         medic = run_person_role_dialog(MedicEditor, self, store, medic, visual_mode=True)
     if medic:
         self._medic_combo_prefill()
         medic = self.store.fetch(medic)
         self.medic_combo.select(medic)
コード例 #7
0
 def _run_client_editor(self, client=None):
     with api.new_store() as store:
         rv = run_person_role_dialog(ClientEditor, self, store, client,
                                     visual_mode=self.visual_mode)
     if rv:
         self._fill_clients_combo()
         self.client.select(rv.id)
コード例 #8
0
ファイル: fields.py プロジェクト: adrianoaguiar/stoq
    def run_dialog(self, store, person):
        from stoqlib.domain.person import (Branch, Client, Supplier,
                                           Transporter, SalesPerson)
        from stoqlib.gui.editors.personeditor import (BranchEditor,
                                                      ClientEditor,
                                                      EmployeeEditor,
                                                      SupplierEditor,
                                                      TransporterEditor)
        editors = {
            Branch: BranchEditor,
            Client: ClientEditor,
            Supplier: SupplierEditor,
            Transporter: TransporterEditor,
            SalesPerson: EmployeeEditor,
        }
        editor = editors.get(self.person_type)
        if editor is None:  # pragma no cover
            raise NotImplementedError(self.person_type)

        # FIXME: Salesperson is edited on EmployeeEditor, so we need to get
        # that facet for the editor
        if isinstance(person, SalesPerson):
            person = person.person.employee

        from stoqlib.gui.wizards.personwizard import run_person_role_dialog
        return run_person_role_dialog(editor, self.toplevel, store, person,
                                      visual_mode=not self.can_edit)
コード例 #9
0
 def _run_client_editor(self, client=None):
     with api.trans() as store:
         rv = run_person_role_dialog(ClientEditor, self, store, client,
                                     visual_mode=self.visual_mode)
     if rv:
         self._fill_clients_combo()
         self.client.select(self.store.fetch(rv))
コード例 #10
0
ファイル: salewizard.py プロジェクト: romaia/stoq
 def _create_client(self):
     store = api.new_store()
     client = run_person_role_dialog(ClientEditor, self.wizard, store, None)
     store.confirm(client)
     client = self.store.fetch(client)
     store.close()
     if not client:
         return
     if len(self.client) == 0:
         self._fill_clients_combo()
         return
     clients = self.client.get_model_items().values()
     if client in clients:
         if client.is_active:
             self.client.select(client)
         else:
             # remove client from combo
             self.client.select_item_by_data(client)
             iter = self.client.get_active_iter()
             model = self.client.get_model()
             model.remove(iter)
             # just in case the inactive client was selected before.
             self.client.select_item_by_position(0)
     elif client.is_active:
         self.client.append_item(client.person.name, client)
         self.client.select(client)
     self._update_widgets()
コード例 #11
0
ファイル: saleeditor.py プロジェクト: leandrodax/stoq
    def on_create_client__clicked(self, button):
        with api.new_store() as store:
            client = run_person_role_dialog(ClientEditor, self, store, None)

        if store.committed:
            self._fill_clients_combo()
            self.client.select(client.id)
コード例 #12
0
ファイル: opticalslave.py プロジェクト: amaurihamasu/stoq
 def _run_medic_editor(self, medic=None, visual_mode=False):
     with api.new_store() as store:
         parent = self.get_toplevel().get_toplevel()
         medic = run_person_role_dialog(MedicEditor, parent, store, medic, visual_mode=True)
     if medic:
         self._medic_combo_prefill()
         medic = self.store.fetch(medic)
         self.medic_combo.select(medic)
コード例 #13
0
 def _run_medic_editor(self, medic=None, visual_mode=False):
     with api.trans() as store:
         medic = run_person_role_dialog(MedicEditor, self, store, medic,
                                        visual_mode=True)
     if medic:
         self._medic_combo_prefill()
         medic = self.store.fetch(medic)
         self.medic_combo.select(medic)
コード例 #14
0
ファイル: opticalwizard.py プロジェクト: reashninja/stoq
 def on_create_client__clicked(self, button):
     store = api.new_store()
     client = run_person_role_dialog(ClientEditor, self.wizard, store, None)
     retval = store.confirm(client)
     store.close()
     if retval:
         self._fill_clients_combo()
         self.client.select(client.id)
コード例 #15
0
 def _run_medic_editor(self, medic=None, visual_mode=False):
     with api.new_store() as store:
         parent = self.get_toplevel().get_toplevel()
         medic = run_person_role_dialog(MedicEditor, parent, store, medic,
                                        visual_mode=True)
     if medic:
         self._medic_combo_prefill()
         medic = self.store.fetch(medic)
         self.medic_combo.select(medic)
コード例 #16
0
 def on_create_client__clicked(self, button):
     store = api.new_store()
     client = run_person_role_dialog(ClientEditor, self.wizard, store, None)
     retval = store.confirm(client)
     client = self.store.fetch(client)
     store.close()
     if not retval:
         return
     self._fill_clients_combo()
     self.client.select(client)
コード例 #17
0
 def _run_transporter_editor(self, transporter=None):
     store = api.new_store()
     transporter = store.fetch(transporter)
     model = run_person_role_dialog(TransporterEditor, self.wizard, store, transporter)
     rv = store.confirm(model)
     store.close()
     if rv:
         self._setup_transporter_entry()
         model = self.store.fetch(model)
         self.transporter.select(model)
コード例 #18
0
ファイル: salewizard.py プロジェクト: romaia/stoq
 def on_create_transporter__clicked(self, button):
     store = api.new_store()
     transporter = store.fetch(self.model.transporter)
     model = run_person_role_dialog(TransporterEditor, self.wizard, store,
                                    transporter)
     rv = store.confirm(model)
     store.close()
     if rv:
         self._fill_transporter_combo()
         model = self.store.fetch(model)
         self.transporter.select(model)
コード例 #19
0
 def _run_supplier_dialog(self, supplier):
     store = api.new_store()
     if supplier is not None:
         supplier = store.fetch(self.model.supplier)
     model = run_person_role_dialog(SupplierEditor, self.wizard, store, supplier)
     retval = store.confirm(model)
     if retval:
         model = self.store.fetch(model)
         self._fill_supplier_combo()
         self.supplier.select(model)
     store.close()
コード例 #20
0
 def _run_transporter_editor(self, transporter=None):
     store = api.new_store()
     transporter = store.fetch(transporter)
     model = run_person_role_dialog(TransporterEditor, self.wizard, store,
                                    transporter)
     rv = store.confirm(model)
     store.close()
     if rv:
         self._setup_transporter_entry()
         model = self.store.fetch(model)
         self.transporter.select(model)
コード例 #21
0
 def on_create_transporter__clicked(self, button):
     store = api.new_store()
     transporter = store.fetch(self.model.transporter)
     model = run_person_role_dialog(TransporterEditor, self.wizard, store,
                                    transporter)
     rv = store.confirm(model)
     store.close()
     if rv:
         self._fill_transporter_combo()
         model = self.store.fetch(model)
         self.transporter.select(model)
コード例 #22
0
 def _run_supplier_dialog(self, supplier):
     store = api.new_store()
     if supplier is not None:
         supplier = store.fetch(self.model.supplier)
     model = run_person_role_dialog(SupplierEditor, self.wizard, store,
                                    supplier)
     retval = store.confirm(model)
     if retval:
         model = self.store.fetch(model)
         self._fill_supplier_combo()
         self.supplier.select(model)
     store.close()
コード例 #23
0
    def _run_editor(self):
        with api.new_store() as store:
            model = getattr(self._model, self._model_property)
            model = store.fetch(model)
            if self._is_person:
                value = run_person_role_dialog(self._editor_class, self._parent, store, model)
            else:
                value = run_dialog(self._editor_class, self._parent, store, model)

        if value:
            value = self.store.fetch(value)
            self.set_value(value)
コード例 #24
0
 def _run_client_editor(self,
                        store,
                        model,
                        description=None,
                        visual_mode=False):
     return run_person_role_dialog(ClientEditor,
                                   self.wizard,
                                   store,
                                   model,
                                   document=self.wizard._current_document,
                                   description=description,
                                   visual_mode=visual_mode)
コード例 #25
0
ファイル: fields.py プロジェクト: leandrodax/stoq
    def run_dialog(self, store, person):
        from stoqlib.domain.person import Branch, Client, Supplier, Transporter
        from stoqlib.gui.editors.personeditor import (BranchEditor,
                                                      ClientEditor,
                                                      SupplierEditor,
                                                      TransporterEditor)
        editors = {
            Branch: BranchEditor,
            Client: ClientEditor,
            Supplier: SupplierEditor,
            Transporter: TransporterEditor,
        }
        editor = editors.get(self.person_type)
        if editor is None:  # pragma no cover
            raise NotImplementedError(self.person_type)

        from stoqlib.gui.wizards.personwizard import run_person_role_dialog
        return run_person_role_dialog(editor, self.toplevel, store, person,
                                      visual_mode=not self.can_edit)
コード例 #26
0
ファイル: fields.py プロジェクト: relsi/stoq
    def run_dialog(self, store, person):
        from stoqlib.domain.person import Branch, Client, Supplier, Transporter
        from stoqlib.gui.editors.personeditor import (BranchEditor,
                                                      ClientEditor,
                                                      SupplierEditor,
                                                      TransporterEditor)
        editors = {
            Branch: BranchEditor,
            Client: ClientEditor,
            Supplier: SupplierEditor,
            Transporter: TransporterEditor,
        }
        editor = editors.get(self.person_type)
        if editor is None:  # pragma no cover
            raise NotImplementedError(self.person_type)

        from stoqlib.gui.wizards.personwizard import run_person_role_dialog
        return run_person_role_dialog(editor, self.toplevel, store, person,
                                      visual_mode=not self.can_edit)
コード例 #27
0
ファイル: personeditor.py プロジェクト: Joaldino/stoq
def test_client():  # pragma nocover
    from stoqlib.gui.wizards.personwizard import run_person_role_dialog
    creator = api.prepare_test()
    retval = run_person_role_dialog(ClientEditor, None, creator.store, None)
    creator.store.confirm(retval)
コード例 #28
0
 def _run_client_editor(self, store, model, description=None,
                        visual_mode=False):
     return run_person_role_dialog(ClientEditor, self.wizard, store, model,
                                   document=self.wizard._current_document,
                                   description=description,
                                   visual_mode=visual_mode)
コード例 #29
0
ファイル: salewizard.py プロジェクト: amaurihamasu/stoq
 def _run_client_editor(self, store, model):
     return run_person_role_dialog(ClientEditor, self.wizard, store, model,
                                   document=self.wizard._current_document)
コード例 #30
0
ファイル: personeditor.py プロジェクト: tmaxter/stoq
def test_client():  # pragma nocover
    from stoqlib.gui.wizards.personwizard import run_person_role_dialog
    creator = api.prepare_test()
    retval = run_person_role_dialog(ClientEditor, None, creator.store, None)
    creator.store.confirm(retval)
コード例 #31
0
ファイル: admin.py プロジェクト: adrianoaguiar/stoq
 def _new_user(self):
     store = api.new_store()
     model = run_person_role_dialog(UserEditor, self, store)
     store.confirm(model)
     store.close()
コード例 #32
0
ファイル: admin.py プロジェクト: victornovy/stoq
 def _new_user(self):
     store = api.new_store()
     model = run_person_role_dialog(UserEditor, self, store)
     store.confirm(model)
     store.close()
コード例 #33
0
ファイル: personsearch.py プロジェクト: rosalin/stoq
 def run_dialog(self, editor_class, parent, *args, **kwargs):
     return run_person_role_dialog(editor_class, parent, *args, **kwargs)