code: def createInvoice(self, pdf):
          
          client = self.getClient()
          invoice = self.getInvoice()
          if not invoice:
              invoice = _createObjectByType("Invoice", client, tmpID())
          invoice.edit(
              AnalysisRequest=self,
              Client=client,
              InvoiceDate=DateTime(),
              InvoicePDF=pdf
          )
          invoice.processForm()
          self.setInvoice(invoice)
          return invoice
docs: Issue invoice