• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python dateutils.localdatetime函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中stoqlib.lib.dateutils.localdatetime函数的典型用法代码示例。如果您正苦于以下问题:Python localdatetime函数的具体用法?Python localdatetime怎么用?Python localdatetime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了localdatetime函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_create_return_from_execution

    def test_create_return_from_execution(self, localnow):
        current_branch = api.get_current_branch(self.store)
        current_branch.can_execute_foreign_work_orders = True
        localnow.return_value = localdatetime(2013, 1, 1)
        destination_branch = self.create_branch()
        workorders_ids = set()

        for i in xrange(10):
            wo = self.create_workorder(description=u"Equipment %d" % i)
            wo.client = self.create_client()
            wo.identifier = 666 + i
            wo.open_date = localdatetime(2013, 1, 1)

            # Only the 3 finished and with their original branches set to the
            # destination_branch will appear on the list
            if i < 3:
                wo.approve()
            elif 3 <= i < 6:
                wo.approve()
                wo.work()
                wo.add_sellable(self.create_sellable())
                wo.finish()
            elif 6 <= i < 9:
                wo.approve()
                wo.work()
                wo.add_sellable(self.create_sellable())
                wo.finish()
                wo.branch = destination_branch
                workorders_ids.add(wo.id)

        editor = WorkOrderPackageSendEditor(self.store)

        self.assertInvalid(editor, ['destination_branch'])
        self.assertEqual(len(editor.workorders), 0)
        editor.destination_branch.update(destination_branch)
        self.assertValid(editor, ['destination_branch'])

        self.assertEqual(workorders_ids,
                         set([wo_.id for wo_ in editor.workorders]))

        self.assertEqual(editor.model.package_items.count(), 0)
        # Only these 2 will be sent
        for wo in [editor.workorders[0], editor.workorders[1]]:
            wo.will_send = True
            # Mimic 'cell-edited' emission
            editor.workorders.emit('cell_edited', wo, 'will_send')

        self.assertNotSensitive(editor.main_dialog, ['ok_button'])
        self.assertInvalid(editor, ['identifier'])
        editor.identifier.update(u'123321')
        self.assertValid(editor, ['identifier'])
        self.assertSensitive(editor.main_dialog, ['ok_button'])

        self.check_editor(
            editor, 'editor-workorderpackagesend-return-from-execution-create')

        with mock.patch.object(editor.model, 'send') as send:
            self.click(editor.main_dialog.ok_button)
            self.assertEqual(send.call_count, 1)
            self.assertEqual(editor.model.package_items.count(), 2)
开发者ID:Guillon88,项目名称:stoq,代码行数:60,代码来源:test_workordereditor.py


示例2: _create_domain

    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)
开发者ID:LeonamSilva,项目名称:stoq,代码行数:30,代码来源:test_transfersearch.py


示例3: __init__

 def __init__(self):
     self.api = mock.Mock()
     self.api.get_current_branch = get_current_branch
     self.DatabaseSettings = FakeDatabaseSettings
     self.StoqConfig = FakeStoqConfig
     self.datetime = mock.MagicMock(datetime)
     self.datetime.datetime.today.return_value = localdatetime(2012, 1, 1)
     self.datetime.datetime.now.return_value = localdatetime(2012, 1, 1)
     self.datetime.date.today.return_value = localdate(2012, 1, 1).date()
开发者ID:pkaislan,项目名称:stoq,代码行数:9,代码来源:domaintest.py


示例4: test_show

    def test_show(self, localnow):
        sysparam.set_bool(self.store, 'ALLOW_OUTDATED_OPERATIONS', True)

        localnow.return_value = localdatetime(2013, 2, 1)

        sellable = self.create_sellable(code=u'Code')
        workorder = self.create_workorder(description=u'Test equipment')
        workorder.identifier = 666
        workorder.supplier_order = u"A1234"
        workorder.client = self.create_client()
        workorder.sellable = sellable
        workorder.category = WorkOrderCategory(store=self.store,
                                               name=u'Categoty XXX')
        workorder.defect_reported = u"Defect reported"
        # Create the editor and check initial state
        editor = WorkOrderEditor(self.store, model=workorder)
        self.check_editor(editor, 'editor-workorder-show-initial')

        self.assertEqual(editor.supplier_order.read(), u'A1234')
        self.assertSensitive(editor, ['client'])
        self.assertSensitive(editor, ['category', 'category_create'])
        self.assertSensitive(editor, ['supplier_order'])
        workorder.defect_detected = u"Defect detected"
        workorder.estimated_hours = 10
        workorder.estimated_hours = 100
        workorder.estimated_start = localdatetime(2013, 1, 1)
        workorder.estimated_finish = localdatetime(2013, 1, 2)
        workorder.approve()
        _adjust_history_date(workorder)
        # Create another editor to check approved state
        editor = WorkOrderEditor(self.store, model=workorder)
        self.check_editor(editor, 'editor-workorder-show-approved')

        workorder.add_sellable(self.create_sellable(description=u"Product A"),
                               price=99, quantity=2)
        workorder.add_sellable(self.create_sellable(description=u"Product B"),
                               price=5, quantity=100)
        workorder.work()
        _adjust_history_date(workorder)
        # Create another editor to check work in progress state
        editor = WorkOrderEditor(self.store, model=workorder)
        self.check_editor(editor, 'editor-workorder-show-in-progress')

        workorder.finish()
        _adjust_history_date(workorder)
        # Create another editor to check finished state
        editor = WorkOrderEditor(self.store, model=workorder)
        self.check_editor(editor, 'editor-workorder-show-finished')

        for item in workorder.order_items:
            item.reserve(item.quantity)
        workorder.close()
        _adjust_history_date(workorder)
        # Create another editor to check closed state
        editor = WorkOrderEditor(self.store, model=workorder)
        self.check_editor(editor, 'editor-workorder-show-closed')
开发者ID:Guillon88,项目名称:stoq,代码行数:56,代码来源:test_workordereditor.py


示例5: test_close_returned_in_consignment_wizard

    def test_close_returned_in_consignment_wizard(self, run_dialog, info):
        purchase_item = self.create_purchase_order_item()
        self.create_receiving_order_item(purchase_item=purchase_item)

        # Create storable.
        product = purchase_item.sellable.product
        Storable(store=self.store, product=product)
        storable = product.storable
        branch = purchase_item.order.branch
        storable.increase_stock(5, branch,
                                StockTransactionHistory.TYPE_INITIAL, None)
        stock_quantity = storable.get_stock_item(branch, None).quantity
        self.assertEqual(stock_quantity, 5)

        purchase_item.quantity_received = 5
        purchase_item.order.status = PurchaseOrder.ORDER_CONSIGNED
        purchase_item.order.identifier = 334
        purchase_item.order.open_date = localdatetime(2012, 1, 1)
        purchase_item.order.expected_receival_date = localdatetime(2012, 2, 2)

        wizard = CloseInConsignmentWizard(self.store)

        step = wizard.get_current_step()
        self.click(step.search.search_button)

        product_stock_item = self.store.find(ProductStockItem,
                                             storable=storable).one()
        self.check_wizard(wizard, 'wizard-return-consignment-selection-step')

        order_view = step.search.results[0]
        step.search.results.select(order_view)
        self.click(wizard.next_button)

        step = wizard.get_current_step()

        # Select consignment.
        step.consignment_items.emit('row_activated', step.consignment_items[0])
        self.assertEqual(run_dialog.call_count, 1)
        args, kwargs = run_dialog.call_args
        editor, parent, store, item = args
        self.assertEqual(editor, InConsignmentItemEditor)
        self.assertEqual(parent, wizard)
        self.assertEqual(item, purchase_item)
        self.assertTrue(store is not None)

        # Return the total received.
        purchase_item.quantity_returned = 5

        self.click(wizard.next_button)
        # After return. Item quantity in stock must be decreased.
        stock_quantity = storable.get_stock_item(branch, None).quantity
        self.assertEqual(stock_quantity, 0)
        self.check_wizard(wizard,
                          'wizard-close-returned-in-consignment-confirm',
                          [wizard.retval, purchase_item, product_stock_item])
开发者ID:hackedbellini,项目名称:stoq,代码行数:55,代码来源:test_consignment_wizard.py


示例6: test_complete_receiving_multiple_purchases

    def test_complete_receiving_multiple_purchases(self):
        branch = api.get_current_branch(self.store)

        # Create purchase order 1
        product1 = self.create_product(description=u'Product 1', storable=True)
        order1 = self.create_purchase_order(branch=branch)
        order1.identifier = 10023
        order1.open_date = localdatetime(2012, 10, 9)
        order1.expected_receival_date = localdatetime(2012, 9, 25)
        order1.add_item(product1.sellable, 7)
        order1.status = PurchaseOrder.ORDER_PENDING
        order1.confirm()

        # And purchase order 2
        product2 = self.create_product(description=u'Product 2', storable=True)
        order2 = self.create_purchase_order(branch=branch,
                                            supplier=order1.supplier)
        order2.identifier = 10024
        order2.open_date = localdatetime(2012, 10, 9)
        order2.expected_receival_date = localdatetime(2012, 9, 25)
        order2.add_item(product2.sellable, 5)
        order2.status = PurchaseOrder.ORDER_PENDING
        order2.confirm()

        # Now to the wizard
        wizard = ReceivingOrderWizard(self.store)

        step = wizard.get_current_step()
        self.assertNotSensitive(wizard, ['next_button'])
        self.click(step.search.search_button)
        # Select both purchase orders. There is one bug in kiwi that we cannot
        # select all at once, so thats why we are using this private api.
        step.search.results._treeview.get_selection().select_all()
        self.assertSensitive(wizard, ['next_button'])
        self.check_wizard(wizard, 'receiving-order-multiple-purchase-selection-step')
        self.click(wizard.next_button)

        step = wizard.get_current_step()
        self.assertSensitive(wizard, ['next_button'])
        self.check_wizard(wizard, 'receiving-order-multiple-product-step')
        self.click(wizard.next_button)

        step = wizard.get_current_step()
        step.invoice_slave.invoice_number.update(10094)
        step.invoice_slave.freight.update(159)
        self.check_wizard(wizard, 'receiving-order-multiple-invoice-step')

        with contextlib.nested(
                mock.patch.object(self.store, 'commit')):
            # Confirm
            self.click(wizard.next_button)

        self.assertEquals(product1.storable.get_balance_for_branch(branch), 7)
        self.assertEquals(product2.storable.get_balance_for_branch(branch), 5)
开发者ID:Guillon88,项目名称:stoq,代码行数:54,代码来源:test_receivingorderwizard.py


示例7: _create_domain

    def _create_domain(self):
        client = self.create_client(name=u'Dane Cook')
        loan = self.create_loan(client=client)
        self.create_loan_item(loan=loan)
        loan.identifier = 54952
        loan.open_date = localdatetime(2012, 1, 1)

        client = self.create_client(name=u'Carmen Sandiego')
        loan = self.create_loan(client=client)
        self.create_loan_item(loan=loan)
        loan.identifier = 45978
        loan.open_date = localdatetime(2012, 2, 2)
开发者ID:Guillon88,项目名称:stoq,代码行数:12,代码来源:test_loansearch.py


示例8: testCompleteReceiving

    def testCompleteReceiving(self, yesno, run_dialog, warning):
        yesno.return_value = True
        run_dialog.return_value = Settable(skip=Decimal('0'))

        order = self.create_purchase_order()
        order.identifier = 65432
        order.open_date = localdatetime(2012, 10, 9)
        order.expected_receival_date = localdatetime(2012, 9, 25)
        sellable = self.create_sellable()
        order.add_item(sellable, 1)
        order.status = PurchaseOrder.ORDER_PENDING
        order.confirm()
        wizard = ReceivingOrderWizard(self.store)

        step = wizard.get_current_step()
        self.assertNotSensitive(wizard, ['next_button'])
        self.click(step.search.search_button)
        order_view = step.search.results[0]
        step.search.results.select(order_view)
        self.assertSensitive(wizard, ['next_button'])
        self.check_wizard(wizard, 'purchase-selection-step')
        self.click(wizard.next_button)

        step = wizard.get_current_step()
        self.assertSensitive(wizard, ['next_button'])
        self.check_wizard(wizard, 'receiving-order-product-step')
        self.click(wizard.next_button)

        step = wizard.get_current_step()
        self.assertNotSensitive(wizard, ['next_button'])
        step.invoice_slave.invoice_number.update(1)
        self.assertSensitive(wizard, ['next_button'])
        self.check_wizard(wizard, 'receiving-invoice-step')
        module = 'stoqlib.gui.events.ReceivingOrderWizardFinishEvent.emit'
        with mock.patch(module) as emit:
            self.click(wizard.next_button)
            self.assertEquals(emit.call_count, 1)
            args, kwargs = emit.call_args
            self.assertTrue(isinstance(args[0], ReceivingOrder))
            yesno.assert_called_once_with('Do you want to print the labels for '
                                          'the received products?',
                                          gtk.RESPONSE_YES, 'Print labels',
                                          "Don't print")
            run_dialog.assert_called_once_with(SkipLabelsEditor, wizard,
                                               self.store)
            warning.assert_called_once_with('It was not possible to print the '
                                            'labels. The template file was '
                                            'not found.')
开发者ID:leandrorchaves,项目名称:stoq,代码行数:48,代码来源:test_receivingorderwizard.py


示例9: test_cancel_order_nfce_plugin_active

    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)
开发者ID:hackedbellini,项目名称:stoq,代码行数:27,代码来源:test_transferorder_dialog.py


示例10: _check_start_step

 def _check_start_step(self, uitest=""):
     start_step = self.wizard.get_current_step()
     start_step.quote_deadline.update(localdatetime(2020, 1, 1))
     start_step.quote_group.set_text("12345")
     if uitest:
         self.check_wizard(self.wizard, uitest)
     self.click(self.wizard.next_button)
开发者ID:rg3915,项目名称:stoq,代码行数:7,代码来源:test_purchasequotewizard.py


示例11: test_receive_order

    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)
开发者ID:hackedbellini,项目名称:stoq,代码行数:26,代码来源:test_transferorder_dialog.py


示例12: test_undo_with_pending_payment

    def test_undo_with_pending_payment(self):
        # First, we create a sale_item and relate it to a sale.
        sale_item = self.create_sale_item()
        sale = sale_item.sale
        self.add_payments(sale)
        sale.order()
        # The sale is then completed and confirmed with its payment confirmed as well.
        sale.confirm()

        # Now, we create a return adapter to make the actual return.
        returned_sale = sale.create_sale_return_adapter()
        returned_sale.confirm(self.create_user())

        # A pending payment is then made for it to be cancelled when the sale return is
        # actually undone.
        payment = self.create_payment(date=localdatetime(2012, 1, 1),
                                      value=sale_item.price,
                                      group=sale.group)
        payment.set_pending()

        # There should be 2 payments at this point.
        n_payments1 = sale.payments.count()

        returned_sale.undo(reason=u'teste')

        # This test evaluates if the pending payment was actually cancelled and that, at
        # any point around the undoing of the sale return, no payments are added or
        # removed.
        self.assertEqual(payment.status, Payment.STATUS_CANCELLED)
        self.assertEqual(n_payments1, 2)
        self.assertEqual(sale.group.payments.count(), 2)
开发者ID:hackedbellini,项目名称:stoq,代码行数:31,代码来源:test_returnedsale.py


示例13: create_individual

 def create_individual(self, person=None):
     from stoqlib.domain.person import Individual, Person
     if person is None:
         person = Person(name=u'individual', store=self.store)
     return Individual(person=person,
                       birth_date=localdatetime(1970, 1, 1),
                       store=self.store)
开发者ID:Joaldino,项目名称:stoq,代码行数:7,代码来源:exampledata.py


示例14: testCreate

    def testCreate(self):
        branches = self.store.find(Branch)
        dialog = OpenInventoryDialog(self.store, branches)
        d = localdatetime(2010, 01, 30, 12, 33)
        dialog.open_time.set_text(d.strftime("%X"))

        self.check_editor(dialog, 'dialog-open-inventory')
开发者ID:leandrorchaves,项目名称:stoq,代码行数:7,代码来源:test_openinventorydialog.py


示例15: _create_domain

    def _create_domain(self):
        self.clean_domain([ReceivingOrderItem, PurchaseReceivingMap, ReceivingOrder])

        supplier_a = self.create_supplier(u'Mark')
        purchase_order_a = self.create_purchase_order(supplier=supplier_a)
        order_a = self.create_receiving_order(purchase_order=purchase_order_a)

        supplier_b = self.create_supplier(u'Dominique')
        purchase_order_b = self.create_purchase_order(supplier=supplier_b)
        order_b = self.create_receiving_order(purchase_order=purchase_order_b)

        purchase_order_a.identifier = 81954
        order_a.receival_date = localdatetime(2012, 1, 1)

        purchase_order_b.identifier = 78526
        order_b.receival_date = localdatetime(2012, 2, 2)
开发者ID:Guillon88,项目名称:stoq,代码行数:16,代码来源:test_receivingsearch.py


示例16: testCreate

    def testCreate(self, localnow):
        localnow.return_value = localdatetime(2013, 1, 1)
        destination_branch = self.create_branch()
        workorders_ids = set()

        for i in xrange(10):
            wo = self.create_workorder(u"Equipment %d" % i)
            wo.client = self.create_client()
            wo.identifier = 666 + i
            wo.open_date = localdatetime(2013, 1, 1)

            # Only the first 6 will appear on the list. Half of them as
            # approved and half of them as finished.
            if i < 3:
                wo.approve()
                workorders_ids.add(wo.id)
            elif i < 6:
                wo.approve()
                wo.start()
                wo.add_sellable(self.create_sellable())
                wo.finish()
                workorders_ids.add(wo.id)

        editor = WorkOrderPackageSendEditor(self.store)
        self.assertEqual(workorders_ids,
                         set([wo.id for wo in editor.workorders]))

        self.assertEqual(editor.model.package_items.count(), 0)
        # Only these 2 will be sent
        for wo in [editor.workorders[0], editor.workorders[1]]:
            wo.will_send = True
            # Mimic 'cell-edited' emission
            editor.workorders.emit('cell_edited', wo, 'will_send')
        self.assertEqual(editor.model.package_items.count(), 2)

        self.assertNotSensitive(editor.main_dialog, ['ok_button'])
        self.assertInvalid(editor, ['identifier', 'destination_branch'])
        editor.identifier.update(u'123321')
        editor.destination_branch.update(destination_branch)
        self.assertValid(editor, ['identifier', 'destination_branch'])
        self.assertSensitive(editor.main_dialog, ['ok_button'])

        self.check_editor(editor, 'editor-workorderpackagesend-create')

        with mock.patch.object(editor.model, 'send') as send:
            self.click(editor.main_dialog.ok_button)
            send.assert_called_once()
开发者ID:leandrorchaves,项目名称:stoq,代码行数:47,代码来源:test_workordereditor.py


示例17: test_show

    def test_show(self, localnow):
        localnow.return_value = localdatetime(2013, 2, 1)

        workorder = self.create_workorder(equipment=u'Test equipment')
        workorder.identifier = 666
        workorder.client = self.create_client()
        workorder.category = WorkOrderCategory(store=self.store,
                                               name=u'Categoty XXX')
        workorder.defect_reported = u"Defect reported"
        # Create the editor and check initial state
        editor = WorkOrderEditor(self.store, model=workorder)
        self.check_editor(editor, 'editor-workorder-show-initial')

        workorder.defect_detected = u"Defect detected"
        workorder.estimated_hours = 10
        workorder.estimated_hours = 100
        workorder.estimated_start = localdatetime(2013, 1, 1)
        workorder.estimated_finish = localdatetime(2013, 1, 2)
        workorder.approve()
        _adjust_history_date(workorder)
        # Create another editor to check approved state
        editor = WorkOrderEditor(self.store, model=workorder)
        self.check_editor(editor, 'editor-workorder-show-approved')

        workorder.add_sellable(self.create_sellable(description=u"Product A"),
                               price=99, quantity=2)
        workorder.add_sellable(self.create_sellable(description=u"Product B"),
                               price=5, quantity=100)
        workorder.work()
        _adjust_history_date(workorder)
        # Create another editor to check work in progress state
        editor = WorkOrderEditor(self.store, model=workorder)
        self.check_editor(editor, 'editor-workorder-show-in-progress')

        workorder.finish()
        _adjust_history_date(workorder)
        # Create another editor to check finished state
        editor = WorkOrderEditor(self.store, model=workorder)
        self.check_editor(editor, 'editor-workorder-show-finished')

        workorder.close()
        _adjust_history_date(workorder)
        # Create another editor to check closed state
        editor = WorkOrderEditor(self.store, model=workorder)
        self.check_editor(editor, 'editor-workorder-show-closed')
开发者ID:LeonamSilva,项目名称:stoq,代码行数:45,代码来源:test_workordereditor.py


示例18: _create_domain

    def _create_domain(self):
        self.clean_domain([TransferOrderItem, TransferOrder])

        source_branch = self.create_branch(u'Riachuelo')
        dest_branch = self.create_branch(u'Marisa')
        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)

        source_branch = self.create_branch(u'Opera Rock')
        dest_branch = self.create_branch(u'Cavalera')
        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)
开发者ID:leandrorchaves,项目名称:stoq,代码行数:18,代码来源:test_transfersearch.py


示例19: testCreateRepeatedMonth

    def testCreateRepeatedMonth(self):
        p = self.create_payment()
        p.description = u'Rent'
        p.category = self.create_payment_category()
        payments = Payment.create_repeated(self.store, p,
                                           INTERVALTYPE_MONTH,
                                           localdate(2012, 1, 1).date(),
                                           localdate(2012, 12, 31).date())
        self.assertEquals(len(payments), 11)
        self.assertEquals(p.due_date, localdatetime(2012, 1, 1))
        self.assertEquals(p.description, u'1/12 Rent')

        self.assertEquals(payments[0].due_date, localdatetime(2012, 2, 1))
        self.assertEquals(payments[1].due_date, localdatetime(2012, 3, 1))
        self.assertEquals(payments[10].due_date, localdatetime(2012, 12, 1))

        self.assertEquals(payments[0].description, u'2/12 Rent')
        self.assertEquals(payments[10].description, u'12/12 Rent')
开发者ID:leandrorchaves,项目名称:stoq,代码行数:18,代码来源:test_payment.py


示例20: _create_domain

    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))
开发者ID:hackedbellini,项目名称:stoq,代码行数:54,代码来源:test_transfersearch.py



注:本文中的stoqlib.lib.dateutils.localdatetime函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python dateutils.localnow函数代码示例发布时间:2022-05-27
下一篇:
Python dateutils.localdate函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap