mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-04 20:51:00 +00:00
Fix constraint for address model (#5076)
* Fix constraint for address model - Do not handle at database level - Add a "validate_unique" method to the address model - Fixes https://github.com/inventree/InvenTree/issues/5070 * Remove unique constraint rule * Unit test fix - Adjust unit test around new code * Further unit test updates
This commit is contained in:
@ -30,8 +30,4 @@ class Migration(migrations.Migration):
|
||||
('company', models.ForeignKey(help_text='Select company', on_delete=django.db.models.deletion.CASCADE, related_name='addresses', to='company.company', verbose_name='Company')),
|
||||
],
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name='address',
|
||||
constraint=models.UniqueConstraint(condition=models.Q(('primary', True)), fields=('company',), name='one_primary_per_company'),
|
||||
),
|
||||
]
|
||||
|
Reference in New Issue
Block a user