Esempio n. 1
0
 def initial_acceptance_from_custom(cls, acceptance):
     debug(u"Инициализация по новой `прихода` id = '%s' начата."
           % acceptance.id)
     from services.mailinvoice import InvoiceService
     invoice = InvoiceService.create_invoice(
         number=InvoiceService.generate_number(acceptance.date),
         date=acceptance.date, provider=acceptance.provider
     )
     acceptance.invoices.append(invoice)
     debug(u"Инициализация по новой `прихода` id = '%s' завершена."
           % acceptance.id)
Esempio n. 2
0
    def handle(self, provider, mail):
        from services.mailinvoice import InvoiceService
        from db import db
        invmodel = InvoiceService.create_invoice(
            number=self.number, date=self.date, provider=provider,
            sum_without_NDS=self.sum_without_NDS, sum_with_NDS=self.sum_with_NDS,
            sum_NDS=self.sum_NDS, weight=self.weight, responsible=self.responsible)
        products = self.get_products()

        mail.invoice = invmodel

        db.session.add(mail)

        for product in products:
            InvoiceService.handle_invoiceitem(
                full_name=product.full_name, name=product.name, number_local=product.number_local,
                number_global=product.number_global,
                count_order=product.count_order, count_postorder=product.count_postorder,
                count=product.count, price_without_NDS=product.price_without_NDS,
                price_with_NDS=product.price_with_NDS, sum_without_NDS=product.sum_without_NDS,
                sum_NDS=product.sum_NDS, rate_NDS=product.rate_NDS, sum_with_NDS=product.sum_with_NDS,
                thematic=product.thematic, count_whole_pack=product.count_whole_pack,
                placer=product.placer, invoice=invmodel)