Exemplo n.º 1
0
def test():  # pragma nocover
    from stoqlib.api import api
    from stoqlib.gui.base.dialogs import run_dialog
    creator = api.prepare_test()
    model = creator.store.find(InvoiceLayout, description=u'Untitled').any()
    retval = run_dialog(InvoiceLayoutEditor, None, creator.store, model)
    creator.store.confirm(retval)
Exemplo n.º 2
0
def test():  # pragma: no cover
    from stoqlib.gui.base.dialogs import run_dialog

    from stoqlib.api import api
    ec = api.prepare_test()
    model = ec.store.find(CostCenter).any()
    run_dialog(CostCenterDialog, None, ec.store, model)
Exemplo n.º 3
0
def test_dialog():  # pragma nocover
    from stoqlib.gui.base.dialogs import run_dialog

    ec = api.prepare_test()
    client = ec.store.find(Client).any()
    run_dialog(OpticalPatientDetails, None, ec.store, client)
    ec.store.commit()
Exemplo n.º 4
0
def test_dialog():  # pragma nocover
    from stoqlib.gui.base.dialogs import run_dialog

    ec = api.prepare_test()
    client = ec.store.find(Client).any()
    run_dialog(OpticalPatientDetails, None, ec.store, client)
    ec.store.commit()
Exemplo n.º 5
0
def test():  # pragma: no cover
    from stoqlib.gui.base.dialogs import run_dialog

    from stoqlib.api import api
    ec = api.prepare_test()
    model = ec.store.find(CostCenter).any()
    run_dialog(CostCenterDialog, None, ec.store, model)
Exemplo n.º 6
0
def test_employee_role():  # pragma nocover
    creator = api.prepare_test()
    role = creator.create_employee_role()
    run_dialog(EmployeeRoleEditor,
               parent=None,
               store=creator.store,
               model=role)
Exemplo n.º 7
0
def test():  # pragma nocover
    from stoqlib.api import api
    from stoqlib.gui.base.dialogs import run_dialog
    creator = api.prepare_test()
    model = creator.store.find(InvoiceLayout, description=u'Untitled').any()
    retval = run_dialog(InvoiceLayoutEditor, None, creator.store, model)
    creator.store.confirm(retval)
Exemplo n.º 8
0
def test_price_editor():  # pragma nocover
    from decimal import Decimal
    ec = api.prepare_test()
    sellable = ec.create_sellable()
    sellable.cost = Decimal('15.55')
    sellable.price = Decimal('21.50')
    run_dialog(SellablePriceEditor,
               parent=None, store=ec.store, model=sellable)
Exemplo n.º 9
0
def test():  # pragma nocover
    from stoqlib.domain.workorder import WorkOrder
    from stoqlib.api import api
    creator = api.prepare_test()
    orders = creator.store.find(WorkOrder)
    r = OpticalWorkOrderReceiptReport('teste.pdf', orders)
    #r.save_html('teste.html')
    r.save()
Exemplo n.º 10
0
def test_price_editor():  # pragma nocover
    from decimal import Decimal
    ec = api.prepare_test()
    sellable = ec.create_sellable()
    sellable.cost = Decimal('15.55')
    sellable.price = Decimal('21.50')
    run_dialog(SellablePriceEditor,
               parent=None, store=ec.store, model=sellable)
Exemplo n.º 11
0
def test():  # pragma nocover
    from stoqlib.domain.workorder import WorkOrder
    from stoqlib.api import api
    creator = api.prepare_test()
    orders = creator.store.find(WorkOrder)
    r = OpticalWorkOrderReceiptReport('teste.pdf', orders)
    #r.save_html('teste.html')
    r.save()
Exemplo n.º 12
0
def test_sellable_tax_constant():  # pragma nocover
    ec = api.prepare_test()
    tax_constant = api.sysparam(ec.store).DEFAULT_PRODUCT_TAX_CONSTANT
    run_dialog(SellableTaxConstantEditor,
               parent=None,
               store=ec.store,
               model=tax_constant)
    print(tax_constant)
Exemplo n.º 13
0
def test():  # pragma nocover
    creator = api.prepare_test()
    retval = run_dialog(AccountEditor,
                        None,
                        creator.store,
                        None,
                        parent_account=None,
                        visual_mode=True)
    creator.store.confirm(retval)
Exemplo n.º 14
0
def test():  # pragma nocover
    from stoqlib.domain.sale import Sale
    from stoqlib.api import api
    import sys
    creator = api.prepare_test()
    sale = creator.store.find(Sale, id=int(sys.argv[-1])).one()
    r = BookletReport('teste.pdf', sale.payments)
    r.save_html('teste.html')
    r.save()
Exemplo n.º 15
0
def test():  # pragma nocover
    from stoqlib.domain.sale import Sale
    from stoqlib.api import api
    import sys
    creator = api.prepare_test()
    sale = creator.store.find(Sale, id=int(sys.argv[-1])).one()
    r = BookletReport('teste.pdf', sale.payments)
    r.save_html('teste.html')
    r.save()
Exemplo n.º 16
0
def test_grid_editor():  # pragma nocover
    from stoqlib.gui.base.dialogs import run_dialog
    ec = api.prepare_test()
    group = ec.store.find(GridGroup).any()
    attribute = ec.create_grid_attribute(attribute_group=group)
    attribute.group = None
    run_dialog(GridAttributeEditor,
               parent=None, store=ec.store, model=attribute)
    print(attribute.group)
Exemplo n.º 17
0
def test_grid_editor():  # pragma nocover
    from stoqlib.gui.base.dialogs import run_dialog
    ec = api.prepare_test()
    group = ec.store.find(GridGroup).any()
    attribute = ec.create_grid_attribute(attribute_group=group)
    attribute.group = None
    run_dialog(GridAttributeEditor,
               parent=None, store=ec.store, model=attribute)
    print attribute.group
Exemplo n.º 18
0
Arquivo: sale.py Projeto: tmaxter/stoq
def test():
    from kiwi.ui.objectlist import ObjectList
    from stoqlib.api import api
    from stoq.gui.sales import SalesApp
    from stoqlib.domain.sale import SaleView
    api.prepare_test()
    store = api.new_store()

    class Foo(SalesApp):
        def __init__(self):
            pass

    a = Foo()
    ol = ObjectList(a.get_columns())
    data = store.find(SaleView)

    r = SalesReport('teste.pdf', ol, list(data))
    r.save_html('teste.html')
    r.save()
Exemplo n.º 19
0
Arquivo: sale.py Projeto: relsi/stoq
def test():  # pragma no cover
    from kiwi.ui.objectlist import ObjectList
    from stoqlib.api import api
    from stoq.gui.sales import SalesApp
    from stoqlib.domain.sale import SaleView
    api.prepare_test()
    store = api.new_store()

    class Foo(SalesApp):
        def __init__(self):
            pass

    a = Foo()
    ol = ObjectList(a.get_columns())
    data = store.find(SaleView)

    r = SalesReport('teste.pdf', ol, list(data))
    r.save_html('teste.html')
    r.save()
Exemplo n.º 20
0
def test_editor(editor):  # pragma nocover
    from stoqlib.gui.base.dialogs import run_dialog
    ec = api.prepare_test()
    model = ec.store.find(editor.model_type).any()
    if not model:
        client = ec.store.find(Client).any()
        run_dialog(editor, None, ec.store, client)
    else:
        run_dialog(editor, None, ec.store, model.client, model)

    ec.store.commit()
Exemplo n.º 21
0
def test_editor(editor):  # pragma nocover
    from stoqlib.gui.base.dialogs import run_dialog
    ec = api.prepare_test()
    model = ec.store.find(editor.model_type).any()
    if not model:
        client = ec.store.find(Client).any()
        run_dialog(editor, None, ec.store, client)
    else:
        run_dialog(editor, None, ec.store, model.client, model)

    ec.store.commit()
Exemplo n.º 22
0
def test():  # pragma: no cover
    from stoqlib.api import api
    from stoqlib.gui.base.dialogs import run_dialog
    ec = api.prepare_test()
    run_dialog(ProductSearch, None, ec.store)
Exemplo n.º 23
0
def test():  # pragma nocover
    creator = api.prepare_test()
    run_dialog(CloseLoanWizard, None, creator.store, create_sale=True)
    creator.store.rollback()
Exemplo n.º 24
0
def test():  # pragma nocover
    creator = api.prepare_test()
    sale_item = creator.create_sale_item()
    retval = run_dialog(ConfirmSaleWizard, None, creator.store,
                        sale_item.sale)
    creator.store.confirm(retval)
Exemplo n.º 25
0
        print_report.assert_called_once_with(PurchaseOrderReport, order)

    @mock.patch('stoq.lib.gui.dialogs.purchasedetails.print_report')
    def test_print_details_simple(self, print_report):
        order = self.create_purchase_order()
        dialog = PurchaseDetailsDialog(self.store, order)
        self.assertSensitive(dialog, ['print_items_button'])

        order.status = PurchaseOrder.ORDER_PENDING
        self.click(dialog.print_items_button)
        print_report.assert_called_once_with(PurchaseOrderItemReport, order)

    @mock.patch('stoq.lib.gui.utils.printing.warning')
    @mock.patch('stoq.lib.gui.dialogs.purchasedetails.run_dialog')
    def test_print_labels(self, run_dialog, warning):
        order = self.create_purchase_order()
        dialog = PurchaseDetailsDialog(self.store, order)

        self.click(dialog.print_labels)
        run_dialog.assert_called_once_with(SkipLabelsEditor, dialog,
                                           self.store)
        warning.assert_called_once_with('It was not possible to print the '
                                        'labels. The template file was not '
                                        'found.')


if __name__ == '__main__':
    from stoqlib.api import api
    c = api.prepare_test()
    unittest.main()
Exemplo n.º 26
0
def test_product():  # pragma nocover
    ec = api.prepare_test()
    product = ec.create_product()
    run_dialog(ProductEditor, parent=None, store=ec.store, model=product)
Exemplo n.º 27
0
def test():  # pragma: no cover
    from stoqlib.api import api
    ec = api.prepare_test()
    run_dialog(CostCenterSearch, None, ec.store)
Exemplo n.º 28
0
def test():  # pragma nocover
    creator = api.prepare_test()
    retval = run_dialog(AccountEditor, None, creator.store, None,
                        parent_account=None, visual_mode=True)
    creator.store.confirm(retval)
Exemplo n.º 29
0
            drawer_address=self._get_person_address(drawer_person),
            due_date=self.loan.expire_date,
            value=self.loan.get_total_amount(),
            emission_city=emission_location.city,
            emission_date=datetime.date.today(),
        )

        return dict(subtitle=_("Loan number: %s") % order_identifier,
                    loan=self.loan,
                    print_promissory_note=print_promissory_note,
                    promissory_data=promissory_data,
                    notice=api.sysparam.get_string('LOAN_NOTICE'))

    def adjust_for_test(self):
        # today is mocked on test
        date = datetime.date.today()
        self.loan.expire_date = date
        self.loan.open_date = date
        self.loan.identifier = 666
        self.logo_data = 'logo.png'


if __name__ == '__main__':  # pragma nocover
    from stoqlib.domain.loan import Loan
    import sys
    creator = api.prepare_test()
    loan_ = creator.trans.find(Loan, id=int(sys.argv[-1])).one()
    r = LoanReceipt('test.pdf', loan_)
    r.save_html('test.html')
    r.save()
Exemplo n.º 30
0
def test():  # pragma nocover
    creator = api.prepare_test()
    account = creator.create_account()
    retval = run_dialog(AccountTransactionEditor, None, creator.trans,
                        None, account)
    api.creator.trans.confirm(retval)
Exemplo n.º 31
0
def test():  # pragma: no cover
    from stoqlib.api import api
    ec = api.prepare_test()
    run_dialog(CostCenterSearch, None, ec.store)
Exemplo n.º 32
0
def test_client():  # pragma nocover
    from stoqlib.gui.wizards.personwizard import run_person_role_dialog
    creator = api.prepare_test()
    retval = run_person_role_dialog(ClientEditor, None, creator.store, None)
    creator.store.confirm(retval)
Exemplo n.º 33
0
def test():  # pragma: no cover
    from stoqlib.gui.base.dialogs import run_dialog
    ec = api.prepare_test()
    run_dialog(ProductSearch, None, ec.store)
Exemplo n.º 34
0
def test():  # pragma nocover
    creator = api.prepare_test()
    account = creator.create_account()
    retval = run_dialog(AccountTransactionEditor, None, creator.trans,
                        None, account)
    api.creator.trans.confirm(retval)
Exemplo n.º 35
0
            due_date=self.loan.expire_date,
            value=self.loan.get_total_amount(),
            emission_city=emission_location.city,
            emission_date=datetime.date.today(),
        )

        return dict(
            subtitle=_("Loan number: %s") % order_identifier,
            loan=self.loan,
            print_promissory_note=print_promissory_note,
            promissory_data=promissory_data,
        )

    def adjust_for_test(self):
        # today is mocked on test
        date = datetime.date.today()
        self.loan.expire_date = date
        self.loan.open_date = date
        self.loan.identifier = 666
        self.logo_data = 'logo.png'


if __name__ == '__main__':  # pragma nocover
    from stoqlib.domain.loan import Loan
    import sys
    creator = api.prepare_test()
    loan_ = creator.trans.find(Loan, id=int(sys.argv[-1])).one()
    r = LoanReceipt('test.pdf', loan_)
    r.save_html('test.html')
    r.save()
Exemplo n.º 36
0
def test():  # pragma: no cover
    ec = api.prepare_test()
    person = run_dialog(BranchDialog, None, ec.store)
    print('RETVAL', person)
Exemplo n.º 37
0
def test():  # pragma nocover
    creator = api.prepare_test()
    sale_item = creator.create_sale_item()
    retval = run_dialog(ConfirmSaleWizard, None, creator.store, sale_item.sale)
    creator.store.confirm(retval)
Exemplo n.º 38
0
def test():  # pragma nocover
    creator = api.prepare_test()
    retval = run_dialog(InPaymentEditor, None, creator.store, None)
    creator.store.confirm(retval)
Exemplo n.º 39
0
def test_sellable_tax_constant():  # pragma nocover
    ec = api.prepare_test()
    tax_constant = api.sysparam(ec.store).DEFAULT_PRODUCT_TAX_CONSTANT
    run_dialog(SellableTaxConstantEditor, parent=None, store=ec.store, model=tax_constant)
    print tax_constant
Exemplo n.º 40
0
def test():  # pragma nocover
    creator = api.prepare_test()
    method = PaymentMethod.get_by_name(creator.store, u'card')
    retval = run_dialog(CardPaymentMethodEditor, None, creator.store, method)
    creator.store.confirm(retval)
Exemplo n.º 41
0
def test_client():  # pragma nocover
    from stoqlib.gui.wizards.personwizard import run_person_role_dialog
    creator = api.prepare_test()
    retval = run_person_role_dialog(ClientEditor, None, creator.store, None)
    creator.store.confirm(retval)
Exemplo n.º 42
0
def test():  # pragma nocover
    creator = api.prepare_test()
    retval = run_dialog(InPaymentEditor, None, creator.store, None)
    creator.store.confirm(retval)
Exemplo n.º 43
0
def test_employee_role():  # pragma nocover
    creator = api.prepare_test()
    role = creator.create_employee_role()
    run_dialog(EmployeeRoleEditor, parent=None, store=creator.store,
               model=role)
Exemplo n.º 44
0
def test():  # pragma nocover
    creator = api.prepare_test()
    retval = run_dialog(PurchaseWizard, None, creator.store)
    creator.store.confirm(retval)
Exemplo n.º 45
0
def test():  # pragma nocover
    creator = api.prepare_test()
    method = PaymentMethod.get_by_name(creator.store, u'card')
    retval = run_dialog(CardPaymentMethodEditor, None, creator.store, method)
    creator.store.confirm(retval)
Exemplo n.º 46
0
def test():  # pragma: no cover
    ec = api.prepare_test()
    person = run_dialog(BranchDialog, None, ec.store)
    print('RETVAL', person)
Exemplo n.º 47
0
def test_product():  # pragma nocover
    ec = api.prepare_test()
    product = ec.create_product()
    run_dialog(ProductEditor,
               parent=None, store=ec.store, model=product)
Exemplo n.º 48
0
        editor = InPaymentEditor(self.store, p)

        self.click(editor.details_button)
        # FIXME: for Viewable comparision in Storm"
        # from stoqlib.domain.sale import SaleView
        # from stoqlib.gui.dialogs.saledetails import SaleDetailsDialog
        # sale_view = SaleView.get(editor.model.group.sale.id, store=self.store)
        # run_dialog.assert_called_once_with(SaleDetailsDialog, editor,
        #                                   editor.store, sale_view)
        self.assertEquals(run_dialog.call_count, 1)

    @mock.patch('stoqlib.gui.editors.paymenteditor.run_dialog')
    def test_show_stock_decrease_dialog(self, run_dialog):
        group = self.create_payment_group()
        decrease = self.create_stock_decrease(group=group)
        self.create_stock_decrease_item(decrease)
        self.add_payments(decrease)
        payment = decrease.group.payments[0]

        editor = InPaymentEditor(self.store, payment)
        self.click(editor.details_button)
        run_dialog.assert_called_once_with(StockDecreaseDetailsDialog, editor,
                                           self.store, decrease)


if __name__ == '__main__':
    from stoqlib.api import api
    c = api.prepare_test()
    unittest.main()
Exemplo n.º 49
0
def test():  # pragma nocover
    creator = api.prepare_test()
    run_dialog(CloseLoanWizard, None, creator.store, create_sale=True)
    creator.store.rollback()