Skip to content

Commit

Permalink
Merge pull request #163 from mlebreuil/fix-invoice-creation
Browse files Browse the repository at this point in the history
fix invoice creation
  • Loading branch information
mlebreuil authored Aug 22, 2024
2 parents 6af0095 + f7cfd35 commit 7b1df14
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@

### Version 2.2.3

* Fix accounting dimensions access through Dynamic Object Fields
* Fix accounting dimensions access through Dynamic Object Fields
* Fix invoice creation from contract.
* Add scripts to convert accounting dimensions in the json fields of contract and invoices to invoice template, invoicelines and dimensions objects.

### Version 2.2.2

Expand Down
4 changes: 4 additions & 0 deletions src/netbox_contract/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ class ContractBulkEditForm(NetBoxModelBulkEditForm):


class InvoiceForm(NetBoxModelForm):
number = forms.CharField(
max_length=100,
help_text='Invoice template name will be overriden to _invoice_template_contract name',
)
contracts = DynamicModelMultipleChoiceField(
queryset=Contract.objects.all(), required=False
)
Expand Down
2 changes: 1 addition & 1 deletion src/netbox_contract/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def get(self, request, *args, **kwargs):
contract = Contract.objects.get(pk=initial_data['contracts'])

try:
last_invoice = contract.invoices.filter(template=False).latest(
last_invoice = contract.invoices.exclude(template=True).latest(
'period_end'
)
new_period_start = last_invoice.period_end + timedelta(days=1)
Expand Down
File renamed without changes.

0 comments on commit 7b1df14

Please sign in to comment.