2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-17 18:26:32 +00:00

feat: add tax_id field to Company model and related forms (#9673)

* feat: add tax_id field to Company model and related forms

* Update 0075_company_tax_id.py to fix typo

* Update models.py to fix typo

* Update tests.py to increment 'column_mappings.count()' to 15

* Update api_version.py
This commit is contained in:
sufyan-mukadam
2025-07-15 00:00:46 +01:00
committed by GitHub
parent d62ac38cb1
commit dcaf7cf7d7
9 changed files with 50 additions and 3 deletions

View File

@@ -1,12 +1,16 @@
"""InvenTree API version information."""
# InvenTree API version
INVENTREE_API_VERSION = 367
INVENTREE_API_VERSION = 368
"""Increment this API version number whenever there is a significant change to the API that any clients need to know about."""
INVENTREE_API_TEXT = """
v368 -> 2025-07-11 : https://github.com/inventree/InvenTree/pull/9673
- Adds 'tax_id' to company model
- Adds 'tax_id' to search fields in the 'CompanyList' API endpoint
v367 -> 2025-07-10 : https://github.com/inventree/InvenTree/pull/10001
- Adds OAuth2 scopes for importer sessions

View File

@@ -60,7 +60,7 @@ class CompanyList(DataExportViewMixin, ListCreateAPI):
'active',
]
search_fields = ['name', 'description', 'website']
search_fields = ['name', 'description', 'website', 'tax_id']
ordering_fields = ['active', 'name', 'parts_supplied', 'parts_manufactured']

View File

@@ -0,0 +1,23 @@
# Generated by Django 4.2.21 on 2025-05-17 17:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("company", "0074_alter_manufacturerpart_link"),
]
operations = [
migrations.AddField(
model_name="company",
name="tax_id",
field=models.CharField(
blank=True,
help_text="Company Tax ID",
max_length=50,
verbose_name="Tax ID",
),
),
]

View File

@@ -106,6 +106,7 @@ class Company(
is_supplier: boolean value, is this company a supplier
is_manufacturer: boolean value, is this company a manufacturer
currency_code: Specifies the default currency for the company
tax_id: Tax ID for the company
"""
class Meta:
@@ -224,6 +225,13 @@ class Company(
validators=[InvenTree.validators.validate_currency_code],
)
tax_id = models.CharField(
max_length=50,
blank=True,
verbose_name=_('Tax ID'),
help_text=_('Company Tax ID'),
)
@property
def address(self):
"""Return the string representation for the primary address.

View File

@@ -52,6 +52,7 @@ class CompanyBriefSerializer(InvenTreeModelSerializer):
'image',
'thumbnail',
'currency',
'tax_id',
]
read_only_fields = ['currency']
@@ -145,6 +146,7 @@ class CompanySerializer(
'remote_image',
'address_count',
'primary_address',
'tax_id',
]
@staticmethod

View File

@@ -39,7 +39,7 @@ class ImporterTest(ImporterMixin, InvenTreeTestCase):
session.extract_columns()
self.assertEqual(session.column_mappings.count(), 14)
self.assertEqual(session.column_mappings.count(), 15)
# Check some of the field mappings
for field, col in [

View File

@@ -125,6 +125,7 @@ export function companyFields(): ApiFormFieldSet {
email: {
icon: <IconAt />
},
tax_id: {},
is_supplier: {},
is_manufacturer: {},
is_customer: {},

View File

@@ -87,6 +87,7 @@ import {
IconStack2,
IconStatusChange,
IconTag,
IconTax,
IconTestPipe,
IconTool,
IconTools,
@@ -181,6 +182,7 @@ const icons: InvenTreeIconType = {
admin: IconUserBolt,
system: IconSettings,
license: IconLicense,
tax_id: IconTax,
// Part Icons
active: IconCheck,

View File

@@ -114,6 +114,13 @@ export default function CompanyDetail(props: Readonly<CompanyDetailProps>) {
label: t`Email Address`,
copy: true,
hidden: !company.email
},
{
type: 'text',
name: 'tax_id',
label: t`Tax ID`,
copy: true,
hidden: !company.tax_id
}
];