def confirm(self): for item in self.get_items(): item.add_stock_items() FiscalBookEntry.create_product_entry(self.store, self.purchase.group, self.cfop, self.invoice_number, self.icms_total, self.ipi_total) self.invoice_total = self.get_total() if self.purchase.can_close(): self.purchase.close()
def confirm(self): for item in self.get_items(): item.add_stock_items() FiscalBookEntry.create_product_entry( self.store, self.purchase.group, self.cfop, self.invoice_number, self.icms_total, self.ipi_total ) self.invoice_total = self.get_total() if self.purchase.can_close(): self.purchase.close()
def confirm(self): self.invoice_total = self.total if self.group: self.group.confirm() for receiving in self.receiving_orders: receiving.invoice_number = self.invoice_number # XXX: Maybe FiscalBookEntry should not reference the payment group, but # lets keep this way for now until we refactor the fiscal book related # code, since it will pretty soon need a lot of changes. group = self.group or self.get_purchase_orders().pop().group FiscalBookEntry.create_product_entry( self.store, group, receiving.cfop, self.invoice_number, self.icms_total, self.ipi_total)
def confirm(self): self.invoice_total = self.total if self.group: self.group.confirm() for receiving in self.receiving_orders: receiving.invoice_number = self.invoice_number # XXX: Maybe FiscalBookEntry should not reference the payment group, but # lets keep this way for now until we refactor the fiscal book related # code, since it will pretty soon need a lot of changes. group = self.group or self.get_purchase_orders().pop().group FiscalBookEntry.create_product_entry(self.store, group, receiving.cfop, self.invoice_number, self.icms_total, self.ipi_total)
def _add_inventory_fiscal_entry(self, invoice_number): inventory = self.inventory return FiscalBookEntry(entry_type=FiscalBookEntry.TYPE_INVENTORY, invoice_number=inventory.invoice_number, branch=inventory.branch, cfop=self.cfop_data, store=self.store)
def testCreateProductEntry(self): sale = self.create_sale() sale.add_sellable(self.create_sellable(), price=150) book_entry = FiscalBookEntry.create_product_entry( self.store, sale.group, sale.cfop, sale.coupon_id, 123) self.failUnless(book_entry) self.assertEquals(book_entry.icms_value, 123) self.assertEquals(book_entry.entry_type, FiscalBookEntry.TYPE_PRODUCT)
def confirm(self): for item in self.get_items(): item.add_stock_items() purchases = list(self.purchase_orders) # XXX: Maybe FiscalBookEntry should not reference the payment group, but # lets keep this way for now until we refactor the fiscal book related # code, since it will pretty soon need a lot of changes. group = purchases[0].group FiscalBookEntry.create_product_entry(self.store, group, self.cfop, self.invoice_number, self.icms_total, self.ipi_total) self.invoice_total = self.total for purchase in purchases: if purchase.can_close(): purchase.close()
def testCreateServiceEntry(self): sale = self.create_sale() sale.add_sellable(self.create_sellable(), price=150) book_entry = FiscalBookEntry.create_service_entry( self.store, sale.group, sale.cfop, sale.service_invoice_number, 123) self.failUnless(book_entry) self.assertEquals(book_entry.iss_value, 123) self.assertEquals(book_entry.entry_type, FiscalBookEntry.TYPE_SERVICE)
def test_create_service_entry(self): sale = self.create_sale() sale.add_sellable(self.create_sellable(), price=150) book_entry = FiscalBookEntry.create_service_entry( self.store, self.current_branch, self.current_user, sale.group, sale.cfop, sale.service_invoice_number, 123) self.assertTrue(book_entry) self.assertEqual(book_entry.iss_value, 123) self.assertEqual(book_entry.entry_type, FiscalBookEntry.TYPE_SERVICE)
def test_create_product_entry(self): sale = self.create_sale() sale.add_sellable(self.create_sellable(), price=150) book_entry = FiscalBookEntry.create_product_entry( self.store, self.current_branch, self.current_user, sale.group, sale.cfop, sale.coupon_id, 123) self.assertTrue(book_entry) self.assertEqual(book_entry.icms_value, 123) self.assertEqual(book_entry.entry_type, FiscalBookEntry.TYPE_PRODUCT)
def confirm(self): for item in self.get_items(): item.add_stock_items() purchases = list(self.purchase_orders) # XXX: Maybe FiscalBookEntry should not reference the payment group, but # lets keep this way for now until we refactor the fiscal book related # code, since it will pretty soon need a lot of changes. group = purchases[0].group FiscalBookEntry.create_product_entry( self.store, group, self.cfop, self.invoice_number, self.icms_total, self.ipi_total ) self.invoice_total = self.total for purchase in purchases: if purchase.can_close(): purchase.close()
def test_default_return_sales_cfop(self): from stoqlib.domain.fiscal import FiscalBookEntry self._create_examples() wrong_param = self.sparam.get_object(self.store, 'DEFAULT_SALES_CFOP') drawee = Person(name=u'Antonione', store=self.store) group = self.create_payment_group() book_entry = FiscalBookEntry(entry_type=FiscalBookEntry.TYPE_SERVICE, invoice_number=123, cfop=wrong_param, branch=self.branch, drawee=drawee, payment_group=group, iss_value=1, icms_value=0, ipi_value=0, store=self.store) reversal = book_entry.reverse_entry(invoice_number=124) self.assertEqual(wrong_param, reversal.cfop)
def test_default_return_sales_cfop(self): from stoqlib.domain.fiscal import FiscalBookEntry self._create_examples() wrong_param = self.sparam.get_object(self.store, 'DEFAULT_SALES_CFOP') drawee = Person(name=u'Antonione', store=self.store) group = self.create_payment_group() book_entry = FiscalBookEntry( entry_type=FiscalBookEntry.TYPE_SERVICE, invoice_number=123, cfop=wrong_param, branch=self.branch, drawee=drawee, payment_group=group, iss_value=1, icms_value=0, ipi_value=0, store=self.store) reversal = book_entry.reverse_entry(invoice_number=124) self.assertEqual(wrong_param, reversal.cfop)
def test_create_product_entry(self): sale = self.create_sale() sale.add_sellable(self.create_sellable(), price=150) book_entry = FiscalBookEntry.create_product_entry( self.store, sale.group, sale.cfop, sale.coupon_id, 123) self.assertTrue(book_entry) self.assertEqual(book_entry.icms_value, 123) self.assertEqual(book_entry.entry_type, FiscalBookEntry.TYPE_PRODUCT)
def test_create_service_entry(self): sale = self.create_sale() sale.add_sellable(self.create_sellable(), price=150) book_entry = FiscalBookEntry.create_service_entry( self.store, sale.group, sale.cfop, sale.service_invoice_number, 123) self.assertTrue(book_entry) self.assertEqual(book_entry.iss_value, 123) self.assertEqual(book_entry.entry_type, FiscalBookEntry.TYPE_SERVICE)
def create_fiscal_book_entry(self, entry_type=None, icms_value=0, iss_value=0, ipi_value=0, invoice_number=None): from stoqlib.domain.payment.group import PaymentGroup from stoqlib.domain.fiscal import FiscalBookEntry payment_group = PaymentGroup(store=self.store) return FiscalBookEntry(invoice_number=invoice_number, icms_value=icms_value, iss_value=iss_value, ipi_value=ipi_value, entry_type=entry_type, cfop=self.create_cfop_data(), branch=self.create_branch(), drawee=self.create_person(), payment_group=payment_group, store=self.store)