update
All checks were successful
Setup Native Action / native (3.12.7) (push) Has been skipped
Setup Native Action / docker (3.12.7) (push) Has been skipped

This commit is contained in:
KaySar12 2025-03-24 12:14:24 +07:00
parent 56217678ff
commit 12f395fad4

View File

@ -20,7 +20,7 @@ import odoorpc
import color_log import color_log
# Default configuration # Default configuration
DEFAULT_HOST = "localhost" DEFAULT_HOST = "10.1.1.34"
DEFAULT_PORT = 8069 DEFAULT_PORT = 8069
DEFAULT_USERNAME = "admin" DEFAULT_USERNAME = "admin"
DEFAULT_PASSWORD = "admin" DEFAULT_PASSWORD = "admin"
@ -167,12 +167,12 @@ def process_batch(
# Check references # Check references
if not args.force: if not args.force:
referenced = any( # referenced = any(
odoo.env[rel_model].search_count([(field, "=", record_id)]) # odoo.env[rel_model].search_count([(field, "=", record_id)])
for rel_model, fields in related.items() # for rel_model, fields in related.items()
for field in fields # for field in fields
) # )
if referenced: # if referenced:
model.write([record_id], {"active": False}) model.write([record_id], {"active": False})
archived += 1 archived += 1
color_log.Show(OK, f"Archived {args.base_model} ID {record_id}") color_log.Show(OK, f"Archived {args.base_model} ID {record_id}")