本文整理汇总了Python中stoqlib.domain.person.Branch.get_active_remote_branches方法的典型用法代码示例。如果您正苦于以下问题:Python Branch.get_active_remote_branches方法的具体用法?Python Branch.get_active_remote_branches怎么用?Python Branch.get_active_remote_branches使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stoqlib.domain.person.Branch
的用法示例。
在下文中一共展示了Branch.get_active_remote_branches方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_cancel_order_nfce_plugin_active
# 需要导入模块: from stoqlib.domain.person import Branch [as 别名]
# 或者: from stoqlib.domain.person.Branch import get_active_remote_branches [as 别名]
def test_cancel_order_nfce_plugin_active(self, get_plugin_manager,
run_dialog):
dest_branch = Branch.get_active_remote_branches(self.store)[0]
source_branch = api.get_current_branch(self.store)
order = self.create_transfer_order(source_branch=source_branch,
dest_branch=dest_branch)
self.create_transfer_order_item(order=order)
order.identifier = 28474
order.open_date = localdatetime(2012, 2, 2)
order.send()
dialog = TransferOrderDetailsDialog(self.store, order)
self.assertSensitive(dialog, ['cancel_button'])
get_plugin_manager.is_active.return_value = True
run_dialog.return_value = Note()
with mock.patch.object(self.store, 'commit'):
self.click(dialog.cancel_button)
msg_text = u"This will cancel the transfer. Are you sure?"
run_dialog.assert_called_once_with(
NoteEditor, dialog, order.store, model=None,
message_text=msg_text, label_text=u"Reason", mandatory=True,
ok_button_label=u"Cancel transfer",
cancel_button_label=u"Don't cancel",
min_length=15)
self.assertEqual(order.status, TransferOrder.STATUS_CANCELLED)
self.assertEqual(order.receival_date, None)
示例2: _create_domain
# 需要导入模块: from stoqlib.domain.person import Branch [as 别名]
# 或者: from stoqlib.domain.person.Branch import get_active_remote_branches [as 别名]
def _create_domain(self):
self.clean_domain([TransferOrderItem, TransferOrder])
source_branch = Branch.get_active_remote_branches(self.store)[0]
dest_branch = api.get_current_branch(self.store)
# Created order, did not send it yet.
order = self.create_transfer_order(source_branch=source_branch,
dest_branch=dest_branch)
self.create_transfer_order_item(order=order)
order.identifier = 75168
order.open_date = localdatetime(2012, 1, 1)
# Created and sent the order.
order = self.create_transfer_order(source_branch=source_branch,
dest_branch=dest_branch)
self.create_transfer_order_item(order=order)
order.identifier = 56832
order.open_date = localdatetime(2012, 2, 2)
order.send()
# Order arrived at the destination.
order = self.create_transfer_order(source_branch=source_branch,
dest_branch=dest_branch)
self.create_transfer_order_item(order=order)
order.identifier = 20486
order.open_date = localdatetime(2012, 3, 3)
order.send()
order.receive(self.create_employee())
order.receival_date = localdatetime(2012, 3, 4)
示例3: _setup_widgets
# 需要导入模块: from stoqlib.domain.person import Branch [as 别名]
# 或者: from stoqlib.domain.person.Branch import get_active_remote_branches [as 别名]
def _setup_widgets(self):
branches = Branch.get_active_remote_branches(self.store)
self.destination_branch.prefill(api.for_person_combo(branches))
self.source_branch.set_text(self.branch.get_description())
employees = self.store.find(Employee)
self.source_responsible.prefill(api.for_person_combo(employees))
示例4: test_receive_order
# 需要导入模块: from stoqlib.domain.person import Branch [as 别名]
# 或者: from stoqlib.domain.person.Branch import get_active_remote_branches [as 别名]
def test_receive_order(self, print_report, yesno):
yesno.retval = True
source_branch = Branch.get_active_remote_branches(self.store)[0]
dest_branch = api.get_current_branch(self.store)
# Created and sent the order.
order = self.create_transfer_order(source_branch=source_branch,
dest_branch=dest_branch)
self.create_transfer_order_item(order=order)
order.identifier = 28474
order.open_date = localdatetime(2012, 2, 2)
order.send()
dialog = TransferOrderDetailsDialog(self.store, order)
self.click(dialog.print_button)
print_report.assert_called_once_with(dialog.report_class, dialog.model)
self.assertSensitive(dialog, ['receive_button'])
with mock.patch.object(self.store, 'commit'):
self.click(dialog.receive_button)
yesno.assert_called_once_with(u'Receive the order?', Gtk.ResponseType.YES,
u'Receive', u"Don't receive")
self.assertEqual(order.status, order.STATUS_RECEIVED)
self.assertEqual(order.cancel_date, None)
示例5: _create_model
# 需要导入模块: from stoqlib.domain.person import Branch [as 别名]
# 或者: from stoqlib.domain.person.Branch import get_active_remote_branches [as 别名]
def _create_model(self, store):
user = api.get_current_user(store)
source_responsible = store.find(Employee, person=user.person).one()
return TransferOrder(
source_branch=api.get_current_branch(store),
source_responsible=source_responsible,
destination_branch=Branch.get_active_remote_branches(store)[0],
store=store)
示例6: _prefill_branches
# 需要导入模块: from stoqlib.domain.person import Branch [as 别名]
# 或者: from stoqlib.domain.person.Branch import get_active_remote_branches [as 别名]
def _prefill_branches(self):
branches = Branch.get_active_remote_branches(self.store)
current_branch = api.get_current_branch(self.store)
# Branches not allowed to execute foreign work orders can only send
# orders for those who can
if not current_branch.can_execute_foreign_work_orders:
branches = branches.find(can_execute_foreign_work_orders=True)
self.destination_branch.prefill(api.for_person_combo(branches))
示例7: _create_domain
# 需要导入模块: from stoqlib.domain.person import Branch [as 别名]
# 或者: from stoqlib.domain.person.Branch import get_active_remote_branches [as 别名]
def _create_domain(self):
self.clean_domain([TransferOrderItem, TransferOrder])
responsible = self.create_employee()
other_branch = Branch.get_active_remote_branches(self.store)[0]
current_branch = api.get_current_branch(self.store)
# One transfer that we did not receive yet
order = self.create_transfer_order(source_branch=other_branch,
dest_branch=current_branch)
self.create_transfer_order_item(order=order)
order.identifier = 75168
order.open_date = localdatetime(2012, 1, 1)
order.send()
# One that we have already received
order = self.create_transfer_order(source_branch=other_branch,
dest_branch=current_branch)
self.create_transfer_order_item(order=order)
order.identifier = 56832
order.open_date = localdatetime(2012, 2, 2)
order.send()
order.receive(responsible)
order.receival_date = localdatetime(2012, 2, 2)
# One that we have sent but is not received yet
order = self.create_transfer_order(source_branch=current_branch,
dest_branch=other_branch)
self.create_transfer_order_item(order=order)
order.identifier = 20486
order.open_date = localdatetime(2012, 3, 3)
order.send()
# One that we have sent and is recived
order = self.create_transfer_order(source_branch=current_branch,
dest_branch=other_branch)
self.create_transfer_order_item(order=order)
order.identifier = 20489
order.open_date = localdatetime(2012, 3, 4)
order.send()
order.receive(responsible)
order.receival_date = localdatetime(2012, 3, 5)
# And another one that is cancelled
order = self.create_transfer_order(source_branch=current_branch,
dest_branch=other_branch)
self.create_transfer_order_item(order=order)
order.identifier = 20491
order.open_date = localdatetime(2012, 4, 5)
order.send()
order.cancel(responsible, 'Cancelled due something',
cancel_date=localdatetime(2012, 4, 6))
示例8: _create_domain
# 需要导入模块: from stoqlib.domain.person import Branch [as 别名]
# 或者: from stoqlib.domain.person.Branch import get_active_remote_branches [as 别名]
def _create_domain(self):
self.clean_domain([TransferOrderItem, TransferOrder])
other_branch = Branch.get_active_remote_branches(self.store)[0]
current_branch = api.get_current_branch(self.store)
# One transfer that we did not receive yet
order = self.create_transfer_order(source_branch=other_branch, dest_branch=current_branch)
self.create_transfer_order_item(order=order)
order.identifier = 75168
order.open_date = localdatetime(2012, 1, 1)
order.send()
示例9: _setup_widgets
# 需要导入模块: from stoqlib.domain.person import Branch [as 别名]
# 或者: from stoqlib.domain.person.Branch import get_active_remote_branches [as 别名]
def _setup_widgets(self):
branches = Branch.get_active_remote_branches(self.store)
self.destination_branch.prefill(api.for_person_combo(branches))
self.source_branch.set_text(self.branch.get_description())
employees = self.store.find(Employee)
self.source_responsible.prefill(api.for_person_combo(employees))
self.invoice_number.set_property('mandatory', self._nfe_is_active)
# Set an initial invoice number to TransferOrder and Invoice
if not self.model.invoice_number:
new_invoice_number = Invoice.get_next_invoice_number(self.store)
self.model.invoice_number = new_invoice_number
示例10: test_cancel_order_on_dest_branch
# 需要导入模块: from stoqlib.domain.person import Branch [as 别名]
# 或者: from stoqlib.domain.person.Branch import get_active_remote_branches [as 别名]
def test_cancel_order_on_dest_branch(self):
source_branch = Branch.get_active_remote_branches(self.store)[0]
dest_branch = api.get_current_branch(self.store)
order = self.create_transfer_order(source_branch=source_branch,
dest_branch=dest_branch)
self.create_transfer_order_item(order=order)
order.identifier = 28474
order.open_date = localdatetime(2012, 2, 2)
order.send()
dialog = TransferOrderDetailsDialog(self.store, order)
# Destination branch should not cancel the transfer
self.assertFalse(dialog.cancel_button.get_visible())
示例11: test_cancel_order
# 需要导入模块: from stoqlib.domain.person import Branch [as 别名]
# 或者: from stoqlib.domain.person.Branch import get_active_remote_branches [as 别名]
def test_cancel_order(self, yesno):
dest_branch = Branch.get_active_remote_branches(self.store)[0]
source_branch = api.get_current_branch(self.store)
order = self.create_transfer_order(source_branch=source_branch,
dest_branch=dest_branch)
self.create_transfer_order_item(order=order)
order.identifier = 28474
order.open_date = localdatetime(2012, 2, 2)
order.send()
dialog = TransferOrderDetailsDialog(self.store, order)
self.assertSensitive(dialog, ['cancel_button'])
yesno.retval = True
with mock.patch.object(self.store, 'commit'):
self.click(dialog.cancel_button)
yesno.assert_called_once_with(u'Cancel the order?', gtk.RESPONSE_YES,
u'Cancel transfer', u"Don't cancel")
self.assertEquals(order.status, TransferOrder.STATUS_CANCELLED)
self.assertEquals(order.receival_date, None)
示例12: test_get_active_remote_branches
# 需要导入模块: from stoqlib.domain.person import Branch [as 别名]
# 或者: from stoqlib.domain.person.Branch import get_active_remote_branches [as 别名]
def test_get_active_remote_branches(self):
current_branch = get_current_branch(self.store)
self.assertIn(current_branch, Branch.get_active_branches(self.store))
self.assertNotIn(current_branch,
Branch.get_active_remote_branches(self.store))