Limit InvenTree part descriptions
This commit is contained in:
@@ -46,7 +46,7 @@ class InvenTreeClient:
|
||||
async def create_part(self, *, name: str, description: str, ipn: str) -> dict[str, Any]:
|
||||
payload = {
|
||||
"name": name[:100],
|
||||
"description": description,
|
||||
"description": description[:250],
|
||||
"category": self.settings.inventree_part_category_id,
|
||||
"IPN": ipn[:100],
|
||||
"active": True,
|
||||
|
||||
@@ -235,20 +235,17 @@ class ArchiveSyncService:
|
||||
return f"Bambuddy archive {archive.id}"
|
||||
|
||||
def description_for_archive(self, archive: Archive) -> str:
|
||||
return "\n".join(
|
||||
description = "\n".join(
|
||||
line
|
||||
for line in [
|
||||
"Auto-created from Bambuddy archive.",
|
||||
f"Archive ID: {archive.id}",
|
||||
f"Print name: {archive.print_name}" if archive.print_name else "",
|
||||
f"Filename: {archive.filename}" if archive.filename else "",
|
||||
f"Content hash: {archive.content_hash}" if archive.content_hash else "",
|
||||
f"Printer: {archive.printer_name}" if archive.printer_name else "",
|
||||
f"Created at: {archive.created_at}" if archive.created_at else "",
|
||||
f"Completed at: {archive.completed_at}" if archive.completed_at else "",
|
||||
]
|
||||
if line
|
||||
)
|
||||
return description[:250]
|
||||
|
||||
def stock_notes_for_archive(self, archive: Archive) -> str:
|
||||
duration = archive.actual_time_seconds or archive.print_time_seconds or archive.duration
|
||||
|
||||
Reference in New Issue
Block a user