This commit is contained in:
gitea 2025-02-11 12:16:14 +00:00
commit c37f87299b
14 changed files with 137 additions and 26 deletions

128
generate.py Normal file
View File

@ -0,0 +1,128 @@
from inventory.models import *
from rich import print
import random
import datetime
from inventory.services import decodevin
def run():
# car = Car.objects.filter(vin='2C3HD46R4WH170267')
vin_list = [
"1B3ES56C13D120225",
"1GB4KYC86FF131536",
"1HSHXAHR15J136217",
"1G1ZT52845F231124",
"1J4GK48K43W721617",
"JTDBE32K430163717",
"1J4FA69S05P331572",
"2FMGK5D86EBD28496",
"KNADE243696530337",
"1N4AL21EX8N499928",
"1N4AL21E49N400571",
"1G2NW12E54C145398",
"LGJE1EE09SM333542",
"LGJE1EE0XSM333551",
"LGJE1EE02SM333561",
"LGJE1EE0XSM333565",
"LGJE1EE01SM333549",
"LGJE1EE06SM333563",
"LGJE1EE04SM333562",
"LGJE1EE08SM333564",
"LFB1E6078P1Y01338",
"LGJE5EE02PM046815",
"LFB1E6074P1Y01742",
"LGJE5EE07PM132850",
"LGJE1EE08SM311094",
"LFPH4ACP4P2A00123",
"LFB1E6075R1Y00117",
"ZAMPP56F0J1282425",
"LGJE1EE06RM292314",
"LGJE1EE00NM013594",
"LFB1E6075M1Y00272",
"LFB1E6670P1Y00224",
"LFB1E6079N1Y00275",
"LGJE3FE00MM804819",
"LGJE3FE0XMM804844",
"LGJE1EE01RM200767",
"LGJE1EE08RM200703",
"ZAMXS57F7L1341373",
"LGJE5EE06SM330781",
"LFB1E6077P1Y02643",
"LFB1E6074M1Y00151",
"LGJE1EE07RM292323",
"LGJE1EE01RM200171",
"LGJE1EE04SM311545",
"LGJE1EE04RM292859",
"LGJE1EE02RM292861",
"LFB1E607XP1Y01454",
"LFB1E6073P1Y00081",
"LGJE1EE03PM129391",
"LGJE1EE03RM200639",
"LGJE1EE02PM128393",
"LGJE1EE03NM964436",
"LGJE1EE06RM211599",
"LGJE1EE06NM014104",
"LGJE1EE05NM014272",
"LGJE5EE06SM331641",
"LGJE1EE09NM013528",
"LGJE5EE0XPM048196",
"LGJE1EE01RM212935",
"LGJE1EE05RM200433",
"LGJE1EE05SM311909",
"LGJE5EE02SM346914",
"LGJE1EE08SM306753",
"LGJE1EE02SM312001",
"LFPH4ACP6R2A02586",
"LGJE1EE00PM048445",
"LGJE1EE02SM311902",
"LGJE1EE03SM312573",
"LGJE1EE00SM306813",
"LFB1E6674N1Y00577",
"LGJE1EE00SM306875",
"LGJE1EE04SM306863",
"LFB1E6079P1Y00389",
"LGJE1EE04SM311562",
"LGJE1EE01SM312006",
"LGJE1EE08SM312486",
"LFB1E6676P1Y00941",
"LFPH4ACP1M1B00116",
"LGJE1EE02SM312564",
"LFPH4BCPXS2L00051",
"LGJE1EE06SM306864",
]
for vin in vin_list:
try:
for _ in range(15):
dealer = Dealer.objects.get(user__email="ismail.mosa.ibrahim@gmail.com")
vin = f"{vin[:-4]}{random.randint(0, 9)}{random.randint(0, 9)}{random.randint(0, 9)}{random.randint(0, 9)}"
result = decodevin(vin)
make = CarMake.objects.get(name=result["maker"])
model = make.carmodel_set.filter(name__contains=result["model"]).first()
if not model or model == "":
model = random.choice(make.carmodel_set.all())
year = result["modelYear"]
serie = random.choice(model.carserie_set.all())
trim = random.choice(serie.cartrim_set.all())
car = Car.objects.create(
vin=vin,
id_car_make=make,
id_car_model=model,
id_car_serie=serie,
id_car_trim=trim,
year=(int(year) or 2025),
receiving_date=datetime.datetime.now(),
dealer=dealer,
)
car_finance = CarFinance.objects.create(
car=car, cost_price=10000, selling_price=20000
)
car_color = CarColors.objects.create(
car=car,
interior=random.choice(InteriorColors.objects.all()),
exterior=random.choice(ExteriorColors.objects.all()),
)
print(make, model, serie, trim)
except Exception as e:
print(e)

View File

@ -41,26 +41,3 @@ class LocalizedNameMixin:
# return super().form_valid(form)
# else:
# return form.errors
class BaseDateNavigationUrlMixIn:
BASE_DATE_URL_KWARGS = (
'entity_slug',
'unit_slug',
'ledger_pk',
'account_pk',
'coa_slug'
)
def get_context_data(self, **kwargs):
context = super(BaseDateNavigationUrlMixIn, self).get_context_data(**kwargs)
self.get_base_date_nav_url(context)
return context
def get_base_date_nav_url(self, context, **kwargs):
view_name = context['view'].request.resolver_match.url_name
view_name_base = '-'.join(view_name.split('-')[:2])
context['date_navigation_url'] = reverse(
view_name_base,
kwargs={
k: v for k, v in self.kwargs.items() if
k in self.BASE_DATE_URL_KWARGS
})

View File

@ -33,6 +33,7 @@ ctranslate2==4.5.0
cycler==0.12.1
Cython==3.1.0a1
decorator==5.1.1
defusedxml==0.7.1
desert==2020.11.18
dill==0.3.9
distro==1.9.0
@ -84,6 +85,8 @@ filelock==3.17.0
fire==0.7.0
Flask==3.1.0
fonttools==4.55.7
fpdf==1.7.2
fpdf2==2.8.2
frozenlist==1.5.0
fsspec==2024.12.0
gprof2dot==2024.6.6
@ -171,6 +174,7 @@ pyobjc-core==11.0
pyobjc-framework-Cocoa==11.0
pyobjc-framework-Quartz==11.0
pyparsing==3.2.1
pypdf==5.3.0
pyperclip==1.9.0
pyphen==0.17.2
pypng==0.20220715.0

BIN
static/.DS_Store vendored

Binary file not shown.

View File

@ -1,4 +1,6 @@
.color-div {
.color-div {
width: 64px;
height: 16px;
padding: 2px 4px;

View File

@ -76,7 +76,7 @@
--phoenix-dark-border-subtle: #8a94ad;
--phoenix-white-rgb: 255, 255, 255;
--phoenix-black-rgb: 0, 0, 0;
--phoenix-font-sans-serif: "Nunito Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
--phoenix-font-sans-serif: "Nunito Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol" !important;
--phoenix-font-monospace: "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
--phoenix-gradient: linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));
--phoenix-body-font-family: var(--phoenix-font-sans-serif);

View File

@ -76,7 +76,7 @@
--phoenix-dark-border-subtle: #8a94ad;
--phoenix-white-rgb: 255, 255, 255;
--phoenix-black-rgb: 0, 0, 0;
--phoenix-font-sans-serif: "Nunito Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
--phoenix-font-sans-serif: "Nunito Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol" !important;
--phoenix-font-monospace: "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
--phoenix-gradient: linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));
--phoenix-body-font-family: var(--phoenix-font-sans-serif);

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB