locations: тип «Сервис / поставщик» для Вайтер Юг и аналогов.

Выбор в журнале работ и код объекта в it_monthly; сид Вайтер Юг.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-07 15:56:19 +03:00
parent c78c1de2a1
commit f4737155c5
6 changed files with 116 additions and 8 deletions
+27
View File
@@ -680,3 +680,30 @@ class LocationSortKeyTests(TestCase):
street='Старый', house_number='2', is_active=False,
)
self.assertNotIn(dead_office.pk, ids)
def test_vendor_location_in_select_and_report_code(self):
from apps.it_manager.views import _it_locations_sorted
from apps.locations.models.base import Location
from apps.reports.it_monthly.builder import location_object_code
from core.test_utils import grant_all_locations
from apps.employees.tests import make_employee
region_type, _ = DirectoryType.objects.get_or_create(
code='region', defaults={'name': 'Регион'},
)
region = Directory.objects.create(
directory_type=region_type, code='od-vendor', name='Одесса-vendor',
)
vendor = Location.objects.create(
location_type='vendor',
name='Вайтер Юг',
location_region=region,
is_active=True,
)
self.assertEqual(str(vendor), 'Вайтер Юг')
self.assertEqual(location_object_code(vendor), 'Вайтер Юг')
user = make_employee('it-loc-vendor')
grant_all_locations(user)
ids = {loc.pk for loc in _it_locations_sorted(user)}
self.assertIn(vendor.pk, ids)