added wherehouse json
This commit is contained in:
@@ -24,9 +24,8 @@ class Command(BaseCommand):
|
||||
product_name = item['product']['name']['uz']
|
||||
unit_name = item['unit']['name']['uz']
|
||||
warehouse_name = item['warehouse']['name']
|
||||
project_name = item['project']['name']
|
||||
project_name = item.get('project').get('name') if item.get('project') else None
|
||||
creator_name = item['creator']['full_name']
|
||||
|
||||
product = Product.objects.filter(name=product_name).first()
|
||||
unity = Unity.objects.filter(value=unit_name).first()
|
||||
wherehouse = WhereHouse.objects.filter(name=warehouse_name).first()
|
||||
@@ -35,7 +34,13 @@ class Command(BaseCommand):
|
||||
|
||||
delivery_date = datetime.strptime(item['delivery_date'], "%d.%m.%Y").date()
|
||||
created_at = datetime.strptime(item['created_at'], "%d.%m.%Y %H:%M")
|
||||
|
||||
if not product:
|
||||
product = Product.objects.create(
|
||||
name=product_name,
|
||||
product_code=item['product']['code'],
|
||||
type=item['product']['resource']['type'].upper(),
|
||||
unity=unity
|
||||
)
|
||||
Order.objects.update_or_create(
|
||||
status=item['status'].upper(),
|
||||
product=product,
|
||||
@@ -48,5 +53,6 @@ class Command(BaseCommand):
|
||||
created_at=created_at,
|
||||
date=delivery_date
|
||||
)
|
||||
break
|
||||
|
||||
self.stdout.write(self.style.SUCCESS("Orders imported successfully ✅"))
|
||||
|
||||
22
core/apps/wherehouse/management/commands/import_warehouse.py
Normal file
22
core/apps/wherehouse/management/commands/import_warehouse.py
Normal file
@@ -0,0 +1,22 @@
|
||||
import json
|
||||
from django.core.management import BaseCommand
|
||||
|
||||
from core.apps.wherehouse.models import WhereHouse
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument('file_path', type=str, help='Path to JSON file')
|
||||
|
||||
def handle(self, *args, **options):
|
||||
file_path = options['file_path']
|
||||
|
||||
with open(file_path, 'r') as f:
|
||||
data = json.load(f)
|
||||
|
||||
for item in data['data']['warehouses']:
|
||||
WhereHouse.objects.get_or_create(
|
||||
name=item['name']
|
||||
)
|
||||
|
||||
self.stdout.write("Warehouses added")
|
||||
667
data/warehouse.json
Normal file
667
data/warehouse.json
Normal file
@@ -0,0 +1,667 @@
|
||||
{
|
||||
"data": {
|
||||
"warehouses": [
|
||||
{
|
||||
"id": 22,
|
||||
"name": "MAVRID (ФАРМ)",
|
||||
"users": [
|
||||
{
|
||||
"id": 104,
|
||||
"full_name": "SuperAdminIskander",
|
||||
"image": "https://backend.app.uyqur.uz/public/upload/image/neDbGZivNlWAz5nHopbl.webp"
|
||||
},
|
||||
{
|
||||
"id": 110,
|
||||
"full_name": "Imomov Jasurbek",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 112,
|
||||
"full_name": "QIYOMOV TEMURBEK",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 111,
|
||||
"full_name": "MARDONOVA DILAFRUZ",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 113,
|
||||
"full_name": "Durdona",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 107,
|
||||
"full_name": "Iskandarov Farrux",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 108,
|
||||
"full_name": "Xudjaqulov Abbos",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 109,
|
||||
"full_name": "Mirjonov Meronshox",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 138,
|
||||
"full_name": "Baratova Zilola",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 306,
|
||||
"full_name": "Uyqur Support",
|
||||
"image": null
|
||||
}
|
||||
],
|
||||
"status": "active"
|
||||
},
|
||||
{
|
||||
"id": 23,
|
||||
"name": "marketing",
|
||||
"users": [
|
||||
{
|
||||
"id": 113,
|
||||
"full_name": "Durdona",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 104,
|
||||
"full_name": "SuperAdminIskander",
|
||||
"image": "https://backend.app.uyqur.uz/public/upload/image/neDbGZivNlWAz5nHopbl.webp"
|
||||
},
|
||||
{
|
||||
"id": 109,
|
||||
"full_name": "Mirjonov Meronshox",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 111,
|
||||
"full_name": "MARDONOVA DILAFRUZ",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 108,
|
||||
"full_name": "Xudjaqulov Abbos",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 138,
|
||||
"full_name": "Baratova Zilola",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 306,
|
||||
"full_name": "Uyqur Support",
|
||||
"image": null
|
||||
}
|
||||
],
|
||||
"status": "active"
|
||||
},
|
||||
{
|
||||
"id": 49,
|
||||
"name": "Prorab qurilish MAVRID",
|
||||
"users": [
|
||||
{
|
||||
"id": 104,
|
||||
"full_name": "SuperAdminIskander",
|
||||
"image": "https://backend.app.uyqur.uz/public/upload/image/neDbGZivNlWAz5nHopbl.webp"
|
||||
},
|
||||
{
|
||||
"id": 108,
|
||||
"full_name": "Xudjaqulov Abbos",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 138,
|
||||
"full_name": "Baratova Zilola",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 211,
|
||||
"full_name": "Рустамов Шерзод",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 306,
|
||||
"full_name": "Uyqur Support",
|
||||
"image": null
|
||||
}
|
||||
],
|
||||
"status": "active"
|
||||
},
|
||||
{
|
||||
"id": 50,
|
||||
"name": "Yunusobod ombor",
|
||||
"users": [
|
||||
{
|
||||
"id": 104,
|
||||
"full_name": "SuperAdminIskander",
|
||||
"image": "https://backend.app.uyqur.uz/public/upload/image/neDbGZivNlWAz5nHopbl.webp"
|
||||
},
|
||||
{
|
||||
"id": 138,
|
||||
"full_name": "Baratova Zilola",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 202,
|
||||
"full_name": "Самадов Мехриддин",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 219,
|
||||
"full_name": "Тухтаева Шахзода",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 107,
|
||||
"full_name": "Iskandarov Farrux",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 306,
|
||||
"full_name": "Uyqur Support",
|
||||
"image": null
|
||||
}
|
||||
],
|
||||
"status": "active"
|
||||
},
|
||||
{
|
||||
"id": 51,
|
||||
"name": "Yunusobod marketing",
|
||||
"users": [
|
||||
{
|
||||
"id": 104,
|
||||
"full_name": "SuperAdminIskander",
|
||||
"image": "https://backend.app.uyqur.uz/public/upload/image/neDbGZivNlWAz5nHopbl.webp"
|
||||
},
|
||||
{
|
||||
"id": 113,
|
||||
"full_name": "Durdona",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 138,
|
||||
"full_name": "Baratova Zilola",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 306,
|
||||
"full_name": "Uyqur Support",
|
||||
"image": null
|
||||
}
|
||||
],
|
||||
"status": "active"
|
||||
},
|
||||
{
|
||||
"id": 62,
|
||||
"name": "Yunusobod sklad instrument",
|
||||
"users": [
|
||||
{
|
||||
"id": 104,
|
||||
"full_name": "SuperAdminIskander",
|
||||
"image": "https://backend.app.uyqur.uz/public/upload/image/neDbGZivNlWAz5nHopbl.webp"
|
||||
},
|
||||
{
|
||||
"id": 138,
|
||||
"full_name": "Baratova Zilola",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 219,
|
||||
"full_name": "Тухтаева Шахзода",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 306,
|
||||
"full_name": "Uyqur Support",
|
||||
"image": null
|
||||
}
|
||||
],
|
||||
"status": "active"
|
||||
},
|
||||
{
|
||||
"id": 63,
|
||||
"name": "Yunusobod adminstrativniy xarajatlar",
|
||||
"users": [
|
||||
{
|
||||
"id": 104,
|
||||
"full_name": "SuperAdminIskander",
|
||||
"image": "https://backend.app.uyqur.uz/public/upload/image/neDbGZivNlWAz5nHopbl.webp"
|
||||
},
|
||||
{
|
||||
"id": 138,
|
||||
"full_name": "Baratova Zilola",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 147,
|
||||
"full_name": "Rajabov Shohruh",
|
||||
"image": "https://backend.app.uyqur.uz/public/upload/image/W2XUDsHUUnr4E3mjfJIx.webp"
|
||||
},
|
||||
{
|
||||
"id": 306,
|
||||
"full_name": "Uyqur Support",
|
||||
"image": null
|
||||
}
|
||||
],
|
||||
"status": "active"
|
||||
},
|
||||
{
|
||||
"id": 101,
|
||||
"name": "Офис",
|
||||
"users": [
|
||||
{
|
||||
"id": 104,
|
||||
"full_name": "SuperAdminIskander",
|
||||
"image": "https://backend.app.uyqur.uz/public/upload/image/neDbGZivNlWAz5nHopbl.webp"
|
||||
},
|
||||
{
|
||||
"id": 109,
|
||||
"full_name": "Mirjonov Meronshox",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 138,
|
||||
"full_name": "Baratova Zilola",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 306,
|
||||
"full_name": "Uyqur Support",
|
||||
"image": null
|
||||
}
|
||||
],
|
||||
"status": "active"
|
||||
},
|
||||
{
|
||||
"id": 108,
|
||||
"name": "Mavrid sklad instrument",
|
||||
"users": [
|
||||
{
|
||||
"id": 104,
|
||||
"full_name": "SuperAdminIskander",
|
||||
"image": "https://backend.app.uyqur.uz/public/upload/image/neDbGZivNlWAz5nHopbl.webp"
|
||||
},
|
||||
{
|
||||
"id": 138,
|
||||
"full_name": "Baratova Zilola",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 110,
|
||||
"full_name": "Imomov Jasurbek",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 306,
|
||||
"full_name": "Uyqur Support",
|
||||
"image": null
|
||||
}
|
||||
],
|
||||
"status": "active"
|
||||
},
|
||||
{
|
||||
"id": 109,
|
||||
"name": "Yunusobod sklad inventar",
|
||||
"users": [
|
||||
{
|
||||
"id": 104,
|
||||
"full_name": "SuperAdminIskander",
|
||||
"image": "https://backend.app.uyqur.uz/public/upload/image/neDbGZivNlWAz5nHopbl.webp"
|
||||
},
|
||||
{
|
||||
"id": 138,
|
||||
"full_name": "Baratova Zilola",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 219,
|
||||
"full_name": "Тухтаева Шахзода",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 306,
|
||||
"full_name": "Uyqur Support",
|
||||
"image": null
|
||||
}
|
||||
],
|
||||
"status": "active"
|
||||
},
|
||||
{
|
||||
"id": 110,
|
||||
"name": "Mavrid sklad inventar",
|
||||
"users": [
|
||||
{
|
||||
"id": 104,
|
||||
"full_name": "SuperAdminIskander",
|
||||
"image": "https://backend.app.uyqur.uz/public/upload/image/neDbGZivNlWAz5nHopbl.webp"
|
||||
},
|
||||
{
|
||||
"id": 138,
|
||||
"full_name": "Baratova Zilola",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 110,
|
||||
"full_name": "Imomov Jasurbek",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 306,
|
||||
"full_name": "Uyqur Support",
|
||||
"image": null
|
||||
}
|
||||
],
|
||||
"status": "active"
|
||||
},
|
||||
{
|
||||
"id": 111,
|
||||
"name": "Yunusobod Ofis",
|
||||
"users": [
|
||||
{
|
||||
"id": 104,
|
||||
"full_name": "SuperAdminIskander",
|
||||
"image": "https://backend.app.uyqur.uz/public/upload/image/neDbGZivNlWAz5nHopbl.webp"
|
||||
},
|
||||
{
|
||||
"id": 138,
|
||||
"full_name": "Baratova Zilola",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 109,
|
||||
"full_name": "Mirjonov Meronshox",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 107,
|
||||
"full_name": "Iskandarov Farrux",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 306,
|
||||
"full_name": "Uyqur Support",
|
||||
"image": null
|
||||
}
|
||||
],
|
||||
"status": "active"
|
||||
},
|
||||
{
|
||||
"id": 112,
|
||||
"name": "Mavrid Ofis",
|
||||
"users": [
|
||||
{
|
||||
"id": 104,
|
||||
"full_name": "SuperAdminIskander",
|
||||
"image": "https://backend.app.uyqur.uz/public/upload/image/neDbGZivNlWAz5nHopbl.webp"
|
||||
},
|
||||
{
|
||||
"id": 138,
|
||||
"full_name": "Baratova Zilola",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 109,
|
||||
"full_name": "Mirjonov Meronshox",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 306,
|
||||
"full_name": "Uyqur Support",
|
||||
"image": null
|
||||
}
|
||||
],
|
||||
"status": "active"
|
||||
},
|
||||
{
|
||||
"id": 114,
|
||||
"name": "Prorab Qurilish Yunusobod",
|
||||
"users": [
|
||||
{
|
||||
"id": 104,
|
||||
"full_name": "SuperAdminIskander",
|
||||
"image": "https://backend.app.uyqur.uz/public/upload/image/neDbGZivNlWAz5nHopbl.webp"
|
||||
},
|
||||
{
|
||||
"id": 211,
|
||||
"full_name": "Рустамов Шерзод",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 306,
|
||||
"full_name": "Uyqur Support",
|
||||
"image": null
|
||||
}
|
||||
],
|
||||
"status": "active"
|
||||
},
|
||||
{
|
||||
"id": 120,
|
||||
"name": "МАВРИД АДМИНИСТРАТИВНЫЙ РАСХОД",
|
||||
"users": [
|
||||
{
|
||||
"id": 147,
|
||||
"full_name": "Rajabov Shohruh",
|
||||
"image": "https://backend.app.uyqur.uz/public/upload/image/W2XUDsHUUnr4E3mjfJIx.webp"
|
||||
},
|
||||
{
|
||||
"id": 104,
|
||||
"full_name": "SuperAdminIskander",
|
||||
"image": "https://backend.app.uyqur.uz/public/upload/image/neDbGZivNlWAz5nHopbl.webp"
|
||||
},
|
||||
{
|
||||
"id": 306,
|
||||
"full_name": "Uyqur Support",
|
||||
"image": null
|
||||
}
|
||||
],
|
||||
"status": "active"
|
||||
},
|
||||
{
|
||||
"id": 121,
|
||||
"name": "МАВРИД КУХНЯ",
|
||||
"users": [
|
||||
{
|
||||
"id": 107,
|
||||
"full_name": "Iskandarov Farrux",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 110,
|
||||
"full_name": "Imomov Jasurbek",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 138,
|
||||
"full_name": "Baratova Zilola",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 306,
|
||||
"full_name": "Uyqur Support",
|
||||
"image": null
|
||||
}
|
||||
],
|
||||
"status": "active"
|
||||
},
|
||||
{
|
||||
"id": 122,
|
||||
"name": "МАВРИД АПТЕКА",
|
||||
"users": [
|
||||
{
|
||||
"id": 107,
|
||||
"full_name": "Iskandarov Farrux",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 109,
|
||||
"full_name": "Mirjonov Meronshox",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 110,
|
||||
"full_name": "Imomov Jasurbek",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 138,
|
||||
"full_name": "Baratova Zilola",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 306,
|
||||
"full_name": "Uyqur Support",
|
||||
"image": null
|
||||
}
|
||||
],
|
||||
"status": "active"
|
||||
},
|
||||
{
|
||||
"id": 123,
|
||||
"name": "МАВРИД КОНС ТОВАР",
|
||||
"users": [
|
||||
{
|
||||
"id": 107,
|
||||
"full_name": "Iskandarov Farrux",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 110,
|
||||
"full_name": "Imomov Jasurbek",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 138,
|
||||
"full_name": "Baratova Zilola",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 306,
|
||||
"full_name": "Uyqur Support",
|
||||
"image": null
|
||||
}
|
||||
],
|
||||
"status": "active"
|
||||
},
|
||||
{
|
||||
"id": 124,
|
||||
"name": "ЮНУСОБОД КУХНЯ",
|
||||
"users": [
|
||||
{
|
||||
"id": 107,
|
||||
"full_name": "Iskandarov Farrux",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 219,
|
||||
"full_name": "Тухтаева Шахзода",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 138,
|
||||
"full_name": "Baratova Zilola",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 306,
|
||||
"full_name": "Uyqur Support",
|
||||
"image": null
|
||||
}
|
||||
],
|
||||
"status": "active"
|
||||
},
|
||||
{
|
||||
"id": 125,
|
||||
"name": "ЮНУСОБОД АПТЕКА",
|
||||
"users": [
|
||||
{
|
||||
"id": 107,
|
||||
"full_name": "Iskandarov Farrux",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 219,
|
||||
"full_name": "Тухтаева Шахзода",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 138,
|
||||
"full_name": "Baratova Zilola",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 306,
|
||||
"full_name": "Uyqur Support",
|
||||
"image": null
|
||||
}
|
||||
],
|
||||
"status": "active"
|
||||
},
|
||||
{
|
||||
"id": 126,
|
||||
"name": "ЮНУСОБОД КОНС ТОВАР",
|
||||
"users": [
|
||||
{
|
||||
"id": 107,
|
||||
"full_name": "Iskandarov Farrux",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 219,
|
||||
"full_name": "Тухтаева Шахзода",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 138,
|
||||
"full_name": "Baratova Zilola",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 306,
|
||||
"full_name": "Uyqur Support",
|
||||
"image": null
|
||||
}
|
||||
],
|
||||
"status": "active"
|
||||
},
|
||||
{
|
||||
"id": 158,
|
||||
"name": "МАВРИД ХИЗМАТЛАР",
|
||||
"users": [
|
||||
{
|
||||
"id": 110,
|
||||
"full_name": "Imomov Jasurbek",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 138,
|
||||
"full_name": "Baratova Zilola",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 107,
|
||||
"full_name": "Iskandarov Farrux",
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"id": 306,
|
||||
"full_name": "Uyqur Support",
|
||||
"image": null
|
||||
}
|
||||
],
|
||||
"status": "active"
|
||||
}
|
||||
],
|
||||
"warehouse_folders": []
|
||||
},
|
||||
"message": {
|
||||
"uz": "Muvaffaqiyatli!",
|
||||
"ru": "Успешно!",
|
||||
"en": "Success!",
|
||||
"tr": "Başarılı!"
|
||||
}
|
||||
}
|
||||
13867
order.json
13867
order.json
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user