コード例 #1
0
ファイル: sintegradialog.py プロジェクト: romaia/stoq
    def confirm(self):
        start = self.date_filter.get_start_date()
        end = self.date_filter.get_end_date()
        filename = save(_("Save Sintegra file"),
                        self.get_toplevel(),
                        "sintegra-%s.txt" % (start.strftime('%Y-%m'), ))
        if not filename:
            return

        try:
            generator = StoqlibSintegraGenerator(self.store, start, end)
            generator.write(filename)
        except SintegraError, e:
            warning(str(e))
            return
コード例 #2
0
    def confirm(self):
        start = self.date_filter.get_start_date()
        end = self.date_filter.get_end_date()
        filename = save(_("Save Sintegra file"), self.get_toplevel(),
                        "sintegra-%s.txt" % (start.strftime('%Y-%m'), ))
        if not filename:
            return

        try:
            generator = StoqlibSintegraGenerator(self.store, start, end)
            generator.write(filename)
        except SintegraError as e:
            warning(str(e))
            return

        self.close()
コード例 #3
0
    def test_registers(self):
        order = self.create_receiving_order()
        receiving_invoice = order.receiving_invoice
        order.receival_date = localdate(2007, 6, 1)
        receiving_invoice.discount_value = 10
        # order.purchase.discount_value = 5
        # order.purchase.surcharge_value = 8
        # order.surcharge_value = 15
        receiving_invoice.ipi_total = 10
        receiving_invoice.freight_total = 6
        receiving_invoice.secure_value = 6
        receiving_invoice.expense_value = 12
        supplier = self.create_supplier()
        company = supplier.person.has_individual_or_company_facets()
        company.state_registry = u'103238426117'
        receiving_invoice.supplier = supplier
        employee = self.create_employee()
        branch = get_current_branch(self.store)
        branch.manager = employee

        purchase = order.purchase_orders.find()[0]
        purchase.status = purchase.ORDER_PENDING

        sellable = self.create_sellable()
        sellable.tax_constant = SellableTaxConstant(description=u"18",
                                                    tax_type=int(
                                                        TaxType.CUSTOM),
                                                    tax_value=18,
                                                    store=self.store)
        self.create_receiving_order_item(order, sellable=sellable)

        sellable2 = self.create_sellable()
        sellable2.tax_constant = SellableTaxConstant(description=u"6",
                                                     tax_type=int(
                                                         TaxType.CUSTOM),
                                                     tax_value=6,
                                                     store=self.store)
        self.create_receiving_order_item(order, sellable=sellable2)

        purchase.confirm()
        order.confirm()

        sellable.code = u'9999'
        sellable2.code = u'10000'

        sale = self.create_sale()
        sale.open_date = localdate(2007, 6, 10)

        sellable3 = self.create_sellable()
        product = sellable3.product
        sellable.tax_constant = SellableTaxConstant(description=u"18",
                                                    tax_type=int(
                                                        TaxType.CUSTOM),
                                                    tax_value=18,
                                                    store=self.store)

        sale.add_sellable(sellable3, quantity=1)

        self.create_storable(product,
                             get_current_branch(self.store),
                             stock=100)

        sale.order()

        method = PaymentMethod.get_by_name(self.store, u'money')
        method.create_payment(Payment.TYPE_IN, sale.group, sale.branch,
                              sale.get_sale_subtotal())

        sale.confirm()
        sale.group.pay()
        sale.close_date = localdate(2007, 6, 10)
        sale.confirm_date = localdate(2007, 6, 10)
        sellable3.code = u'09999'

        inventory = self.create_inventory(branch=branch)
        inventory.open_date = localdate(2007, 6, 15)

        # product came from sellable3
        inventory_item = InventoryItem(product=product,
                                       product_cost=product.sellable.cost,
                                       inventory=inventory,
                                       recorded_quantity=99,
                                       store=self.store)
        inventory_item.cfop_data = self.store.find(CfopData).order_by(
            CfopData.code).first()
        inventory_item.reason = u'Test'
        inventory_item.actual_quantity = 99
        inventory_item.counted_quantity = 99
        inventory_item.adjust(invoice_number=999)
        inventory.close()
        inventory.close_date = localdate(2007, 6, 15)

        generator = StoqlibSintegraGenerator(self.store, localdate(2007, 6, 1),
                                             localdate(2007, 6, 30))

        try:
            compare_sintegra_file(generator.sintegra, 'sintegra-receival')
        except AssertionError as e:
            self.fail(e)