示例#1
0
 def form_valid(self, form):
     ledger_model, invoice_model = new_invoice_protocol(
         invoice_model=form.instance,
         entity_slug=self.kwargs['entity_slug'],
         user_model=self.request.user,
     )
     form.instance = invoice_model
     return super().form_valid(form=form)
示例#2
0
 def form_valid(self, form):
     unit_slug = form.cleaned_data.get('entity_unit')
     form.instance = new_invoice_protocol(
         invoice_model=form.instance,
         entity_slug=self.kwargs['entity_slug'],
         user_model=self.request.user,
         unit_slug=unit_slug
     )
     return super().form_valid(form=form)