本文整理汇总了Python中stoqlib.gui.search.searchfilters.DateSearchFilter类的典型用法代码示例。如果您正苦于以下问题:Python DateSearchFilter类的具体用法?Python DateSearchFilter怎么用?Python DateSearchFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DateSearchFilter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: search_for_date
def search_for_date(self, date):
dfilter = DateSearchFilter(_("Expected receival date"))
dfilter.set_removable()
dfilter.mode.select_item_by_position(5)
self.add_filter(dfilter, columns=["expected_receival_date"])
dfilter.start_date.set_date(date)
self.refresh()
开发者ID:LeonamSilva,项目名称:stoq,代码行数:7,代码来源:purchase.py
示例2: search_for_date
def search_for_date(self, date):
dfilter = DateSearchFilter(_("Expected receival date"))
dfilter.set_removable()
dfilter.select(data=DateSearchFilter.Type.USER_DAY)
self.add_filter(dfilter, columns=["expected_receival_date"])
dfilter.start_date.set_date(date)
self.refresh()
开发者ID:amaurihamasu,项目名称:stoq,代码行数:7,代码来源:purchase.py
示例3: MedicSalesSearch
class MedicSalesSearch(SearchDialog):
title = _(u"Sold Items by medic")
size = (800, 450)
search_spec = MedicSoldItemsView
fast_iter = True
#
# SearchDialog Hooks
#
def setup_widgets(self):
self.add_csv_button(_("Sold Products"), _("sold-products"))
self.sale_details_button = self.add_button(label=_("Sale Details"))
self.sale_details_button.show()
self.sale_details_button.set_sensitive(False)
def update_widgets(self):
item = self.results.get_selected()
self.sale_details_button.set_sensitive(bool(item))
def create_filters(self):
self.set_text_field_columns(["medic_name", "description", "code"])
# Dont set a limit here, otherwise it might break the summary
executer = self.search.get_query_executer()
executer.set_limit(-1)
branch_filter = self.create_branch_filter(_("In Branch:"))
self.add_filter(branch_filter, SearchFilterPosition.TOP, columns=[Sale.branch_id])
self._date_filter = DateSearchFilter(_("Date:"))
self._date_filter.select(data=DateSearchFilter.Type.USER_INTERVAL)
self.add_filter(self._date_filter, SearchFilterPosition.BOTTOM, columns=[Sale.confirm_date])
self.search.set_summary_label("total", label=_(u"Total:"), format="<b>%s</b>")
def get_columns(self):
columns = [
IdentifierColumn("identifier", title=_("Sale #")),
SearchColumn("open_date", title=_("Open date"), data_type=datetime.date, visible=False),
SearchColumn("confirm_date", title=_("Confirm date"), data_type=datetime.date, visible=False),
SearchColumn("code", title=_("Code"), data_type=str, sorted=True),
SearchColumn("category", title=_("Category"), data_type=str, visible=False),
SearchColumn("branch_name", title=_("Branch"), data_type=str, visible=False),
SearchColumn("description", title=_("Description"), data_type=str, expand=True),
SearchColumn("manufacturer", title=_("Manufacturer"), data_type=str, visible=False),
SearchColumn("medic_name", title=_("Medic"), data_type=str),
SearchColumn("crm_number", title=_("CRM"), data_type=str),
SearchColumn("partner", title=_("Partner"), data_type=bool, visible=False, width=40),
SearchColumn("batch_number", title=_("Batch"), data_type=str, visible=False),
SearchColumn("batch_date", title=_("Batch Date"), data_type=datetime.date, visible=False),
SearchColumn("quantity", title=_("Qty"), data_type=decimal.Decimal, format_func=format_quantity),
SearchColumn("total", title=_("Total"), data_type=currency),
]
return columns
def on_sale_details_button__clicked(self, widget):
item = self.results.get_selected()
sale_view = self.store.find(SaleView, id=item.sale_id).one()
run_dialog(SaleDetailsDialog, self, self.store, sale_view)
开发者ID:EasyDevSolutions,项目名称:stoq,代码行数:60,代码来源:medicssearch.py
示例4: ProductsSoldSearch
class ProductsSoldSearch(ProductSearch):
title = _('Products Sold Search')
search_spec = SoldItemView
report_class = ProductsSoldReport
csv_data = None
has_print_price_button = False
advanced_search = False
text_field_columns = [SoldItemView.description]
branch_filter_column = Sale.branch_id
def __init__(self, store, hide_footer=True, hide_toolbar=True):
ProductSearch.__init__(self, store, hide_footer=hide_footer,
hide_toolbar=hide_toolbar)
#
# ProductSearch
#
def create_filters(self):
self.date_filter = DateSearchFilter(_('Date:'))
self.date_filter.select(Today)
self.add_filter(self.date_filter, columns=[Sale.confirm_date])
def get_columns(self):
return [Column('code', title=_('Code'), data_type=str,
sorted=True),
Column('description', title=_('Description'),
data_type=str, expand=True),
QuantityColumn('quantity', title=_('Sold')),
Column('average_cost', title=_('Avg. Cost'),
data_type=currency), ]
开发者ID:Joaldino,项目名称:stoq,代码行数:31,代码来源:productsearch.py
示例5: FinancialReportDialog
class FinancialReportDialog(BasicDialog):
title = _("Financial Report Dialog")
def __init__(self, store):
self.store = store
self.date_filter = DateSearchFilter(_("Year:"))
self.date_filter.clear_options()
self._populate_date_filter(self.date_filter)
self.date_filter.select()
self.date_filter.set_use_date_entries(False)
BasicDialog.__init__(self, title=self.title)
self.main_label.set_justify(gtk.JUSTIFY_CENTER)
self.ok_button.set_label(_("Generate"))
self.add(self.date_filter)
self.date_filter.show()
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()
self.temporary = temporary
#
# Private
#
def _populate_date_filter(self, date_filter):
transaction = self.store.find(AccountTransaction).order_by(AccountTransaction.date).first()
if transaction is None:
return
for i in range(transaction.date.year, localtoday().year + 1):
year = datetime.datetime(i, 1, 1)
date_filter.add_option_fixed_interval(_("Year %d") % (i,), year, year.replace(month=12, day=31), position=0)
def _date_filter_query(self, search_spec, column):
executer = QueryExecuter(self.store)
executer.set_filter_columns(self.date_filter, [column])
executer.set_search_spec(search_spec)
return executer.search([self.date_filter.get_state()])
开发者ID:EasyDevSolutions,项目名称:stoq,代码行数:59,代码来源:financialreportdialog.py
示例6: search_for_date
def search_for_date(self, date):
self.main_filter.select(None)
dfilter = DateSearchFilter(_("Paid or due date"))
dfilter.set_removable()
dfilter.mode.select_item_by_position(5)
self.add_filter(dfilter, columns=["paid_date", "due_date"])
dfilter.start_date.set_date(date)
self.search.refresh()
开发者ID:tmaxter,项目名称:stoq,代码行数:8,代码来源:receivable.py
示例7: search_for_date
def search_for_date(self, date):
self.main_filter.combo.select(self._not_delivered_filter_item)
dfilter = DateSearchFilter(_("Estimated finish"))
dfilter.set_removable()
dfilter.select(data=DateSearchFilter.Type.USER_DAY)
self.add_filter(dfilter, columns=["estimated_finish"])
dfilter.start_date.set_date(date)
self.refresh()
开发者ID:igorferreira,项目名称:stoq,代码行数:8,代码来源:services.py
示例8: search_for_date
def search_for_date(self, date):
self.main_filter.select(None)
dfilter = DateSearchFilter(_("Paid or due date"))
dfilter.set_removable()
dfilter.select(data=DateSearchFilter.Type.USER_DAY)
self.add_filter(dfilter, columns=["paid_date", "due_date"])
dfilter.start_date.set_date(date)
self.refresh()
开发者ID:EasyDevSolutions,项目名称:stoq,代码行数:8,代码来源:receivable.py
示例9: create_filters
def create_filters(self):
# Extra filters (that are not columns)
self.search.add_filter_option(SellableCategory.description, title=_(u"Product category"), data_type=str)
self.search.add_filter_option(Sellable.description, title=_(u"Product"), data_type=str)
# Date
date_filter = DateSearchFilter(_("Date:"))
date_filter.select(Today)
self.add_filter(date_filter, columns=[Sale.confirm_date])
开发者ID:coletivoEITA,项目名称:stoq,代码行数:9,代码来源:personsearch.py
示例10: create_filters
def create_filters(self):
# Date
date_filter = DateSearchFilter(_('Date:'))
date_filter.select(Today)
columns = [ProductHistory.sold_date,
ProductHistory.received_date,
ProductHistory.production_date,
ProductHistory.decreased_date]
self.add_filter(date_filter, columns=columns)
self.date_filter = date_filter
开发者ID:Joaldino,项目名称:stoq,代码行数:10,代码来源:productsearch.py
示例11: create_filters
def create_filters(self):
self.set_text_field_columns(["description", "identifier_str"])
self.search.set_query(self.executer_query)
# Date
date_filter = DateSearchFilter(_("Date:"))
date_filter.select(0)
columns = [Payment.due_date, Payment.open_date, Payment.paid_date]
self.add_filter(date_filter, columns=columns)
self.date_filter = date_filter
开发者ID:amaurihamasu,项目名称:stoq,代码行数:10,代码来源:paymentreceivingsearch.py
示例12: PaymentFlowHistoryDialog
class PaymentFlowHistoryDialog(BasicDialog):
title = _(u'Payment Flow History Dialog')
desc = _("Select a date or a range to be visualised in the report:")
size = (-1, -1)
model_type = PaymentFlowDay
def __init__(self, store):
"""A dialog to print the PaymentFlowHistoryReport report.
:param store: a store
"""
self.store = store
BasicDialog.__init__(self, header_text='<b>%s</b>' % self.desc,
title=self.title)
self._setup_widgets()
#
# BasicDialog
#
def confirm(self):
state = self._date_filter.get_state()
from stoqlib.database.queryexecuter import DateQueryState
if isinstance(state, DateQueryState):
start, end = state.date, state.date
else:
start, end = state.start, state.end
results = PaymentFlowDay.get_flow_history(self.store, start, end)
if not results:
info(_('No payment history found.'))
return False
print_report(PaymentFlowHistoryReport, payment_histories=results)
return True
#
# Private
#
def _setup_widgets(self):
self.ok_button.set_label(gtk.STOCK_PRINT)
self._date_filter = DateSearchFilter(_(u'Date:'))
# FIXME: add a remove_option method in DateSearchFilter.
self._date_filter.clear_options()
self._date_filter.add_custom_options()
for option in [Today, Yesterday, LastWeek, LastMonth]:
self._date_filter.add_option(option)
self._date_filter.select(position=0)
self.vbox.pack_start(self._date_filter, False, False)
self._date_filter.show_all()
开发者ID:LeonamSilva,项目名称:stoq,代码行数:53,代码来源:paymentflowhistorydialog.py
示例13: create_filters
def create_filters(self):
self.set_text_field_columns(['description'])
self.executer.set_query(self.executer_query)
# Date
date_filter = DateSearchFilter(_('Date:'))
date_filter.select(0)
columns = [Payment.due_date,
Payment.open_date,
Payment.paid_date]
self.add_filter(date_filter, columns=columns)
self.date_filter = date_filter
开发者ID:tmaxter,项目名称:stoq,代码行数:12,代码来源:paymentreceivingsearch.py
示例14: _setup_widgets
def _setup_widgets(self):
# Branches combo
items = api.get_branches_for_filter(self.store)
self.branch.prefill(items)
# Daterange filter
self.date_filter = DateSearchFilter(_(u'Date:'))
self.date_filter.clear_options()
self.date_filter.add_custom_options()
for option in [Today, Yesterday, LastWeek, LastMonth]:
self.date_filter.add_option(option)
self.date_filter.select(position=0)
self.daterange_hbox.pack_start(self.date_filter, False, False, 0)
self.date_filter.show_all()
# Setting report lists' columns
self.sales_list.set_columns(self._get_sales_columns())
self.inpayments_list.set_columns(self._get_lonely_payments_columns())
self.purchases_list.set_columns(self._get_purchases_columns())
self.outpayments_list.set_columns(self._get_lonely_payments_columns())
self.return_sales_list.set_columns(self._get_return_sales_columns())
self.supplies_list.set_columns(self._get_till_columns())
self.removals_list.set_columns(self._get_till_columns())
self.permethod_list.set_columns(self._get_permethod_columns())
self.percard_list.set_columns(self._get_percard_columns())
# Print button is insensitive, until the first report is generated
self.print_button.set_sensitive(False)
self._setup_summary_labels()
开发者ID:hackedbellini,项目名称:stoq,代码行数:30,代码来源:tilldailymovement.py
示例15: DateRangeDialog
class DateRangeDialog(BasicDialog):
"""A simple dialog for selecting a date range
When confirmed, a :class:`date_range` object will be returned
containig the information about the date range selected
"""
title = _(u'Select a date range')
size = (-1, -1)
def __init__(self, title=None, header_text=None):
title = title or self.title
header_text = '<b>%s</b>' % header_text if header_text else ''
BasicDialog.__init__(self, title=title, header_text=header_text)
self._setup_widgets()
#
# BasicDialog
#
def confirm(self):
BasicDialog.confirm(self)
state = self.date_filter.get_state()
if isinstance(state, DateQueryState):
start, end = state.date, state.date
else:
start, end = state.start, state.end
self.retval = date_range(start=start, end=end)
#
# Private
#
def _setup_widgets(self):
self.date_filter = DateSearchFilter(_(u'Date:'))
# FIXME: add a remove_option method in DateSearchFilter.
self.date_filter.clear_options()
self.date_filter.add_custom_options()
for option in [Today, Yesterday, LastWeek, LastMonth]:
self.date_filter.add_option(option)
self.date_filter.select(position=0)
self.vbox.pack_start(self.date_filter, False, False)
self.date_filter.show_all()
开发者ID:Guillon88,项目名称:stoq,代码行数:47,代码来源:daterangedialog.py
示例16: create_filters
def create_filters(self):
self.set_text_field_columns(['description'])
self.date_filter = DateSearchFilter(_('Date:'))
self.date_filter.select(Today)
self.add_filter(self.date_filter, columns=['date'])
# add summary label
value_format = '<b>%s</b>'
total_label = '<b>%s</b>' % api.escape(_(u'Total:'))
self.search.set_summary_label('value', total_label, value_format)
开发者ID:leandrorchaves,项目名称:stoq,代码行数:10,代码来源:tillhistory.py
示例17: create_filters
def create_filters(self):
self.set_text_field_columns(['description'])
# Date
date_filter = DateSearchFilter(_('Date:'))
date_filter.select(Today)
columns = [ProductHistory.sold_date,
ProductHistory.received_date,
ProductHistory.production_date,
ProductHistory.decreased_date]
self.add_filter(date_filter, columns=columns)
self.date_filter = date_filter
# Branch
self.branch_filter = self.create_branch_filter(_('In branch:'))
self.add_filter(self.branch_filter, columns=['branch'],
position=SearchFilterPosition.TOP)
# remove 'Any' option from branch_filter
self.branch_filter.combo.remove_text(0)
开发者ID:leandrorchaves,项目名称:stoq,代码行数:19,代码来源:productsearch.py
示例18: _setup_widgets
def _setup_widgets(self):
self.date_filter = DateSearchFilter(_(u'Date:'))
# FIXME: add a remove_option method in DateSearchFilter.
self.date_filter.clear_options()
self.date_filter.add_custom_options()
for option in [Today, Yesterday, LastWeek, LastMonth]:
self.date_filter.add_option(option)
self.date_filter.select(position=0)
self.vbox.pack_start(self.date_filter, False, False)
self.date_filter.show_all()
开发者ID:Guillon88,项目名称:stoq,代码行数:11,代码来源:daterangedialog.py
示例19: SoldItemsByClientSearch
class SoldItemsByClientSearch(SearchDialog):
title = _(u'Sold Items by Client')
report_class = SoldItemsByClientReport
search_spec = SoldItemsByClient
size = (800, 450)
unlimited_results = True
text_field_columns = [SoldItemsByClient.client_name,
SoldItemsByClient.description,
SoldItemsByClient.code]
branch_filter_column = Sale.branch_id
def setup_widgets(self):
self.add_csv_button(_('Sale items'), _('sale items'))
def create_filters(self):
self._date_filter = DateSearchFilter(_("Date:"))
self._date_filter.select(data=DateSearchFilter.Type.USER_INTERVAL)
self.add_filter(self._date_filter, columns=[Sale.confirm_date])
self.search.set_summary_label('quantity', label=_(u'Total:'),
format='<b>%s</b>')
def get_columns(self):
columns = [
SearchColumn('code', title=_('Code'), data_type=str, sorted=True,
order=Gtk.SortType.DESCENDING),
SearchColumn('description', title=_('Description'),
data_type=str, expand=True),
SearchColumn('client_name', title=_('Client'), data_type=str),
SearchColumn('phone_number', title=_('Phone'), data_type=str,
visible=False, format_func=format_phone_number),
SearchColumn('email', title=_('Email'), data_type=str,
visible=False),
SearchColumn('sellable_category', title=_('Category'), data_type=str,
visible=False),
QuantityColumn('quantity', title=_('Qty'), use_having=True),
SearchColumn('price', title=_('Avg price'), data_type=currency,
use_having=True),
SearchColumn('total', title=_('Total'), data_type=currency,
use_having=True)
]
return columns
开发者ID:hackedbellini,项目名称:stoq,代码行数:41,代码来源:salesearch.py
示例20: create_filters
def create_filters(self):
self.set_text_field_columns(["medic_name", "description", "code"])
# Dont set a limit here, otherwise it might break the summary
executer = self.search.get_query_executer()
executer.set_limit(-1)
branch_filter = self.create_branch_filter(_("In Branch:"))
self.add_filter(branch_filter, SearchFilterPosition.TOP, columns=[Sale.branch_id])
self._date_filter = DateSearchFilter(_("Date:"))
self._date_filter.select(data=DateSearchFilter.Type.USER_INTERVAL)
self.add_filter(self._date_filter, SearchFilterPosition.BOTTOM, columns=[Sale.confirm_date])
self.search.set_summary_label("total", label=_(u"Total:"), format="<b>%s</b>")
开发者ID:EasyDevSolutions,项目名称:stoq,代码行数:14,代码来源:medicssearch.py
注:本文中的stoqlib.gui.search.searchfilters.DateSearchFilter类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论