added wherehouse json

This commit is contained in:
behruz-dev
2025-10-24 16:24:11 +05:00
parent 4cda8468fc
commit 0c460b507e
4 changed files with 7510 additions and 7058 deletions

View File

@@ -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 ✅"))

View 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
View 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ı!"
}
}

View File

@@ -1,89 +1,8 @@
{
"data": {
"current_page": 1,
"total": 87,
"total": 84,
"data": [
{
"id": 245176,
"status": "open",
"delivery_date": "26.10.2025",
"product": {
"id": 2404,
"name": {
"uz": "Mol go'shti",
"en": "Mol go'shti",
"ru": "Mol go'shti"
},
"code": null,
"resource": {
"id": 2,
"name": {
"en": "Product",
"ru": "Продукт",
"uz": "Mahsulot",
"tr": "Ürün"
},
"symbol": {
"en": "PRD",
"ru": "ПPO",
"uz": "MAH",
"tr": "URN"
},
"color": "#027A48",
"type": "product"
}
},
"quantity": 6,
"unit": {
"id": 33,
"name": {
"en": "KG",
"ru": "КГ",
"uz": "KG"
},
"symbol": {
"en": "KG",
"ru": "КГ",
"uz": "KG"
},
"is_piece": true
},
"creator": {
"id": 110,
"full_name": "Imomov Jasurbek",
"image": null
},
"amount": 0,
"total_amount": 0,
"paid_amount": 0,
"calculated_amount": 0,
"must_pay_amount": 0,
"warehouse": {
"id": 121,
"name": "МАВРИД КУХНЯ",
"mine": true
},
"project": {
"id": 89,
"name": "Mavrid",
"is_project": false
},
"task": null,
"section": null,
"company_person": null,
"currency": {
"id": 1,
"name": {
"ru": "Узбекский сум",
"uz": "O'zbek so'mi"
},
"symbol": "UZS",
"icon": "https://backend.app.uyqur.uz/public/upload/image/YZfoihq4VHMSHaZziQlp.webp"
},
"unread_message_count": 0,
"custom_field_values": [],
"created_at": "24.10.2025 11:05"
},
{
"id": 245174,
"status": "open",
@@ -2676,87 +2595,6 @@
"custom_field_values": [],
"created_at": "24.10.2025 08:11"
},
{
"id": 244883,
"status": "open",
"delivery_date": "24.10.2025",
"product": {
"id": 2307,
"name": {
"uz": "Non",
"en": "Non",
"ru": "Non"
},
"code": null,
"resource": {
"id": 2,
"name": {
"en": "Product",
"ru": "Продукт",
"uz": "Mahsulot",
"tr": "Ürün"
},
"symbol": {
"en": "PRD",
"ru": "ПPO",
"uz": "MAH",
"tr": "URN"
},
"color": "#027A48",
"type": "product"
}
},
"quantity": 42,
"unit": {
"id": 79,
"name": {
"en": "Pieces",
"ru": "Штук",
"uz": "Dona"
},
"symbol": {
"en": "pcs",
"ru": "ШТ",
"uz": "dona"
},
"is_piece": true
},
"creator": {
"id": 110,
"full_name": "Imomov Jasurbek",
"image": null
},
"amount": 0,
"total_amount": 0,
"paid_amount": 0,
"calculated_amount": 0,
"must_pay_amount": 0,
"warehouse": {
"id": 121,
"name": "МАВРИД КУХНЯ",
"mine": true
},
"project": {
"id": 89,
"name": "Mavrid",
"is_project": false
},
"task": null,
"section": null,
"company_person": null,
"currency": {
"id": 1,
"name": {
"ru": "Узбекский сум",
"uz": "O'zbek so'mi"
},
"symbol": "UZS",
"icon": "https://backend.app.uyqur.uz/public/upload/image/YZfoihq4VHMSHaZziQlp.webp"
},
"unread_message_count": 0,
"custom_field_values": [],
"created_at": "24.10.2025 07:33"
},
{
"id": 244818,
"status": "open",
@@ -3405,87 +3243,6 @@
"custom_field_values": [],
"created_at": "22.10.2025 13:08"
},
{
"id": 242570,
"status": "open",
"delivery_date": "23.10.2025",
"product": {
"id": 4223,
"name": {
"uz": "Beton M-350",
"en": "Beton M-350",
"ru": "Beton M-350"
},
"code": null,
"resource": {
"id": 2,
"name": {
"en": "Product",
"ru": "Продукт",
"uz": "Mahsulot",
"tr": "Ürün"
},
"symbol": {
"en": "PRD",
"ru": "ПPO",
"uz": "MAH",
"tr": "URN"
},
"color": "#027A48",
"type": "product"
}
},
"quantity": 5.5,
"unit": {
"id": 117,
"name": {
"en": "Cubic meter",
"ru": "Кубический метр",
"uz": "Kub metr"
},
"symbol": {
"en": "м³",
"ru": "м³",
"uz": "m³"
},
"is_piece": true
},
"creator": {
"id": 110,
"full_name": "Imomov Jasurbek",
"image": null
},
"amount": 0,
"total_amount": 0,
"paid_amount": 0,
"calculated_amount": 0,
"must_pay_amount": 0,
"warehouse": {
"id": 22,
"name": "MAVRID (ФАРМ)",
"mine": true
},
"project": {
"id": 89,
"name": "Mavrid",
"is_project": false
},
"task": null,
"section": null,
"company_person": null,
"currency": {
"id": 1,
"name": {
"ru": "Узбекский сум",
"uz": "O'zbek so'mi"
},
"symbol": "UZS",
"icon": "https://backend.app.uyqur.uz/public/upload/image/YZfoihq4VHMSHaZziQlp.webp"
},
"unread_message_count": 0,
"custom_field_values": [],
"created_at": "21.10.2025 14:42"
},
{
"id": 242394,
"status": "open",