Order change manager: Allow to disable invoice issuing

This commit is contained in:
Raphael Michel
2019-10-10 12:19:06 +02:00
parent fb3fc05522
commit d4d046ca60
5 changed files with 24 additions and 3 deletions

View File

@@ -168,6 +168,15 @@ class OtherOperationsForm(forms.Form):
'Use with care and only if you need to. Note that rounding differences might occur in this procedure.'
)
)
reissue_invoice = forms.BooleanField(
label=_('Issue a new invoice if required'),
required=False,
initial=True,
help_text=_(
'If an invoice exists for this order and this operation would change its contents, the old invoice will '
'be cancelled and a new invoice will be issued.'
)
)
notify = forms.BooleanField(
label=_('Notify user'),
required=False,

View File

@@ -215,6 +215,7 @@
</div>
{% endif %}
{% bootstrap_field other_form.recalculate_taxes layout="control" %}
{% bootstrap_field other_form.reissue_invoice layout="control" %}
{% bootstrap_field other_form.notify layout="control" %}
</div>
</div>

View File

@@ -1297,7 +1297,8 @@ class OrderChange(OrderView):
ocm = OrderChangeManager(
self.order,
user=self.request.user,
notify=notify
notify=notify,
reissue_invoice=self.other_form.cleaned_data['reissue_invoice'] if self.other_form.is_valid() else True
)
form_valid = self._process_add(ocm) and self._process_change(ocm) and self._process_other(ocm)