本文整理汇总了Python中stoqlib.gui.dialogs.missingitemsdialog.get_missing_items函数的典型用法代码示例。如果您正苦于以下问题:Python get_missing_items函数的具体用法?Python get_missing_items怎么用?Python get_missing_items使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_missing_items函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: finish
def finish(self):
missing = get_missing_items(self.model, self.store)
if missing:
run_dialog(MissingItemsDialog, self, self.model, missing)
return False
order = TransferOrder(
open_date=self.model.open_date,
receival_date=self.model.receival_date,
source_branch=self.model.source_branch,
destination_branch=self.model.destination_branch,
source_responsible=self.model.source_responsible,
destination_responsible=self.model.destination_responsible,
store=self.store)
for item in self.model.get_items():
transfer_item = order.add_sellable(item.sellable,
quantity=item.quantity,
batch=item.batch)
transfer_item.send()
# XXX Waiting for transfer order receiving wizard implementation
order.receive()
self.retval = self.model
self.close()
StockTransferWizardFinishEvent.emit(order)
self._receipt_dialog(order)
示例2: finish
def finish(self):
missing = get_missing_items(self.model, self.store)
if missing:
# We want to close the checkout, so the user will be back to the
# list of items in the sale.
self.close()
run_dialog(MissingItemsDialog, self, self.model, missing)
return False
self.retval = True
invoice_number = self.invoice_model.invoice_number
# Workaround for bug 4218: If the invoice is was already used by
# another store (another cashier), try using the next one
# available, or show a warning if the number was manually set.
while True:
try:
self.store.savepoint('before_set_invoice_number')
self.model.invoice_number = invoice_number
# We need to flush the database here, or a possible collision
# of invoice_number will only be detected later on, when the
# execution flow is not in the try-except anymore.
self.store.flush()
except IntegrityError:
self.store.rollback_to_savepoint('before_set_invoice_number')
if self._invoice_changed():
warning(_(u"The invoice number %s is already used. "
"Confirm the sale again to chose another one.") %
invoice_number)
self.retval = False
break
else:
invoice_number += 1
else:
break
self.close()
group = self.model.group
# FIXME: This is set too late on Sale.confirm(). If PaymentGroup don't
# have a payer, we won't be able to print bills/booklets.
group.payer = self.model.client and self.model.client.person
# Commit before printing to avoid losing data if something breaks
self.store.confirm(self.retval)
ConfirmSaleWizardFinishEvent.emit(self.model)
booklets = list(group.get_payments_by_method_name(u'store_credit'))
bills = list(group.get_payments_by_method_name(u'bill'))
if (booklets and
yesno(_("Do you want to print the booklets for this sale?"),
gtk.RESPONSE_YES, _("Print booklets"), _("Don't print"))):
print_report(BookletReport, booklets)
if (bills and BillReport.check_printable(bills) and
yesno(_("Do you want to print the bills for this sale?"),
gtk.RESPONSE_YES, _("Print bills"), _("Don't print"))):
print_report(BillReport, bills)
示例3: finish
def finish(self):
missing = get_missing_items(self.model, self.store)
if missing:
run_dialog(MissingItemsDialog, self, self.model, missing)
return False
self.model.sync_stock()
self.retval = self.model
self.close()
NewLoanWizardFinishEvent.emit(self.model)
self._print_receipt(self.model)
示例4: finish
def finish(self):
missing = get_missing_items(self.model, self.store)
if missing:
run_dialog(MissingItemsDialog, self, self.model, missing)
return False
self.retval = self.model
self.model.confirm()
self.close()
StockDecreaseWizardFinishEvent.emit(self.model)
self._receipt_dialog()
示例5: _confirm_order
def _confirm_order(self, order_view):
if self.check_open_inventory():
return
store = api.new_store()
sale = store.fetch(order_view.sale)
expire_date = sale.expire_date
if (sale.status == Sale.STATUS_QUOTE and
expire_date and expire_date.date() < date.today() and
not yesno(_("This quote has expired. Confirm it anyway?"),
gtk.RESPONSE_YES,
_("Confirm quote"), _("Don't confirm"))):
store.close()
return
missing = get_missing_items(sale, store)
if missing:
retval = run_dialog(MissingItemsDialog, self, sale, missing)
if retval:
self.refresh()
store.close()
return
coupon = self._open_coupon(sale)
if not coupon:
store.close()
return
subtotal = self._add_sale_items(sale, coupon)
try:
if coupon.confirm(sale, store, subtotal=subtotal):
workorders = WorkOrder.find_by_sale(store, sale)
for order in workorders:
# at this poing, orders could be either FINISHED or
# DELIVERED (closed). If it is finished, we should close it
# (mark delivered) ...
if order.can_close():
order.close()
else:
# ... but if it didn't need closing, it should already
# be delivered.
assert order.is_finished()
store.commit()
self.refresh()
else:
coupon.cancel()
except SellError as err:
warning(str(err))
except ModelDataError as err:
warning(str(err))
store.close()
示例6: finish
def finish(self):
missing = get_missing_items(self.model, self.store)
if missing:
run_dialog(MissingItemsDialog, self, self.model, missing)
return False
self.model.sync_stock()
self.retval = self.model
self.close()
# Confirm before printing to avoid losing data if something breaks
self.store.confirm(self.retval)
NewLoanWizardFinishEvent.emit(self.model)
self._print_receipt(self.model)
示例7: finish
def finish(self):
missing = get_missing_items(self.model, self.store)
if missing:
run_dialog(MissingItemsDialog, self, self.model, missing)
return False
self.retval = self.model
self.model.confirm()
self.close()
StockDecreaseWizardFinishEvent.emit(self.model)
# Commit before printing to avoid losing data if something breaks
self.store.confirm(self.retval)
self._receipt_dialog()
示例8: finish
def finish(self):
missing = get_missing_items(self.model, self.store)
if missing:
# We want to close the checkout, so the user will be back to the
# list of items in the sale.
self.close()
run_dialog(MissingItemsDialog, self, self.model, missing)
return False
self.retval = True
invoice_number = self.invoice_model.invoice_number
# Workaround for bug 4218: If the invoice is was already used by
# another store (another cashier), try using the next one
# available, or show a warning if the number was manually set.
while True:
try:
self.store.savepoint('before_set_invoice_number')
self.model.invoice_number = invoice_number
# We need to flush the database here, or a possible collision
# of invoice_number will only be detected later on, when the
# execution flow is not in the try-except anymore.
self.store.flush()
except IntegrityError:
self.store.rollback_to_savepoint('before_set_invoice_number')
if self._invoice_changed():
warning(_(u"The invoice number %s is already used. "
"Confirm the sale again to chose another one.") %
invoice_number)
self.retval = False
break
else:
invoice_number += 1
else:
break
self.close()
group = self.model.group
# FIXME: This is set too late on Sale.confirm(). If PaymentGroup don't
# have a payer, we won't be able to print bills/booklets.
group.payer = self.model.client and self.model.client.person
retval = ConfirmSaleWizardFinishEvent.emit(self.model)
if retval is not None:
self.retval = retval
if sysparam.get_bool('PRINT_SALE_DETAILS_ON_POS'):
self.print_sale_details()
示例9: test_get_missing_items
def test_get_missing_items(self):
sale = self.create_sale()
stock_item = self.create_sale_item(sale=sale)
missing_item = self.create_sale_item(sale=sale)
stock_storable = self.create_storable(product=stock_item.sellable.product)
missing_storable = self.create_storable(product=missing_item.sellable.product)
self.create_product_stock_item(storable=stock_storable, quantity=1)
self.create_product_stock_item(storable=missing_storable, quantity=0)
missing = get_missing_items(sale, self.store)
self.assertEquals(missing[0].storable, missing_storable)
示例10: _confirm_order
def _confirm_order(self, order_view):
if self.check_open_inventory():
return
store = api.new_store()
sale = store.fetch(order_view.sale)
expire_date = sale.expire_date
if (sale.status == Sale.STATUS_QUOTE and
expire_date and expire_date.date() < date.today() and
not yesno(_("This quote has expired. Confirm it anyway?"),
gtk.RESPONSE_YES,
_("Confirm quote"), _("Don't confirm"))):
store.close()
return
missing = get_missing_items(sale, store)
if missing:
retval = run_dialog(MissingItemsDialog, self, sale, missing)
if retval:
self.refresh()
store.close()
return
coupon = self._open_coupon()
if not coupon:
store.close()
return
subtotal = self._add_sale_items(sale, coupon)
try:
if coupon.confirm(sale, store, subtotal=subtotal):
workorders = WorkOrder.find_by_sale(store, sale)
for order in workorders:
order.close()
store.commit()
self.refresh()
else:
coupon.cancel()
except SellError as err:
warning(str(err))
except ModelDataError as err:
warning(str(err))
store.close()
示例11: finish
def finish(self):
missing = get_missing_items(self.model, self.store)
if missing:
run_dialog(MissingItemsDialog, self, self.model, missing)
return False
# If this wizard is for a purchase return, the items are automatically
# added so the tax check escaped. So we do it now.
if self.receiving_order is not None:
missing_tax_info = []
for item in self.model.get_items():
sellable = item.sellable
try:
sellable.check_taxes_validity()
except TaxError:
missing_tax_info.append(sellable.description)
if missing_tax_info:
warning(_("There are some items with missing tax information"),
', '.join(missing_tax_info))
return False
invoice_ok = InvoiceSetupEvent.emit()
if invoice_ok is False:
# If there is any problem with the invoice, the event will display an error
# message and the dialog is kept open so the user can fix whatever is wrong.
return
self.retval = self.model
self.store.confirm(self.model)
self.model.confirm()
self.close()
StockDecreaseWizardFinishEvent.emit(self.model)
# Commit before printing to avoid losing data if something breaks
self.store.confirm(self.retval)
self._receipt_dialog()