Skip to content

Commit

Permalink
Attempt to fix filtering invoiceline by dimensions
Browse files Browse the repository at this point in the history
Not working
  • Loading branch information
mlebreuil committed Aug 18, 2024
1 parent 8e3e865 commit 2bed2d6
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* [154](https://github.com/mlebreuil/netbox-contract/issues/154) Fix edit and delete bulk operations on dimensions and invoice lines.
* [153](https://github.com/mlebreuil/netbox-contract/issues/153) Enforce uniquness of accounting dimensions.
* Adds a status ( Active or Inactive ) to accounitng dimensions.
* [151](https://github.com/mlebreuil/netbox-contract/issues/151) Fix accounting line and dimensions search.

### Version 2.2.1

Expand Down
6 changes: 3 additions & 3 deletions src/netbox_contract/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class Meta:

class NestedContractAssignmentSerializer(WritableNestedSerializer):
url = serializers.HyperlinkedIdentityField(
view_name='plugins-api:netbox_contract-api:ContractAssignment-detail'
view_name='plugins-api:netbox_contract-api:contractassignment-detail'
)

class Meta:
Expand All @@ -61,7 +61,7 @@ class Meta:

class NestedInvoicelineSerializer(WritableNestedSerializer):
url = serializers.HyperlinkedIdentityField(
view_name='plugins-api:netbox_contract-api:InvoiceLine-detail'
view_name='plugins-api:netbox_contract-api:invoiceline-detail'
)

class Meta:
Expand All @@ -79,7 +79,7 @@ class Meta:

class NestedAccountingDimensionSerializer(WritableNestedSerializer):
url = serializers.HyperlinkedIdentityField(
view_name='plugins-api:netbox_contract-api:AccountingDimension-detail'
view_name='plugins-api:netbox_contract-api:accountingdimension-detail'
)

class Meta:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 5.0.6 on 2024-08-18 19:37

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
('netbox_contract', '0035_accountingdimension_status_and_more'),
]

operations = [
migrations.AlterField(
model_name='invoiceline',
name='accounting_dimensions',
field=models.ManyToManyField(
blank=True, to='netbox_contract.accountingdimension'
),
),
]
4 changes: 1 addition & 3 deletions src/netbox_contract/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,7 @@ class InvoiceLine(NetBoxModel):
max_length=3, choices=CurrencyChoices, default=CurrencyChoices.CURRENCY_USD
)
amount = models.DecimalField(max_digits=10, decimal_places=2)
accounting_dimensions = models.ManyToManyField(
AccountingDimension, related_name='invoicelines', blank=True
)
accounting_dimensions = models.ManyToManyField(AccountingDimension, blank=True)
comments = models.TextField(blank=True)

def get_absolute_url(self):
Expand Down

0 comments on commit 2bed2d6

Please sign in to comment.