locations: тип «Сервис / поставщик» для Вайтер Юг и аналогов.
Выбор в журнале работ и код объекта в it_monthly; сид Вайтер Юг. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user