mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 05:05:42 +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:
		| @@ -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 | ||||
|  | ||||
|   | ||||
| @@ -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'] | ||||
|  | ||||
|   | ||||
| @@ -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", | ||||
|             ), | ||||
|         ), | ||||
|     ] | ||||
| @@ -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. | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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 [ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user