feat(inventory): учитывать коэффициент конверсии при резервировании компонентов комплектов
Добавлены поля original_sales_unit и conversion_factor в KitItemSnapshot для хранения единиц продажи и коэффициентов конверсии на момент создания снимка. Обновлена логика резервирования запасов для корректного расчета количества в базовых единицах. Изменения в шаблоне редактирования комплектов для сохранения выбранных единиц продажи при обновлении списка опций. BREAKING CHANGE: Изменена структура данных в KitItemSnapshot, требуется миграция базы данных.
This commit is contained in:
29
prepare_js.py
Normal file
29
prepare_js.py
Normal file
@@ -0,0 +1,29 @@
|
||||
|
||||
import re
|
||||
|
||||
file_path = r'c:\Users\team_\Desktop\test_qwen\myproject\products\templates\products\productkit_edit.html'
|
||||
|
||||
try:
|
||||
with open(file_path, 'r', encoding='utf-8') as f:
|
||||
lines = f.readlines()
|
||||
except FileNotFoundError:
|
||||
print(f"File not found: {file_path}")
|
||||
exit(1)
|
||||
|
||||
# Extract script part (approx lines 451 to 1321)
|
||||
# Note: lines are 0-indexed in list
|
||||
script_lines = lines[450:1322]
|
||||
script_content = "".join(script_lines)
|
||||
|
||||
# Replace Django tags
|
||||
# Replace {% ... %} with "TEMPLATETAG"
|
||||
script_content = re.sub(r'\{%.*?%\}', '"TEMPLATETAG"', script_content)
|
||||
# Replace {{ ... }} with "VARIABLE" or {}
|
||||
script_content = re.sub(r'\{\{.*?\}\}', '{}', script_content)
|
||||
|
||||
# Save to temp js file
|
||||
temp_js_path = r'c:\Users\team_\Desktop\test_qwen\temp_check.js'
|
||||
with open(temp_js_path, 'w', encoding='utf-8') as f:
|
||||
f.write(script_content)
|
||||
|
||||
print(f"Written to {temp_js_path}")
|
||||
Reference in New Issue
Block a user