示例#1
0
文件: shellapp.py 项目: rg3915/stoq
    def export_spreadsheet_activate(self):
        """Called when the Export menu item is activated"""
        if self.search_spec is None:
            raise NotImplementedError

        sse = SpreadSheetExporter()
        sse.export(object_list=self.results, name=self.app_name, filename_prefix=self.app_name)
示例#2
0
    def export_spreadsheet_activate(self):
        """Called when the Export menu item is activated"""
        if self.search_table is None:
            raise NotImplementedError

        sse = SpreadSheetExporter()
        sse.export(object_list=self.results,
                   name=self.app_name,
                   filename_prefix=self.app.name)
示例#3
0
 def _export_spreadsheet(self):
     """Runs a dialog to export the current search results to a CSV file.
     """
     if self._is_accounts_tab():
         run_dialog(FinancialReportDialog, self, self.store)
     else:
         page = self.get_current_page()
         sse = SpreadSheetExporter()
         sse.export(object_list=page.result_view,
                    name=self.app_title,
                    filename_prefix=self.app_name)
示例#4
0
    def export_spreadsheet_activate(self):
        """Called when the Export menu item is activated"""
        if self.search_spec is None:
            raise NotImplementedError

        model = self.results.get_model()
        if isinstance(model, LazyObjectModel):
            model.load_items_from_results(0, model._count)

        sse = SpreadSheetExporter()
        sse.export(object_list=self.results, name=self.app_name, filename_prefix=self.app_name)
示例#5
0
    def export_spreadsheet_activate(self):
        """Called when the Export menu item is activated"""
        if self.search_spec is None:
            raise NotImplementedError

        model = self.results.get_model()
        if isinstance(model, LazyObjectModel):
            model.load_items_from_results(0, model._count)

        sse = SpreadSheetExporter()
        sse.export(object_list=self.results,
                   name=self.app_name,
                   filename_prefix=self.app_name)
示例#6
0
文件: shellapp.py 项目: pkaislan/stoq
    def export_spreadsheet_activate(self):
        """Called when the Export menu item is activated"""
        if self.search_spec is None:
            raise NotImplementedError

        if api.sysparam.get_bool('SMART_LIST_LOADING'):
            model = self.results.get_model()
            model.load_items_from_results(0, model._count)

        sse = SpreadSheetExporter()
        sse.export(object_list=self.results,
                   name=self.app_name,
                   filename_prefix=self.app_name)
示例#7
0
    def _on_export_csv_button__clicked(self, widget):
        if not self.unlimited_results:
            executer = self.search.get_query_executer()
            data = executer.search(limit=-1)
        else:
            # The results are already unlimited, let the exporter get the data
            # from the objectlist
            data = None

        sse = SpreadSheetExporter()
        sse.export(object_list=self.results,
                   data=data,
                   name=self._csv_name,
                   filename_prefix=self._csv_prefix)
示例#8
0
    def _on_export_csv_button__clicked(self, widget):
        if not self.unlimited_results:
            executer = self.search.get_query_executer()
            data = executer.search(limit=-1)
        else:
            # The results are already unlimited, let the exporter get the data
            # from the objectlist
            data = None

        sse = SpreadSheetExporter()
        sse.export(object_list=self.results,
                   data=data,
                   name=self._csv_name,
                   filename_prefix=self._csv_prefix)
    def test_export_open(self):
        api.user_settings.set('spreadsheet-action', 'open')

        sse = SpreadSheetExporter()
        with mock.patch.object(sse, '_open_application') as _open:
            self._run_exporter(sse)
            self.assertTrue(_open.call_count, 1)
示例#10
0
    def _on_export_csv_button__clicked(self, widget):
        if not self.unlimited_results:
            # FIXME: This is making the filters set by the user be respected
            # when exporting the results.
            executer = self.search.get_query_executer()
            states = [(sf.get_state()) for sf in self.search.get_search_filters()]
            data = executer.search(states, limit=-1)
        else:
            # The results are already unlimited, let the exporter get the data
            # from the objectlist
            data = None

        sse = SpreadSheetExporter()
        sse.export(object_list=self.results,
                   data=data,
                   name=self._csv_name,
                   filename_prefix=self._csv_prefix)
示例#11
0
    def _on_export_csv_button__clicked(self, widget):
        if not self.unlimited_results:
            # FIXME: This is making the filters set by the user be respected
            # when exporting the results.
            executer = self.search.get_query_executer()
            states = [(sf.get_state())
                      for sf in self.search.get_search_filters()]
            data = executer.search(states, limit=-1)
        else:
            # The results are already unlimited, let the exporter get the data
            # from the objectlist
            data = None

        sse = SpreadSheetExporter()
        sse.export(object_list=self.results,
                   data=data,
                   name=self._csv_name,
                   filename_prefix=self._csv_prefix)
    def confirm(self):
        start = self.date_filter.get_start_date()
        if start is None:
            warning(_("There are no transactions yet"))
            return

        f = FinancialIntervalReport(self.store, start.year)
        if not f.run():
            return
        temporary = tempfile.NamedTemporaryFile(
            # Translators: This will be part of a filename
            prefix=_('stoq-yearly-report'),
            suffix='.xls', delete=False)
        f.write(temporary)
        sse = SpreadSheetExporter()
        sse.export_temporary(temporary)

        self.close()
示例#13
0
    def confirm(self):
        start = self.date_filter.get_start_date()
        if start is None:
            warning(_("There are no transactions yet"))
            return

        f = FinancialIntervalReport(self.store, start.year)
        if not f.run():
            return
        temporary = tempfile.NamedTemporaryFile(
            # Translators: This will be part of a filename
            prefix=_('stoq-yearly-report'),
            suffix='.xls',
            delete=False)
        f.write(temporary)
        sse = SpreadSheetExporter()
        sse.export_temporary(temporary)

        self.close()
    def test_export_ask(self, yesno):
        # XXX: We should not be using yesno for a save/open question
        yesno.return_value = False

        api.user_settings.set('spreadsheet-action', 'ask')

        sse = SpreadSheetExporter()
        with mock.patch.object(sse, '_open_application') as _open:
            self._run_exporter(sse)
            self.assertTrue(_open.call_count, 1)

        yesno.assert_called_once_with(
            ('A spreadsheet has been created, what do '
             'you want to do with it?'), Gtk.ResponseType.NO,
            'Save it to disk', 'Open with App Name')
示例#15
0
 def _on_export_csv_button__clicked(self, widget):
     sse = SpreadSheetExporter()
     sse.export(object_list=self.results, name=_("Fiscal book"), filename_prefix=_("fiscal-book"))
示例#16
0
 def _on_export_csv_button__clicked(self, widget):
     sse = SpreadSheetExporter()
     sse.export(object_list=self.results,
                name=_('Sales'),
                filename_prefix=_('sales'))
示例#17
0
 def _export_csv(self, object_list, name, filename_prefix):
     sse = SpreadSheetExporter()
     sse.export(object_list=object_list,
                name=name,
                filename_prefix=filename_prefix)
示例#18
0
 def _export_csv(self, object_list, name, filename_prefix):
     sse = SpreadSheetExporter()
     sse.export(object_list=object_list,
                name=name,
                filename_prefix=filename_prefix)
示例#19
0
 def _export_csv(self):
     sse = SpreadSheetExporter()
     sse.export(object_list=self.ordered_items,
                name=_('Purchase items'),
                filename_prefix=_('purchase-items'))
示例#20
0
文件: callsearch.py 项目: romaia/stoq
 def _on_export_csv_button__clicked(self, widget):
     sse = SpreadSheetExporter()
     sse.export(object_list=self.results,
                name=_('Calls'),
                filename_prefix=_('calls'))
示例#21
0
 def on_export_button__clicked(self, button):
     sse = SpreadSheetExporter()
     sse.export(object_list=self.items_list,
                name=_('Purchase items'),
                filename_prefix=_('purchase-items'))
示例#22
0
 def on_export_button__clicked(self, button):
     sse = SpreadSheetExporter()
     sse.export(object_list=self.items_list,
                name=_('Purchase items'),
                filename_prefix=_('purchase-items'))
示例#23
0
 def on_csv_button__clicked(self, widget):
     sse = SpreadSheetExporter()
     sse.export(object_list=self.results,
                name=_('Brands'),
                filename_prefix=_('brands'))
示例#24
0
 def on_csv_button__clicked(self, widget):
     sse = SpreadSheetExporter()
     sse.export(object_list=self.results,
                name=_('Brands'),
                filename_prefix=_('brands'))
示例#25
0
 def _export_csv(self):
     sse = SpreadSheetExporter()
     sse.export(object_list=self.ordered_items,
                name=_('Purchase items'),
                filename_prefix=_('purchase-items'))