





















const db = require('../models');
const Users = db.users;






const Organizations = db.organizations;

const Tenants = db.tenants;

const Memberships = db.memberships;

const RoleAssignments = db.role_assignments;

const ApprovalWorkflows = db.approval_workflows;

const ApprovalSteps = db.approval_steps;

const ApprovalRequests = db.approval_requests;

const ApprovalDecisions = db.approval_decisions;

const Companies = db.companies;

const Customers = db.customers;

const Suppliers = db.suppliers;

const Uoms = db.uoms;

const ItemCategories = db.item_categories;

const Items = db.items;

const Warehouses = db.warehouses;

const Locations = db.locations;

const Lots = db.lots;

const SerialNumbers = db.serial_numbers;

const InventoryTransfers = db.inventory_transfers;

const InventoryTransferLines = db.inventory_transfer_lines;

const StockMovements = db.stock_movements;

const Quotations = db.quotations;

const QuotationLines = db.quotation_lines;

const SalesOrders = db.sales_orders;

const SalesOrderLines = db.sales_order_lines;

const SalesAllocations = db.sales_allocations;

const Invoices = db.invoices;

const InvoiceLines = db.invoice_lines;

const CustomerReturns = db.customer_returns;

const CustomerReturnLines = db.customer_return_lines;

const PurchaseOrders = db.purchase_orders;

const PurchaseOrderLines = db.purchase_order_lines;

const Receipts = db.receipts;

const ReceiptLines = db.receipt_lines;

const VendorBills = db.vendor_bills;

const VendorBillLines = db.vendor_bill_lines;

const ChartOfAccounts = db.chart_of_accounts;

const FiscalPeriods = db.fiscal_periods;

const JournalEntries = db.journal_entries;

const JournalLines = db.journal_lines;

const Payments = db.payments;

const TaxRates = db.tax_rates;

const Webhooks = db.webhooks;

const WebhookSubscriptions = db.webhook_subscriptions;

const WebhookDeliveries = db.webhook_deliveries;

const EmailNotifications = db.email_notifications;

const CsvImportJobs = db.csv_import_jobs;

const Reports = db.reports;

const Dashboards = db.dashboards;

const DashboardWidgets = db.dashboard_widgets;







const OrganizationsData = [
    
    {
    
        
        
            
                "name": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Ada Lovelace",
            
        
    
    },
    
];



const TenantsData = [
    
    {
    
        
        
            
                "name": "Acme Operations",
            
        
    
        
        
            
                "slug": "acme-ops",
            
        
    
        
        
            
                "timezone": "America/New_York",
            
        
    
        
        
            
                "default_currency": "USD",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "billing_email": "billing@acme-ops.com",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Northwind Traders",
            
        
    
        
        
            
                "slug": "northwind",
            
        
    
        
        
            
                "timezone": "America/Los_Angeles",
            
        
    
        
        
            
                "default_currency": "USD",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "billing_email": "finance@northwind.io",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Globex Manufacturing",
            
        
    
        
        
            
                "slug": "globex-mfg",
            
        
    
        
        
            
                "timezone": "Europe/London",
            
        
    
        
        
            
                "default_currency": "GBP",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "billing_email": "ap@globex.co",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const MembershipsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "invited",
            
        
    
        
        
            
                "invited_at": new Date('2026-02-01T10:00:00Z'),
            
        
    
        
        
            
                "joined_at": new Date('2026-02-01T12:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "invited_at": new Date('2026-02-10T10:00:00Z'),
            
        
    
        
        
            
                "joined_at": new Date('2026-02-10T11:05:00Z'),
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "suspended",
            
        
    
        
        
            
                "invited_at": new Date('2026-02-05T10:00:00Z'),
            
        
    
        
        
            
                "joined_at": new Date('2026-02-05T11:10:00Z'),
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const RoleAssignmentsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "assigned_at": new Date('2026-02-01T12:10:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "assigned_at": new Date('2026-02-10T11:10:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "assigned_at": new Date('2026-02-05T11:15:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ApprovalWorkflowsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Sales Order Approval",
            
        
    
        
        
            
                "applies_to": "purchase_order",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "description": "Approval required for large sales orders or non-standard discounts.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Purchase Order Approval",
            
        
    
        
        
            
                "applies_to": "sales_order",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "description": "Approval required for purchases above threshold.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Vendor Bill Approval",
            
        
    
        
        
            
                "applies_to": "vendor_bill",
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "description": "AP approval before posting bills to the ledger.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ApprovalStepsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "step_order": 1,
            
        
    
        
        
            
                "approver_type": "role",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "decision_rule": "all",
            
        
    
        
        
            
                "min_approvals": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "step_order": 2,
            
        
    
        
        
            
                "approver_type": "role",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "decision_rule": "all",
            
        
    
        
        
            
                "min_approvals": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "step_order": 1,
            
        
    
        
        
            
                "approver_type": "role",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "decision_rule": "any",
            
        
    
        
        
            
                "min_approvals": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ApprovalRequestsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "object_type": "sales_order",
            
        
    
        
        
            
                "object_ref": "SO-10021",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "pending",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "requested_at": new Date('2026-03-20T10:05:00Z'),
            
        
    
        
        
            
                "resolved_at": new Date('2026-03-21T15:30:00Z'),
            
        
    
        
        
            
                "reason": "Discount exceeds standard policy",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "object_type": "purchase_order",
            
        
    
        
        
            
                "object_ref": "PO-90012",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "approved",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "requested_at": new Date('2026-03-18T09:00:00Z'),
            
        
    
        
        
            
                "resolved_at": new Date('2026-03-18T11:15:00Z'),
            
        
    
        
        
            
                "reason": "Restocking critical items",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "object_type": "vendor_bill",
            
        
    
        
        
            
                "object_ref": "BILL-3308",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "approved",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "requested_at": new Date('2026-03-22T13:20:00Z'),
            
        
    
        
        
            
                "resolved_at": new Date('2026-03-22T14:10:00Z'),
            
        
    
        
        
            
                "reason": "Monthly supplier invoice",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ApprovalDecisionsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "decision": "approved",
            
        
    
        
        
            
                "decided_at": new Date('2026-03-21T10:00:00Z'),
            
        
    
        
        
            
                "comment": "Commercial justification provided and margin acceptable.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "decision": "approved",
            
        
    
        
        
            
                "decided_at": new Date('2026-03-21T15:30:00Z'),
            
        
    
        
        
            
                "comment": "Approved with documentation attached.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "decision": "approved",
            
        
    
        
        
            
                "decided_at": new Date('2026-03-18T11:15:00Z'),
            
        
    
        
        
            
                "comment": "Approved due to stockout risk.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const CompaniesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "legal_name": "Acme Operations LLC",
            
        
    
        
        
            
                "trade_name": "Acme Ops",
            
        
    
        
        
            
                "tax_id": "US-98-7654321",
            
        
    
        
        
            
                "address_line1": "1200 Market Street",
            
        
    
        
        
            
                "address_line2": "Suite 400",
            
        
    
        
        
            
                "city": "Philadelphia",
            
        
    
        
        
            
                "region": "PA",
            
        
    
        
        
            
                "postal_code": "19107",
            
        
    
        
        
            
                "country": "US",
            
        
    
        
        
            
                "phone": "+1-215-555-0198",
            
        
    
        
        
            
                "website": "https://acme-ops.example",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "legal_name": "Northwind Traders Inc",
            
        
    
        
        
            
                "trade_name": "Northwind",
            
        
    
        
        
            
                "tax_id": "US-12-3456789",
            
        
    
        
        
            
                "address_line1": "500 Pine Street",
            
        
    
        
        
            
                "address_line2": "Floor 12",
            
        
    
        
        
            
                "city": "San Francisco",
            
        
    
        
        
            
                "region": "CA",
            
        
    
        
        
            
                "postal_code": "94104",
            
        
    
        
        
            
                "country": "US",
            
        
    
        
        
            
                "phone": "+1-415-555-0110",
            
        
    
        
        
            
                "website": "https://northwind.example",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "legal_name": "Globex Manufacturing Ltd",
            
        
    
        
        
            
                "trade_name": "Globex Mfg",
            
        
    
        
        
            
                "tax_id": "GB-123456789",
            
        
    
        
        
            
                "address_line1": "8 King Street",
            
        
    
        
        
            
                "address_line2": "Unit 3",
            
        
    
        
        
            
                "city": "London",
            
        
    
        
        
            
                "region": "London",
            
        
    
        
        
            
                "postal_code": "EC2V 6AA",
            
        
    
        
        
            
                "country": "GB",
            
        
    
        
        
            
                "phone": "+44-20-7946-0123",
            
        
    
        
        
            
                "website": "https://globex.example",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const CustomersData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "customer_code": "CUST-1001",
            
        
    
        
        
            
                "name": "Blue Ridge Retail",
            
        
    
        
        
            
                "email": "ap@blueridgeretail.example",
            
        
    
        
        
            
                "phone": "+1-704-555-0182",
            
        
    
        
        
            
                "billing_address": "88 Union Avenue, Charlotte, NC 28202, US",
            
        
    
        
        
            
                "shipping_address": "115 Warehouse Rd, Charlotte, NC 28208, US",
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "status": "on_hold",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "customer_code": "CUST-1002",
            
        
    
        
        
            
                "name": "Summit Outfitters",
            
        
    
        
        
            
                "email": "finance@summitoutfitters.example",
            
        
    
        
        
            
                "phone": "+1-303-555-0133",
            
        
    
        
        
            
                "billing_address": "14 Canyon Blvd, Denver, CO 80202, US",
            
        
    
        
        
            
                "shipping_address": "14 Canyon Blvd, Denver, CO 80202, US",
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "status": "inactive",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "customer_code": "CUST-2001",
            
        
    
        
        
            
                "name": "Harbor Foods",
            
        
    
        
        
            
                "email": "billing@harborfoods.example",
            
        
    
        
        
            
                "phone": "+1-206-555-0177",
            
        
    
        
        
            
                "billing_address": "9 Elliott Ave, Seattle, WA 98101, US",
            
        
    
        
        
            
                "shipping_address": "250 Pier St, Seattle, WA 98121, US",
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "status": "inactive",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const SuppliersData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "supplier_code": "SUP-5001",
            
        
    
        
        
            
                "name": "Allied Components",
            
        
    
        
        
            
                "email": "ar@alliedcomponents.example",
            
        
    
        
        
            
                "phone": "+1-973-555-0121",
            
        
    
        
        
            
                "address": "250 Industrial Way, Newark, NJ 07102, US",
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "status": "on_hold",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "supplier_code": "SUP-5002",
            
        
    
        
        
            
                "name": "Prime Packaging Co",
            
        
    
        
        
            
                "email": "billing@primepackaging.example",
            
        
    
        
        
            
                "phone": "+1-412-555-0166",
            
        
    
        
        
            
                "address": "19 Steel Ave, Pittsburgh, PA 15222, US",
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "supplier_code": "SUP-6001",
            
        
    
        
        
            
                "name": "Pacific Wholesale",
            
        
    
        
        
            
                "email": "billing@pacificwholesale.example",
            
        
    
        
        
            
                "phone": "+1-503-555-0108",
            
        
    
        
        
            
                "address": "700 River Rd, Portland, OR 97205, US",
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const UomsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Each",
            
        
    
        
        
            
                "symbol": "ea",
            
        
    
        
        
            
                "base_factor": 1,
            
        
    
        
        
            
                "is_base": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Case of 12",
            
        
    
        
        
            
                "symbol": "cs12",
            
        
    
        
        
            
                "base_factor": 12,
            
        
    
        
        
            
                "is_base": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Kilogram",
            
        
    
        
        
            
                "symbol": "kg",
            
        
    
        
        
            
                "base_factor": 1,
            
        
    
        
        
            
                "is_base": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ItemCategoriesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Electronics",
            
        
    
        
        
            
                "description": "Small electronics and accessories.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Packaging",
            
        
    
        
        
            
                "description": "Boxes, labels, and packing materials.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Food Products",
            
        
    
        
        
            
                "description": "Shelf-stable food items.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ItemsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sku": "SKU-AX100",
            
        
    
        
        
            
                "name": "Rugged Barcode Scanner",
            
        
    
        
        
            
                "description": "Handheld scanner suitable for warehouse operations.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "item_type": "non_stock",
            
        
    
        
        
            
                "tracking_mode": "none",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "sales_price": 249.99,
            
        
    
        
        
            
                "purchase_cost": 165,
            
        
    
        
        
            
                "reorder_point": 10,
            
        
    
        
        
            
                "reorder_qty": 25,
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sku": "SKU-LB200",
            
        
    
        
        
            
                "name": "Thermal Shipping Label Roll",
            
        
    
        
        
            
                "description": "Direct thermal labels for shipping printers.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "item_type": "stock",
            
        
    
        
        
            
                "tracking_mode": "lot",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "sales_price": 72,
            
        
    
        
        
            
                "purchase_cost": 38,
            
        
    
        
        
            
                "reorder_point": 5,
            
        
    
        
        
            
                "reorder_qty": 10,
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sku": "SKU-NW310",
            
        
    
        
        
            
                "name": "Premium Olive Oil 1L",
            
        
    
        
        
            
                "description": "Extra virgin olive oil, 1 liter bottle.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "item_type": "service",
            
        
    
        
        
            
                "tracking_mode": "lot",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "sales_price": 18.5,
            
        
    
        
        
            
                "purchase_cost": 11.2,
            
        
    
        
        
            
                "reorder_point": 50,
            
        
    
        
        
            
                "reorder_qty": 200,
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const WarehousesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Philadelphia DC",
            
        
    
        
        
            
                "code": "PHL-DC",
            
        
    
        
        
            
                "address": "220 Logistics Pkwy, Philadelphia, PA 19153, US",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Newark Crossdock",
            
        
    
        
        
            
                "code": "EWR-XD",
            
        
    
        
        
            
                "address": "90 Freight Ln, Newark, NJ 07114, US",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "West Coast Warehouse",
            
        
    
        
        
            
                "code": "WC-WH",
            
        
    
        
        
            
                "address": "140 Harbor Way, Oakland, CA 94607, US",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const LocationsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "PHL Receiving",
            
        
    
        
        
            
                "code": "PHL-REC",
            
        
    
        
        
            
                "location_type": "scrap",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "PHL Stock A1",
            
        
    
        
        
            
                "code": "PHL-A1",
            
        
    
        
        
            
                "location_type": "staging",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "PHL Shipping",
            
        
    
        
        
            
                "code": "PHL-SHP",
            
        
    
        
        
            
                "location_type": "stock",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const LotsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lot_number": "LOT-LB200-2026-01",
            
        
    
        
        
            
                "manufactured_at": new Date('2026-01-05T00:00:00Z'),
            
        
    
        
        
            
                "expires_at": new Date('2028-01-05T00:00:00Z'),
            
        
    
        
        
            
                "status": "expired",
            
        
    
        
        
            
                "notes": "Stored in climate controlled area.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lot_number": "LOT-NW310-2026-02A",
            
        
    
        
        
            
                "manufactured_at": new Date('2026-02-10T00:00:00Z'),
            
        
    
        
        
            
                "expires_at": new Date('2027-08-10T00:00:00Z'),
            
        
    
        
        
            
                "status": "consumed",
            
        
    
        
        
            
                "notes": "Batch from Spain supplier shipment.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lot_number": "LOT-NW310-2026-02B",
            
        
    
        
        
            
                "manufactured_at": new Date('2026-02-18T00:00:00Z'),
            
        
    
        
        
            
                "expires_at": new Date('2027-08-18T00:00:00Z'),
            
        
    
        
        
            
                "status": "consumed",
            
        
    
        
        
            
                "notes": "Secondary batch for West Coast distribution.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const SerialNumbersData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "serial_number": "SN-AX100-000981",
            
        
    
        
        
            
                "status": "returned",
            
        
    
        
        
            
                "received_at": new Date('2026-03-10T10:00:00Z'),
            
        
    
        
        
            
                "sold_at": new Date('2026-03-25T15:00:00Z'),
            
        
    
        
        
            
                "notes": "Assigned to Sales Order SO-10021.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "serial_number": "SN-AX100-000982",
            
        
    
        
        
            
                "status": "in_stock",
            
        
    
        
        
            
                "received_at": new Date('2026-03-10T10:00:00Z'),
            
        
    
        
        
            
                "sold_at": new Date('2026-03-26T15:00:00Z'),
            
        
    
        
        
            
                "notes": "Quality check completed.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "serial_number": "SN-AX100-000983",
            
        
    
        
        
            
                "status": "allocated",
            
        
    
        
        
            
                "received_at": new Date('2026-03-10T10:00:00Z'),
            
        
    
        
        
            
                "sold_at": new Date('2026-03-29T15:00:00Z'),
            
        
    
        
        
            
                "notes": "Allocated to pick list.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const InventoryTransfersData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "transfer_number": "TR-7001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "approved",
            
        
    
        
        
            
                "requested_at": new Date('2026-03-19T09:00:00Z'),
            
        
    
        
        
            
                "shipped_at": new Date('2026-03-19T14:00:00Z'),
            
        
    
        
        
            
                "received_at": new Date('2026-03-19T16:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Move items to shipping for SO-10021.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "transfer_number": "TR-7002",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                "requested_at": new Date('2026-03-21T10:00:00Z'),
            
        
    
        
        
            
                "shipped_at": new Date('2026-03-21T12:00:00Z'),
            
        
    
        
        
            
                "received_at": new Date('2026-03-21T13:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Internal bin adjustment transfer.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "transfer_number": "TR-7003",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "approved",
            
        
    
        
        
            
                "requested_at": new Date('2026-03-10T10:05:00Z'),
            
        
    
        
        
            
                "shipped_at": new Date('2026-03-10T10:30:00Z'),
            
        
    
        
        
            
                "received_at": new Date('2026-03-10T11:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Putaway after receipt posting.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const InventoryTransferLinesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "memo": "Scanner for order fulfillment.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "memo": "Labels for packing station.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 10,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "memo": "Bin consolidation.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const StockMovementsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "movement_at": new Date('2026-03-10T11:05:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 2,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "source_type": "receipt",
            
        
    
        
        
            
                "source_ref": "RCPT-21001",
            
        
    
        
        
            
                "notes": "Putaway posted.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "movement_at": new Date('2026-03-19T14:10:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "source_type": "transfer",
            
        
    
        
        
            
                "source_ref": "TR-7001",
            
        
    
        
        
            
                "notes": "Pick to shipping.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "movement_at": new Date('2026-03-15T09:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": -5,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "source_type": "sales_order",
            
        
    
        
        
            
                "source_ref": "SO-20011",
            
        
    
        
        
            
                "notes": "Shipment posted.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const QuotationsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quote_number": "QT-50001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "expired",
            
        
    
        
        
            
                "issued_at": new Date('2026-03-05T10:00:00Z'),
            
        
    
        
        
            
                "valid_until": new Date('2026-04-04T23:59:00Z'),
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "subtotal": 500,
            
        
    
        
        
            
                "tax_total": 40,
            
        
    
        
        
            
                "total": 540,
            
        
    
        
        
            
                "notes": "Quote for warehouse scanning equipment.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quote_number": "QT-50002",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "accepted",
            
        
    
        
        
            
                "issued_at": new Date('2026-03-08T10:00:00Z'),
            
        
    
        
        
            
                "valid_until": new Date('2026-04-07T23:59:00Z'),
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "subtotal": 249.99,
            
        
    
        
        
            
                "tax_total": 20,
            
        
    
        
        
            
                "total": 269.99,
            
        
    
        
        
            
                "notes": "Accepted, proceed to sales order.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quote_number": "QT-60001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "issued_at": new Date('2026-03-12T10:00:00Z'),
            
        
    
        
        
            
                "valid_until": new Date('2026-03-30T23:59:00Z'),
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "subtotal": 925,
            
        
    
        
        
            
                "tax_total": 0,
            
        
    
        
        
            
                "total": 925,
            
        
    
        
        
            
                "notes": "Bulk pricing for olive oil.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const QuotationLinesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Rugged Barcode Scanner",
            
        
    
        
        
            
                "quantity": 2,
            
        
    
        
        
            
                "unit_price": 249.99,
            
        
    
        
        
            
                "discount_amount": 0,
            
        
    
        
        
            
                "tax_amount": 40,
            
        
    
        
        
            
                "line_total": 539.98,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Thermal Shipping Label Roll",
            
        
    
        
        
            
                "quantity": 1,
            
        
    
        
        
            
                "unit_price": 72,
            
        
    
        
        
            
                "discount_amount": 10,
            
        
    
        
        
            
                "tax_amount": 0,
            
        
    
        
        
            
                "line_total": 62,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Rugged Barcode Scanner",
            
        
    
        
        
            
                "quantity": 1,
            
        
    
        
        
            
                "unit_price": 249.99,
            
        
    
        
        
            
                "discount_amount": 0,
            
        
    
        
        
            
                "tax_amount": 20,
            
        
    
        
        
            
                "line_total": 269.99,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const SalesOrdersData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "order_number": "SO-10021",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                "order_date": new Date('2026-03-06T00:00:00Z'),
            
        
    
        
        
            
                "requested_ship_date": new Date('2026-03-20T00:00:00Z'),
            
        
    
        
        
            
                "shipped_at": new Date('2026-03-21T18:00:00Z'),
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "subtotal": 500,
            
        
    
        
        
            
                "tax_total": 40,
            
        
    
        
        
            
                "total": 540,
            
        
    
        
        
            
                "shipping_address": "115 Warehouse Rd, Charlotte, NC 28208, US",
            
        
    
        
        
            
                "notes": "Requires approval due to discount exception.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "order_number": "SO-10022",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "shipped",
            
        
    
        
        
            
                "order_date": new Date('2026-03-09T00:00:00Z'),
            
        
    
        
        
            
                "requested_ship_date": new Date('2026-03-22T00:00:00Z'),
            
        
    
        
        
            
                "shipped_at": new Date('2026-03-22T18:00:00Z'),
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "subtotal": 249.99,
            
        
    
        
        
            
                "tax_total": 20,
            
        
    
        
        
            
                "total": 269.99,
            
        
    
        
        
            
                "shipping_address": "14 Canyon Blvd, Denver, CO 80202, US",
            
        
    
        
        
            
                "notes": "Standard shipment.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "order_number": "SO-20011",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "picked",
            
        
    
        
        
            
                "order_date": new Date('2026-03-13T00:00:00Z'),
            
        
    
        
        
            
                "requested_ship_date": new Date('2026-03-18T00:00:00Z'),
            
        
    
        
        
            
                "shipped_at": new Date('2026-03-15T00:00:00Z'),
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "subtotal": 925,
            
        
    
        
        
            
                "tax_total": 0,
            
        
    
        
        
            
                "total": 925,
            
        
    
        
        
            
                "shipping_address": "250 Pier St, Seattle, WA 98121, US",
            
        
    
        
        
            
                "notes": "Ship refrigerated pallet wrap.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const SalesOrderLinesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Rugged Barcode Scanner",
            
        
    
        
        
            
                "quantity": 2,
            
        
    
        
        
            
                "unit_price": 249.99,
            
        
    
        
        
            
                "discount_amount": 0,
            
        
    
        
        
            
                "tax_amount": 40,
            
        
    
        
        
            
                "line_total": 539.98,
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Rugged Barcode Scanner",
            
        
    
        
        
            
                "quantity": 1,
            
        
    
        
        
            
                "unit_price": 249.99,
            
        
    
        
        
            
                "discount_amount": 0,
            
        
    
        
        
            
                "tax_amount": 20,
            
        
    
        
        
            
                "line_total": 269.99,
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Premium Olive Oil 1L",
            
        
    
        
        
            
                "quantity": 50,
            
        
    
        
        
            
                "unit_price": 18.5,
            
        
    
        
        
            
                "discount_amount": 0,
            
        
    
        
        
            
                "tax_amount": 0,
            
        
    
        
        
            
                "line_total": 925,
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const SalesAllocationsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const InvoicesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "invoice_number": "INV-44009",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "issued",
            
        
    
        
        
            
                "issued_at": new Date('2026-03-22T10:00:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2026-04-21T23:59:00Z'),
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "subtotal": 500,
            
        
    
        
        
            
                "tax_total": 40,
            
        
    
        
        
            
                "total": 540,
            
        
    
        
        
            
                "balance_due": 540,
            
        
    
        
        
            
                "notes": "Net 30 terms.",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "invoice_number": "INV-44010",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "issued",
            
        
    
        
        
            
                "issued_at": new Date('2026-03-23T10:00:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2026-04-22T23:59:00Z'),
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "subtotal": 249.99,
            
        
    
        
        
            
                "tax_total": 20,
            
        
    
        
        
            
                "total": 269.99,
            
        
    
        
        
            
                "balance_due": 0,
            
        
    
        
        
            
                "notes": "Paid via ACH.",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "invoice_number": "INV-55001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "void",
            
        
    
        
        
            
                "issued_at": new Date('2026-03-16T10:00:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2026-04-15T23:59:00Z'),
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "subtotal": 925,
            
        
    
        
        
            
                "tax_total": 0,
            
        
    
        
        
            
                "total": 925,
            
        
    
        
        
            
                "balance_due": 300,
            
        
    
        
        
            
                "notes": "Partial payment received.",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const InvoiceLinesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Rugged Barcode Scanner",
            
        
    
        
        
            
                "quantity": 2,
            
        
    
        
        
            
                "unit_price": 249.99,
            
        
    
        
        
            
                "discount_amount": 0,
            
        
    
        
        
            
                "tax_amount": 40,
            
        
    
        
        
            
                "line_total": 539.98,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Rugged Barcode Scanner",
            
        
    
        
        
            
                "quantity": 1,
            
        
    
        
        
            
                "unit_price": 249.99,
            
        
    
        
        
            
                "discount_amount": 0,
            
        
    
        
        
            
                "tax_amount": 20,
            
        
    
        
        
            
                "line_total": 269.99,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Premium Olive Oil 1L",
            
        
    
        
        
            
                "quantity": 50,
            
        
    
        
        
            
                "unit_price": 18.5,
            
        
    
        
        
            
                "discount_amount": 0,
            
        
    
        
        
            
                "tax_amount": 0,
            
        
    
        
        
            
                "line_total": 925,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const CustomerReturnsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "return_number": "RTN-30001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "approved",
            
        
    
        
        
            
                "requested_at": new Date('2026-03-28T10:00:00Z'),
            
        
    
        
        
            
                "received_at": new Date('2026-03-30T13:00:00Z'),
            
        
    
        
        
            
                "reason": "One unit arrived with damaged screen.",
            
        
    
        
        
            
                "refund_total": 249.99,
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "return_number": "RTN-30002",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "pending_approval",
            
        
    
        
        
            
                "requested_at": new Date('2026-03-29T10:00:00Z'),
            
        
    
        
        
            
                "received_at": new Date('2026-04-01T13:00:00Z'),
            
        
    
        
        
            
                "reason": "Customer changed requirements.",
            
        
    
        
        
            
                "refund_total": 249.99,
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "return_number": "RTN-40001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "refunded",
            
        
    
        
        
            
                "requested_at": new Date('2026-03-20T10:00:00Z'),
            
        
    
        
        
            
                "received_at": new Date('2026-03-22T13:00:00Z'),
            
        
    
        
        
            
                "reason": "Packaging damaged on arrival.",
            
        
    
        
        
            
                "refund_total": 185,
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const CustomerReturnLinesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 1,
            
        
    
        
        
            
                "refund_amount": 249.99,
            
        
    
        
        
            
                "condition_notes": "Screen cracked on arrival.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 1,
            
        
    
        
        
            
                "refund_amount": 249.99,
            
        
    
        
        
            
                "condition_notes": "Unopened box, resealable.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 10,
            
        
    
        
        
            
                "refund_amount": 185,
            
        
    
        
        
            
                "condition_notes": "Carton damaged, units intact.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const PurchaseOrdersData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "po_number": "PO-90012",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "approved",
            
        
    
        
        
            
                "order_date": new Date('2026-03-01T00:00:00Z'),
            
        
    
        
        
            
                "expected_at": new Date('2026-03-10T00:00:00Z'),
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "subtotal": 3300,
            
        
    
        
        
            
                "tax_total": 0,
            
        
    
        
        
            
                "total": 3300,
            
        
    
        
        
            
                "ship_to_address": "220 Logistics Pkwy, Philadelphia, PA 19153, US",
            
        
    
        
        
            
                "notes": "Expedite if possible.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "po_number": "PO-90013",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "approved",
            
        
    
        
        
            
                "order_date": new Date('2026-03-05T00:00:00Z'),
            
        
    
        
        
            
                "expected_at": new Date('2026-03-12T00:00:00Z'),
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "subtotal": 760,
            
        
    
        
        
            
                "tax_total": 0,
            
        
    
        
        
            
                "total": 760,
            
        
    
        
        
            
                "ship_to_address": "220 Logistics Pkwy, Philadelphia, PA 19153, US",
            
        
    
        
        
            
                "notes": "Include packing slip with lot details.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "po_number": "PO-91001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "order_date": new Date('2026-03-07T00:00:00Z'),
            
        
    
        
        
            
                "expected_at": new Date('2026-03-15T00:00:00Z'),
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "subtotal": 2240,
            
        
    
        
        
            
                "tax_total": 0,
            
        
    
        
        
            
                "total": 2240,
            
        
    
        
        
            
                "ship_to_address": "140 Harbor Way, Oakland, CA 94607, US",
            
        
    
        
        
            
                "notes": "Deliver to dock 2.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const PurchaseOrderLinesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Rugged Barcode Scanner",
            
        
    
        
        
            
                "quantity": 20,
            
        
    
        
        
            
                "unit_cost": 165,
            
        
    
        
        
            
                "tax_amount": 0,
            
        
    
        
        
            
                "line_total": 3300,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Thermal Shipping Label Roll",
            
        
    
        
        
            
                "quantity": 20,
            
        
    
        
        
            
                "unit_cost": 38,
            
        
    
        
        
            
                "tax_amount": 0,
            
        
    
        
        
            
                "line_total": 760,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Premium Olive Oil 1L",
            
        
    
        
        
            
                "quantity": 200,
            
        
    
        
        
            
                "unit_cost": 11.2,
            
        
    
        
        
            
                "tax_amount": 0,
            
        
    
        
        
            
                "line_total": 2240,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ReceiptsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "receipt_number": "RCPT-21001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                "received_at": new Date('2026-03-10T10:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "All cartons intact.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "receipt_number": "RCPT-21002",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "posted",
            
        
    
        
        
            
                "received_at": new Date('2026-03-12T09:30:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Lot recorded on inbound docs.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "receipt_number": "RCPT-22001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "received_at": new Date('2026-03-15T11:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Partial delivery, backorder expected.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ReceiptLinesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 20,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "unit_cost": 165,
            
        
    
        
        
            
                "memo": "Serials captured during receiving.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 20,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "unit_cost": 38,
            
        
    
        
        
            
                "memo": "Lot applied to inbound shipment.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 100,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "unit_cost": 11.2,
            
        
    
        
        
            
                "memo": "First partial delivery.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const VendorBillsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "bill_number": "BILL-3308",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "pending_approval",
            
        
    
        
        
            
                "bill_date": new Date('2026-03-11T00:00:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2026-04-10T23:59:00Z'),
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "subtotal": 3300,
            
        
    
        
        
            
                "tax_total": 0,
            
        
    
        
        
            
                "total": 3300,
            
        
    
        
        
            
                "balance_due": 3300,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "notes": "Matched to receipt RCPT-21001.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "bill_number": "BILL-3309",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "paid",
            
        
    
        
        
            
                "bill_date": new Date('2026-03-13T00:00:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2026-04-12T23:59:00Z'),
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "subtotal": 760,
            
        
    
        
        
            
                "tax_total": 0,
            
        
    
        
        
            
                "total": 760,
            
        
    
        
        
            
                "balance_due": 760,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "notes": "Awaiting posting.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "bill_number": "BILL-4401",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "posted",
            
        
    
        
        
            
                "bill_date": new Date('2026-03-16T00:00:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2026-04-15T23:59:00Z'),
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "subtotal": 2240,
            
        
    
        
        
            
                "tax_total": 0,
            
        
    
        
        
            
                "total": 2240,
            
        
    
        
        
            
                "balance_due": 2240,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "notes": "Draft pending full receipt.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const VendorBillLinesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Rugged Barcode Scanner",
            
        
    
        
        
            
                "quantity": 20,
            
        
    
        
        
            
                "unit_cost": 165,
            
        
    
        
        
            
                "tax_amount": 0,
            
        
    
        
        
            
                "line_total": 3300,
            
        
    
        
        
            
                "expense_account_code": "1200",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Thermal Shipping Label Roll",
            
        
    
        
        
            
                "quantity": 20,
            
        
    
        
        
            
                "unit_cost": 38,
            
        
    
        
        
            
                "tax_amount": 0,
            
        
    
        
        
            
                "line_total": 760,
            
        
    
        
        
            
                "expense_account_code": "5000",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Premium Olive Oil 1L",
            
        
    
        
        
            
                "quantity": 200,
            
        
    
        
        
            
                "unit_cost": 11.2,
            
        
    
        
        
            
                "tax_amount": 0,
            
        
    
        
        
            
                "line_total": 2240,
            
        
    
        
        
            
                "expense_account_code": "1200",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ChartOfAccountsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "account_code": "1000",
            
        
    
        
        
            
                "name": "Cash",
            
        
    
        
        
            
                "account_type": "equity",
            
        
    
        
        
            
                "normal_balance": "debit",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "is_control_account": true,
            
        
    
        
        
            
                "description": "Operating cash account.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "account_code": "1100",
            
        
    
        
        
            
                "name": "Accounts Receivable",
            
        
    
        
        
            
                "account_type": "contra_asset",
            
        
    
        
        
            
                "normal_balance": "credit",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "is_control_account": true,
            
        
    
        
        
            
                "description": "Amounts owed by customers.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "account_code": "1200",
            
        
    
        
        
            
                "name": "Inventory",
            
        
    
        
        
            
                "account_type": "income",
            
        
    
        
        
            
                "normal_balance": "credit",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "is_control_account": true,
            
        
    
        
        
            
                "description": "Inventory on hand.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const FiscalPeriodsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "FY2026 Q1",
            
        
    
        
        
            
                "starts_at": new Date('2026-01-01T00:00:00Z'),
            
        
    
        
        
            
                "ends_at": new Date('2026-03-31T23:59:59Z'),
            
        
    
        
        
            
                "status": "closed",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "FY2026 Q2",
            
        
    
        
        
            
                "starts_at": new Date('2026-04-01T00:00:00Z'),
            
        
    
        
        
            
                "ends_at": new Date('2026-06-30T23:59:59Z'),
            
        
    
        
        
            
                "status": "closed",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "FY2026 Q1",
            
        
    
        
        
            
                "starts_at": new Date('2026-01-01T00:00:00Z'),
            
        
    
        
        
            
                "ends_at": new Date('2026-03-31T23:59:59Z'),
            
        
    
        
        
            
                "status": "closing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const JournalEntriesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "journal_number": "JE-51001",
            
        
    
        
        
            
                "entry_date": new Date('2026-03-22T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "void",
            
        
    
        
        
            
                "memo": "Invoice posting INV-44009",
            
        
    
        
        
            
                "source_type": "invoice",
            
        
    
        
        
            
                "source_ref": "INV-44009",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "posted_at": new Date('2026-03-22T10:05:00Z'),
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "journal_number": "JE-51002",
            
        
    
        
        
            
                "entry_date": new Date('2026-03-11T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "approved",
            
        
    
        
        
            
                "memo": "Vendor bill posting BILL-3308",
            
        
    
        
        
            
                "source_type": "vendor_bill",
            
        
    
        
        
            
                "source_ref": "BILL-3308",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "posted_at": new Date('2026-03-11T09:10:00Z'),
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "journal_number": "JE-52001",
            
        
    
        
        
            
                "entry_date": new Date('2026-03-16T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "memo": "Invoice posting INV-55001 pending post",
            
        
    
        
        
            
                "source_type": "invoice",
            
        
    
        
        
            
                "source_ref": "INV-55001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "posted_at": new Date('2026-03-16T10:10:00Z'),
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const JournalLinesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "debit": 540,
            
        
    
        
        
            
                "credit": 0,
            
        
    
        
        
            
                "description": "AR for invoice INV-44009",
            
        
    
        
        
            
                "reference": "INV-44009",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "debit": 0,
            
        
    
        
        
            
                "credit": 540,
            
        
    
        
        
            
                "description": "Revenue for invoice INV-44009",
            
        
    
        
        
            
                "reference": "INV-44009",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "debit": 3300,
            
        
    
        
        
            
                "credit": 0,
            
        
    
        
        
            
                "description": "Inventory increase for BILL-3308",
            
        
    
        
        
            
                "reference": "BILL-3308",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const PaymentsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "payment_number": "PMT-80001",
            
        
    
        
        
            
                "direction": "inbound",
            
        
    
        
        
            
                "counterparty_type": "customer",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "paid_at": new Date('2026-03-24T15:00:00Z'),
            
        
    
        
        
            
                "amount": 269.99,
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "method": "card",
            
        
    
        
        
            
                "reference": "ACH-103992",
            
        
    
        
        
            
                "status": "failed",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "payment_number": "PMT-80002",
            
        
    
        
        
            
                "direction": "outbound",
            
        
    
        
        
            
                "counterparty_type": "supplier",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "paid_at": new Date('2026-03-20T12:00:00Z'),
            
        
    
        
        
            
                "amount": 625,
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "method": "card",
            
        
    
        
        
            
                "reference": "WIRE-44811",
            
        
    
        
        
            
                "status": "pending",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "payment_number": "PMT-80003",
            
        
    
        
        
            
                "direction": "outbound",
            
        
    
        
        
            
                "counterparty_type": "supplier",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "paid_at": new Date('2026-03-28T10:30:00Z'),
            
        
    
        
        
            
                "amount": 1000,
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "method": "bank_transfer",
            
        
    
        
        
            
                "reference": "WIRE-22901",
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const TaxRatesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "PA Sales Tax",
            
        
    
        
        
            
                "rate": 0.06,
            
        
    
        
        
            
                "jurisdiction": "Pennsylvania",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "CO Sales Tax",
            
        
    
        
        
            
                "rate": 0.029,
            
        
    
        
        
            
                "jurisdiction": "Colorado",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "WA Sales Tax",
            
        
    
        
        
            
                "rate": 0.065,
            
        
    
        
        
            
                "jurisdiction": "Washington",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const WebhooksData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "ERP Events to Data Warehouse",
            
        
    
        
        
            
                "url": "https://hooks.acme-ops.example/erp/events",
            
        
    
        
        
            
                "status": "disabled",
            
        
    
        
        
            
                "secret": "whsec_acme_ops_01",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Slack Alerts",
            
        
    
        
        
            
                "url": "https://hooks.acme-ops.example/slack/alerts",
            
        
    
        
        
            
                "status": "disabled",
            
        
    
        
        
            
                "secret": "whsec_acme_ops_02",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Northwind BI Pipeline",
            
        
    
        
        
            
                "url": "https://hooks.northwind.example/bi/events",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "secret": "whsec_northwind_01",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const WebhookSubscriptionsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_type": "invoice.issued",
            
        
    
        
        
            
                "enabled": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_type": "purchase_order.approved",
            
        
    
        
        
            
                "enabled": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_type": "approval_request.pending",
            
        
    
        
        
            
                "enabled": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const WebhookDeliveriesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_type": "invoice.issued",
            
        
    
        
        
            
                "queued_at": new Date('2026-03-22T10:05:10Z'),
            
        
    
        
        
            
                "delivered_at": new Date('2026-03-22T10:05:12Z'),
            
        
    
        
        
            
                "status": "retrying",
            
        
    
        
        
            
                "attempts": 1,
            
        
    
        
        
            
                "http_status": 200,
            
        
    
        
        
            
                "request_body": "{invoice:INV-44009,total:540}",
            
        
    
        
        
            
                "response_body": "{ok:true}",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_type": "approval_request.pending",
            
        
    
        
        
            
                "queued_at": new Date('2026-03-20T10:05:10Z'),
            
        
    
        
        
            
                "delivered_at": new Date('2026-03-20T10:05:45Z'),
            
        
    
        
        
            
                "status": "queued",
            
        
    
        
        
            
                "attempts": 3,
            
        
    
        
        
            
                "http_status": 500,
            
        
    
        
        
            
                "request_body": "{object:SO-10021}",
            
        
    
        
        
            
                "response_body": "{error:temporary}",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_type": "stock_movement.created",
            
        
    
        
        
            
                "queued_at": new Date('2026-03-15T09:00:10Z'),
            
        
    
        
        
            
                "delivered_at": new Date('2026-03-15T09:00:11Z'),
            
        
    
        
        
            
                "status": "success",
            
        
    
        
        
            
                "attempts": 1,
            
        
    
        
        
            
                "http_status": 202,
            
        
    
        
        
            
                "request_body": "{movement:SO-20011}",
            
        
    
        
        
            
                "response_body": "{queued:true}",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const EmailNotificationsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "subject": "Approval needed for SO-10021",
            
        
    
        
        
            
                "body": "A sales order requires your approval. Reference SO-10021.",
            
        
    
        
        
            
                "status": "failed",
            
        
    
        
        
            
                "queued_at": new Date('2026-03-20T10:06:00Z'),
            
        
    
        
        
            
                "sent_at": new Date('2026-03-20T10:06:10Z'),
            
        
    
        
        
            
                "error_message": "",
            
        
    
        
        
            
                "related_type": "approval_request",
            
        
    
        
        
            
                "related_ref": "SO-10021",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "subject": "Invoice issued INV-44009",
            
        
    
        
        
            
                "body": "Invoice INV-44009 has been issued to Blue Ridge Retail.",
            
        
    
        
        
            
                "status": "sent",
            
        
    
        
        
            
                "queued_at": new Date('2026-03-22T10:06:00Z'),
            
        
    
        
        
            
                "sent_at": new Date('2026-03-22T10:06:12Z'),
            
        
    
        
        
            
                "error_message": "",
            
        
    
        
        
            
                "related_type": "invoice",
            
        
    
        
        
            
                "related_ref": "INV-44009",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "subject": "Receipt draft RCPT-22001",
            
        
    
        
        
            
                "body": "Receipt RCPT-22001 is saved as draft and awaits posting.",
            
        
    
        
        
            
                "status": "failed",
            
        
    
        
        
            
                "queued_at": new Date('2026-03-15T11:05:00Z'),
            
        
    
        
        
            
                "sent_at": new Date('2026-03-15T11:06:00Z'),
            
        
    
        
        
            
                "error_message": "",
            
        
    
        
        
            
                "related_type": "receipt",
            
        
    
        
        
            
                "related_ref": "RCPT-22001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const CsvImportJobsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "job_name": "Initial Items Import",
            
        
    
        
        
            
                "target_entity": "chart_of_accounts",
            
        
    
        
        
            
                "status": "failed",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "requested_at": new Date('2026-02-02T10:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-02-02T10:10:00Z'),
            
        
    
        
        
            
                "total_rows": 120,
            
        
    
        
        
            
                "success_rows": 118,
            
        
    
        
        
            
                "error_rows": 2,
            
        
    
        
        
            
                "error_report": "2 rows failed due to missing UOM mapping.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "job_name": "Customers Q1 Load",
            
        
    
        
        
            
                "target_entity": "purchase_orders",
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "requested_at": new Date('2026-02-03T10:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-02-03T10:08:00Z'),
            
        
    
        
        
            
                "total_rows": 45,
            
        
    
        
        
            
                "success_rows": 45,
            
        
    
        
        
            
                "error_rows": 0,
            
        
    
        
        
            
                "error_report": "",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "job_name": "COA Setup Import",
            
        
    
        
        
            
                "target_entity": "items",
            
        
    
        
        
            
                "status": "failed",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "requested_at": new Date('2026-03-01T09:30:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-03-01T10:00:00Z'),
            
        
    
        
        
            
                "total_rows": 80,
            
        
    
        
        
            
                "success_rows": 60,
            
        
    
        
        
            
                "error_rows": 0,
            
        
    
        
        
            
                "error_report": "Processing continues for remaining rows.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ReportsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Inventory On Hand Summary",
            
        
    
        
        
            
                "report_type": "ar_aging",
            
        
    
        
        
            
                "description": "Current on hand by item and location.",
            
        
    
        
        
            
                "is_favorite": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Trial Balance FY2026 Q1",
            
        
    
        
        
            
                "report_type": "sales_by_customer",
            
        
    
        
        
            
                "description": "Trial balance for the current fiscal period.",
            
        
    
        
        
            
                "is_favorite": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "AR Aging Detail",
            
        
    
        
        
            
                "report_type": "ap_aging",
            
        
    
        
        
            
                "description": "Aging report grouped by customer.",
            
        
    
        
        
            
                "is_favorite": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const DashboardsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Operations Overview",
            
        
    
        
        
            
                "visibility": "private",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Finance Close",
            
        
    
        
        
            
                "visibility": "private",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Sales Pipeline",
            
        
    
        
        
            
                "visibility": "tenant",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const DashboardWidgetsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "widget_type": "activity",
            
        
    
        
        
            
                "title": "Open Sales Orders",
            
        
    
        
        
            
                "position_x": 0,
            
        
    
        
        
            
                "position_y": 0,
            
        
    
        
        
            
                "width": 4,
            
        
    
        
        
            
                "height": 2,
            
        
    
        
        
            
                "config_json": "{status:[pending_approval,approved,confirmed]}",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "widget_type": "kpi",
            
        
    
        
        
            
                "title": "Reorder Alerts",
            
        
    
        
        
            
                "position_x": 4,
            
        
    
        
        
            
                "position_y": 0,
            
        
    
        
        
            
                "width": 8,
            
        
    
        
        
            
                "height": 4,
            
        
    
        
        
            
                "config_json": "{threshold:reorder_point}",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "widget_type": "ap_summary",
            
        
    
        
        
            
                "title": "Unposted Journal Entries",
            
        
    
        
        
            
                "position_x": 0,
            
        
    
        
        
            
                "position_y": 0,
            
        
    
        
        
            
                "width": 4,
            
        
    
        
        
            
                "height": 2,
            
        
    
        
        
            
                "config_json": "{status:[draft,approved]}",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];




    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    
        
            
            async function associateUserWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const User0 = await Users.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (User0?.setOrganization)
                {
                    await
                    User0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const User1 = await Users.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (User1?.setOrganization)
                {
                    await
                    User1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const User2 = await Users.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (User2?.setOrganization)
                {
                    await
                    User2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
    
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    
        
            
            async function associateTenantWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Tenant0 = await Tenants.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Tenant0?.setOrganization)
                {
                    await
                    Tenant0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Tenant1 = await Tenants.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Tenant1?.setOrganization)
                {
                    await
                    Tenant1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Tenant2 = await Tenants.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Tenant2?.setOrganization)
                {
                    await
                    Tenant2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateMembershipWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Membership0 = await Memberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Membership0?.setTenant)
                {
                    await
                    Membership0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Membership1 = await Memberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Membership1?.setTenant)
                {
                    await
                    Membership1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Membership2 = await Memberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Membership2?.setTenant)
                {
                    await
                    Membership2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
            
            async function associateMembershipWithUser() {
            
                const relatedUser0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Membership0 = await Memberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Membership0?.setUser)
                {
                    await
                    Membership0.
                    setUser(relatedUser0);
                }
            
                const relatedUser1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Membership1 = await Memberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Membership1?.setUser)
                {
                    await
                    Membership1.
                    setUser(relatedUser1);
                }
            
                const relatedUser2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Membership2 = await Memberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Membership2?.setUser)
                {
                    await
                    Membership2.
                    setUser(relatedUser2);
                }
            
        }
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    
        
            
            async function associateMembershipWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Membership0 = await Memberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Membership0?.setOrganization)
                {
                    await
                    Membership0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Membership1 = await Memberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Membership1?.setOrganization)
                {
                    await
                    Membership1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Membership2 = await Memberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Membership2?.setOrganization)
                {
                    await
                    Membership2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateRoleAssignmentWithMembership() {
            
                const relatedMembership0 = await Memberships.findOne({
                    offset: Math.floor(Math.random() * (await Memberships.count())),
                });
                const RoleAssignment0 = await RoleAssignments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RoleAssignment0?.setMembership)
                {
                    await
                    RoleAssignment0.
                    setMembership(relatedMembership0);
                }
            
                const relatedMembership1 = await Memberships.findOne({
                    offset: Math.floor(Math.random() * (await Memberships.count())),
                });
                const RoleAssignment1 = await RoleAssignments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RoleAssignment1?.setMembership)
                {
                    await
                    RoleAssignment1.
                    setMembership(relatedMembership1);
                }
            
                const relatedMembership2 = await Memberships.findOne({
                    offset: Math.floor(Math.random() * (await Memberships.count())),
                });
                const RoleAssignment2 = await RoleAssignments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RoleAssignment2?.setMembership)
                {
                    await
                    RoleAssignment2.
                    setMembership(relatedMembership2);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateRoleAssignmentWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RoleAssignment0 = await RoleAssignments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RoleAssignment0?.setOrganization)
                {
                    await
                    RoleAssignment0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RoleAssignment1 = await RoleAssignments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RoleAssignment1?.setOrganization)
                {
                    await
                    RoleAssignment1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RoleAssignment2 = await RoleAssignments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RoleAssignment2?.setOrganization)
                {
                    await
                    RoleAssignment2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateApprovalWorkflowWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const ApprovalWorkflow0 = await ApprovalWorkflows.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ApprovalWorkflow0?.setTenant)
                {
                    await
                    ApprovalWorkflow0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const ApprovalWorkflow1 = await ApprovalWorkflows.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ApprovalWorkflow1?.setTenant)
                {
                    await
                    ApprovalWorkflow1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const ApprovalWorkflow2 = await ApprovalWorkflows.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ApprovalWorkflow2?.setTenant)
                {
                    await
                    ApprovalWorkflow2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    
        
            
            async function associateApprovalWorkflowWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ApprovalWorkflow0 = await ApprovalWorkflows.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ApprovalWorkflow0?.setOrganization)
                {
                    await
                    ApprovalWorkflow0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ApprovalWorkflow1 = await ApprovalWorkflows.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ApprovalWorkflow1?.setOrganization)
                {
                    await
                    ApprovalWorkflow1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ApprovalWorkflow2 = await ApprovalWorkflows.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ApprovalWorkflow2?.setOrganization)
                {
                    await
                    ApprovalWorkflow2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateApprovalStepWithWorkflow() {
            
                const relatedWorkflow0 = await ApprovalWorkflows.findOne({
                    offset: Math.floor(Math.random() * (await ApprovalWorkflows.count())),
                });
                const ApprovalStep0 = await ApprovalSteps.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ApprovalStep0?.setWorkflow)
                {
                    await
                    ApprovalStep0.
                    setWorkflow(relatedWorkflow0);
                }
            
                const relatedWorkflow1 = await ApprovalWorkflows.findOne({
                    offset: Math.floor(Math.random() * (await ApprovalWorkflows.count())),
                });
                const ApprovalStep1 = await ApprovalSteps.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ApprovalStep1?.setWorkflow)
                {
                    await
                    ApprovalStep1.
                    setWorkflow(relatedWorkflow1);
                }
            
                const relatedWorkflow2 = await ApprovalWorkflows.findOne({
                    offset: Math.floor(Math.random() * (await ApprovalWorkflows.count())),
                });
                const ApprovalStep2 = await ApprovalSteps.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ApprovalStep2?.setWorkflow)
                {
                    await
                    ApprovalStep2.
                    setWorkflow(relatedWorkflow2);
                }
            
        }
        
    
        
    
        
    
        
    
        
            
            async function associateApprovalStepWithApprover_user() {
            
                const relatedApprover_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ApprovalStep0 = await ApprovalSteps.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ApprovalStep0?.setApprover_user)
                {
                    await
                    ApprovalStep0.
                    setApprover_user(relatedApprover_user0);
                }
            
                const relatedApprover_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ApprovalStep1 = await ApprovalSteps.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ApprovalStep1?.setApprover_user)
                {
                    await
                    ApprovalStep1.
                    setApprover_user(relatedApprover_user1);
                }
            
                const relatedApprover_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ApprovalStep2 = await ApprovalSteps.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ApprovalStep2?.setApprover_user)
                {
                    await
                    ApprovalStep2.
                    setApprover_user(relatedApprover_user2);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateApprovalStepWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ApprovalStep0 = await ApprovalSteps.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ApprovalStep0?.setOrganization)
                {
                    await
                    ApprovalStep0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ApprovalStep1 = await ApprovalSteps.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ApprovalStep1?.setOrganization)
                {
                    await
                    ApprovalStep1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ApprovalStep2 = await ApprovalSteps.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ApprovalStep2?.setOrganization)
                {
                    await
                    ApprovalStep2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateApprovalRequestWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const ApprovalRequest0 = await ApprovalRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ApprovalRequest0?.setTenant)
                {
                    await
                    ApprovalRequest0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const ApprovalRequest1 = await ApprovalRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ApprovalRequest1?.setTenant)
                {
                    await
                    ApprovalRequest1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const ApprovalRequest2 = await ApprovalRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ApprovalRequest2?.setTenant)
                {
                    await
                    ApprovalRequest2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateApprovalRequestWithWorkflow() {
            
                const relatedWorkflow0 = await ApprovalWorkflows.findOne({
                    offset: Math.floor(Math.random() * (await ApprovalWorkflows.count())),
                });
                const ApprovalRequest0 = await ApprovalRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ApprovalRequest0?.setWorkflow)
                {
                    await
                    ApprovalRequest0.
                    setWorkflow(relatedWorkflow0);
                }
            
                const relatedWorkflow1 = await ApprovalWorkflows.findOne({
                    offset: Math.floor(Math.random() * (await ApprovalWorkflows.count())),
                });
                const ApprovalRequest1 = await ApprovalRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ApprovalRequest1?.setWorkflow)
                {
                    await
                    ApprovalRequest1.
                    setWorkflow(relatedWorkflow1);
                }
            
                const relatedWorkflow2 = await ApprovalWorkflows.findOne({
                    offset: Math.floor(Math.random() * (await ApprovalWorkflows.count())),
                });
                const ApprovalRequest2 = await ApprovalRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ApprovalRequest2?.setWorkflow)
                {
                    await
                    ApprovalRequest2.
                    setWorkflow(relatedWorkflow2);
                }
            
        }
        
    
        
    
        
            
            async function associateApprovalRequestWithRequested_by() {
            
                const relatedRequested_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ApprovalRequest0 = await ApprovalRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ApprovalRequest0?.setRequested_by)
                {
                    await
                    ApprovalRequest0.
                    setRequested_by(relatedRequested_by0);
                }
            
                const relatedRequested_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ApprovalRequest1 = await ApprovalRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ApprovalRequest1?.setRequested_by)
                {
                    await
                    ApprovalRequest1.
                    setRequested_by(relatedRequested_by1);
                }
            
                const relatedRequested_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ApprovalRequest2 = await ApprovalRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ApprovalRequest2?.setRequested_by)
                {
                    await
                    ApprovalRequest2.
                    setRequested_by(relatedRequested_by2);
                }
            
        }
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    
        
            
            async function associateApprovalRequestWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ApprovalRequest0 = await ApprovalRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ApprovalRequest0?.setOrganization)
                {
                    await
                    ApprovalRequest0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ApprovalRequest1 = await ApprovalRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ApprovalRequest1?.setOrganization)
                {
                    await
                    ApprovalRequest1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ApprovalRequest2 = await ApprovalRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ApprovalRequest2?.setOrganization)
                {
                    await
                    ApprovalRequest2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateApprovalDecisionWithRequest() {
            
                const relatedRequest0 = await ApprovalRequests.findOne({
                    offset: Math.floor(Math.random() * (await ApprovalRequests.count())),
                });
                const ApprovalDecision0 = await ApprovalDecisions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ApprovalDecision0?.setRequest)
                {
                    await
                    ApprovalDecision0.
                    setRequest(relatedRequest0);
                }
            
                const relatedRequest1 = await ApprovalRequests.findOne({
                    offset: Math.floor(Math.random() * (await ApprovalRequests.count())),
                });
                const ApprovalDecision1 = await ApprovalDecisions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ApprovalDecision1?.setRequest)
                {
                    await
                    ApprovalDecision1.
                    setRequest(relatedRequest1);
                }
            
                const relatedRequest2 = await ApprovalRequests.findOne({
                    offset: Math.floor(Math.random() * (await ApprovalRequests.count())),
                });
                const ApprovalDecision2 = await ApprovalDecisions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ApprovalDecision2?.setRequest)
                {
                    await
                    ApprovalDecision2.
                    setRequest(relatedRequest2);
                }
            
        }
        
    
        
            
            async function associateApprovalDecisionWithDecided_by() {
            
                const relatedDecided_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ApprovalDecision0 = await ApprovalDecisions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ApprovalDecision0?.setDecided_by)
                {
                    await
                    ApprovalDecision0.
                    setDecided_by(relatedDecided_by0);
                }
            
                const relatedDecided_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ApprovalDecision1 = await ApprovalDecisions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ApprovalDecision1?.setDecided_by)
                {
                    await
                    ApprovalDecision1.
                    setDecided_by(relatedDecided_by1);
                }
            
                const relatedDecided_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ApprovalDecision2 = await ApprovalDecisions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ApprovalDecision2?.setDecided_by)
                {
                    await
                    ApprovalDecision2.
                    setDecided_by(relatedDecided_by2);
                }
            
        }
        
    
        
    
        
    
        
    
        
            
            async function associateApprovalDecisionWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ApprovalDecision0 = await ApprovalDecisions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ApprovalDecision0?.setOrganization)
                {
                    await
                    ApprovalDecision0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ApprovalDecision1 = await ApprovalDecisions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ApprovalDecision1?.setOrganization)
                {
                    await
                    ApprovalDecision1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ApprovalDecision2 = await ApprovalDecisions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ApprovalDecision2?.setOrganization)
                {
                    await
                    ApprovalDecision2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateCompanyWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Company0 = await Companies.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Company0?.setTenant)
                {
                    await
                    Company0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Company1 = await Companies.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Company1?.setTenant)
                {
                    await
                    Company1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Company2 = await Companies.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Company2?.setTenant)
                {
                    await
                    Company2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateCompanyWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Company0 = await Companies.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Company0?.setOrganization)
                {
                    await
                    Company0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Company1 = await Companies.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Company1?.setOrganization)
                {
                    await
                    Company1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Company2 = await Companies.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Company2?.setOrganization)
                {
                    await
                    Company2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateCustomerWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Customer0 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Customer0?.setTenant)
                {
                    await
                    Customer0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Customer1 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Customer1?.setTenant)
                {
                    await
                    Customer1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Customer2 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Customer2?.setTenant)
                {
                    await
                    Customer2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateCustomerWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Customer0 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Customer0?.setOrganization)
                {
                    await
                    Customer0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Customer1 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Customer1?.setOrganization)
                {
                    await
                    Customer1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Customer2 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Customer2?.setOrganization)
                {
                    await
                    Customer2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateSupplierWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Supplier0 = await Suppliers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Supplier0?.setTenant)
                {
                    await
                    Supplier0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Supplier1 = await Suppliers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Supplier1?.setTenant)
                {
                    await
                    Supplier1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Supplier2 = await Suppliers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Supplier2?.setTenant)
                {
                    await
                    Supplier2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateSupplierWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Supplier0 = await Suppliers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Supplier0?.setOrganization)
                {
                    await
                    Supplier0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Supplier1 = await Suppliers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Supplier1?.setOrganization)
                {
                    await
                    Supplier1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Supplier2 = await Suppliers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Supplier2?.setOrganization)
                {
                    await
                    Supplier2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateUomWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Uom0 = await Uoms.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Uom0?.setTenant)
                {
                    await
                    Uom0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Uom1 = await Uoms.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Uom1?.setTenant)
                {
                    await
                    Uom1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Uom2 = await Uoms.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Uom2?.setTenant)
                {
                    await
                    Uom2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateUomWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Uom0 = await Uoms.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Uom0?.setOrganization)
                {
                    await
                    Uom0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Uom1 = await Uoms.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Uom1?.setOrganization)
                {
                    await
                    Uom1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Uom2 = await Uoms.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Uom2?.setOrganization)
                {
                    await
                    Uom2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateItemCategoryWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const ItemCategory0 = await ItemCategories.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ItemCategory0?.setTenant)
                {
                    await
                    ItemCategory0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const ItemCategory1 = await ItemCategories.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ItemCategory1?.setTenant)
                {
                    await
                    ItemCategory1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const ItemCategory2 = await ItemCategories.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ItemCategory2?.setTenant)
                {
                    await
                    ItemCategory2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateItemCategoryWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ItemCategory0 = await ItemCategories.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ItemCategory0?.setOrganization)
                {
                    await
                    ItemCategory0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ItemCategory1 = await ItemCategories.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ItemCategory1?.setOrganization)
                {
                    await
                    ItemCategory1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ItemCategory2 = await ItemCategories.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ItemCategory2?.setOrganization)
                {
                    await
                    ItemCategory2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateItemWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Item0 = await Items.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Item0?.setTenant)
                {
                    await
                    Item0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Item1 = await Items.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Item1?.setTenant)
                {
                    await
                    Item1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Item2 = await Items.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Item2?.setTenant)
                {
                    await
                    Item2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
    
        
    
        
    
        
            
            async function associateItemWithCategory() {
            
                const relatedCategory0 = await ItemCategories.findOne({
                    offset: Math.floor(Math.random() * (await ItemCategories.count())),
                });
                const Item0 = await Items.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Item0?.setCategory)
                {
                    await
                    Item0.
                    setCategory(relatedCategory0);
                }
            
                const relatedCategory1 = await ItemCategories.findOne({
                    offset: Math.floor(Math.random() * (await ItemCategories.count())),
                });
                const Item1 = await Items.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Item1?.setCategory)
                {
                    await
                    Item1.
                    setCategory(relatedCategory1);
                }
            
                const relatedCategory2 = await ItemCategories.findOne({
                    offset: Math.floor(Math.random() * (await ItemCategories.count())),
                });
                const Item2 = await Items.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Item2?.setCategory)
                {
                    await
                    Item2.
                    setCategory(relatedCategory2);
                }
            
        }
        
    
        
            
            async function associateItemWithUom() {
            
                const relatedUom0 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const Item0 = await Items.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Item0?.setUom)
                {
                    await
                    Item0.
                    setUom(relatedUom0);
                }
            
                const relatedUom1 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const Item1 = await Items.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Item1?.setUom)
                {
                    await
                    Item1.
                    setUom(relatedUom1);
                }
            
                const relatedUom2 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const Item2 = await Items.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Item2?.setUom)
                {
                    await
                    Item2.
                    setUom(relatedUom2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateItemWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Item0 = await Items.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Item0?.setOrganization)
                {
                    await
                    Item0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Item1 = await Items.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Item1?.setOrganization)
                {
                    await
                    Item1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Item2 = await Items.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Item2?.setOrganization)
                {
                    await
                    Item2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateWarehousWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Warehous0 = await Warehouses.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Warehous0?.setTenant)
                {
                    await
                    Warehous0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Warehous1 = await Warehouses.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Warehous1?.setTenant)
                {
                    await
                    Warehous1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Warehous2 = await Warehouses.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Warehous2?.setTenant)
                {
                    await
                    Warehous2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateWarehousWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Warehous0 = await Warehouses.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Warehous0?.setOrganization)
                {
                    await
                    Warehous0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Warehous1 = await Warehouses.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Warehous1?.setOrganization)
                {
                    await
                    Warehous1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Warehous2 = await Warehouses.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Warehous2?.setOrganization)
                {
                    await
                    Warehous2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateLocationWithWarehouse() {
            
                const relatedWarehouse0 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const Location0 = await Locations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Location0?.setWarehouse)
                {
                    await
                    Location0.
                    setWarehouse(relatedWarehouse0);
                }
            
                const relatedWarehouse1 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const Location1 = await Locations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Location1?.setWarehouse)
                {
                    await
                    Location1.
                    setWarehouse(relatedWarehouse1);
                }
            
                const relatedWarehouse2 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const Location2 = await Locations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Location2?.setWarehouse)
                {
                    await
                    Location2.
                    setWarehouse(relatedWarehouse2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateLocationWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Location0 = await Locations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Location0?.setOrganization)
                {
                    await
                    Location0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Location1 = await Locations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Location1?.setOrganization)
                {
                    await
                    Location1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Location2 = await Locations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Location2?.setOrganization)
                {
                    await
                    Location2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateLotWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Lot0 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Lot0?.setTenant)
                {
                    await
                    Lot0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Lot1 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Lot1?.setTenant)
                {
                    await
                    Lot1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Lot2 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Lot2?.setTenant)
                {
                    await
                    Lot2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
            
            async function associateLotWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Lot0 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Lot0?.setItem)
                {
                    await
                    Lot0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Lot1 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Lot1?.setItem)
                {
                    await
                    Lot1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Lot2 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Lot2?.setItem)
                {
                    await
                    Lot2.
                    setItem(relatedItem2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateLotWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Lot0 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Lot0?.setOrganization)
                {
                    await
                    Lot0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Lot1 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Lot1?.setOrganization)
                {
                    await
                    Lot1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Lot2 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Lot2?.setOrganization)
                {
                    await
                    Lot2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateSerialNumberWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const SerialNumber0 = await SerialNumbers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SerialNumber0?.setTenant)
                {
                    await
                    SerialNumber0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const SerialNumber1 = await SerialNumbers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SerialNumber1?.setTenant)
                {
                    await
                    SerialNumber1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const SerialNumber2 = await SerialNumbers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SerialNumber2?.setTenant)
                {
                    await
                    SerialNumber2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
            
            async function associateSerialNumberWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const SerialNumber0 = await SerialNumbers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SerialNumber0?.setItem)
                {
                    await
                    SerialNumber0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const SerialNumber1 = await SerialNumbers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SerialNumber1?.setItem)
                {
                    await
                    SerialNumber1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const SerialNumber2 = await SerialNumbers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SerialNumber2?.setItem)
                {
                    await
                    SerialNumber2.
                    setItem(relatedItem2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateSerialNumberWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SerialNumber0 = await SerialNumbers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SerialNumber0?.setOrganization)
                {
                    await
                    SerialNumber0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SerialNumber1 = await SerialNumbers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SerialNumber1?.setOrganization)
                {
                    await
                    SerialNumber1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SerialNumber2 = await SerialNumbers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SerialNumber2?.setOrganization)
                {
                    await
                    SerialNumber2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateInventoryTransferWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const InventoryTransfer0 = await InventoryTransfers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryTransfer0?.setTenant)
                {
                    await
                    InventoryTransfer0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const InventoryTransfer1 = await InventoryTransfers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryTransfer1?.setTenant)
                {
                    await
                    InventoryTransfer1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const InventoryTransfer2 = await InventoryTransfers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryTransfer2?.setTenant)
                {
                    await
                    InventoryTransfer2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
    
        
            
            async function associateInventoryTransferWithFrom_location() {
            
                const relatedFrom_location0 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryTransfer0 = await InventoryTransfers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryTransfer0?.setFrom_location)
                {
                    await
                    InventoryTransfer0.
                    setFrom_location(relatedFrom_location0);
                }
            
                const relatedFrom_location1 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryTransfer1 = await InventoryTransfers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryTransfer1?.setFrom_location)
                {
                    await
                    InventoryTransfer1.
                    setFrom_location(relatedFrom_location1);
                }
            
                const relatedFrom_location2 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryTransfer2 = await InventoryTransfers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryTransfer2?.setFrom_location)
                {
                    await
                    InventoryTransfer2.
                    setFrom_location(relatedFrom_location2);
                }
            
        }
        
    
        
            
            async function associateInventoryTransferWithTo_location() {
            
                const relatedTo_location0 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryTransfer0 = await InventoryTransfers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryTransfer0?.setTo_location)
                {
                    await
                    InventoryTransfer0.
                    setTo_location(relatedTo_location0);
                }
            
                const relatedTo_location1 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryTransfer1 = await InventoryTransfers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryTransfer1?.setTo_location)
                {
                    await
                    InventoryTransfer1.
                    setTo_location(relatedTo_location1);
                }
            
                const relatedTo_location2 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryTransfer2 = await InventoryTransfers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryTransfer2?.setTo_location)
                {
                    await
                    InventoryTransfer2.
                    setTo_location(relatedTo_location2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateInventoryTransferWithRequested_by() {
            
                const relatedRequested_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const InventoryTransfer0 = await InventoryTransfers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryTransfer0?.setRequested_by)
                {
                    await
                    InventoryTransfer0.
                    setRequested_by(relatedRequested_by0);
                }
            
                const relatedRequested_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const InventoryTransfer1 = await InventoryTransfers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryTransfer1?.setRequested_by)
                {
                    await
                    InventoryTransfer1.
                    setRequested_by(relatedRequested_by1);
                }
            
                const relatedRequested_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const InventoryTransfer2 = await InventoryTransfers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryTransfer2?.setRequested_by)
                {
                    await
                    InventoryTransfer2.
                    setRequested_by(relatedRequested_by2);
                }
            
        }
        
    
        
    
        
            // Similar logic for "relation_many"
        
    
        
            
            async function associateInventoryTransferWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryTransfer0 = await InventoryTransfers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryTransfer0?.setOrganization)
                {
                    await
                    InventoryTransfer0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryTransfer1 = await InventoryTransfers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryTransfer1?.setOrganization)
                {
                    await
                    InventoryTransfer1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryTransfer2 = await InventoryTransfers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryTransfer2?.setOrganization)
                {
                    await
                    InventoryTransfer2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateInventoryTransferLineWithTransfer() {
            
                const relatedTransfer0 = await InventoryTransfers.findOne({
                    offset: Math.floor(Math.random() * (await InventoryTransfers.count())),
                });
                const InventoryTransferLine0 = await InventoryTransferLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryTransferLine0?.setTransfer)
                {
                    await
                    InventoryTransferLine0.
                    setTransfer(relatedTransfer0);
                }
            
                const relatedTransfer1 = await InventoryTransfers.findOne({
                    offset: Math.floor(Math.random() * (await InventoryTransfers.count())),
                });
                const InventoryTransferLine1 = await InventoryTransferLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryTransferLine1?.setTransfer)
                {
                    await
                    InventoryTransferLine1.
                    setTransfer(relatedTransfer1);
                }
            
                const relatedTransfer2 = await InventoryTransfers.findOne({
                    offset: Math.floor(Math.random() * (await InventoryTransfers.count())),
                });
                const InventoryTransferLine2 = await InventoryTransferLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryTransferLine2?.setTransfer)
                {
                    await
                    InventoryTransferLine2.
                    setTransfer(relatedTransfer2);
                }
            
        }
        
    
        
            
            async function associateInventoryTransferLineWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryTransferLine0 = await InventoryTransferLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryTransferLine0?.setItem)
                {
                    await
                    InventoryTransferLine0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryTransferLine1 = await InventoryTransferLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryTransferLine1?.setItem)
                {
                    await
                    InventoryTransferLine1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryTransferLine2 = await InventoryTransferLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryTransferLine2?.setItem)
                {
                    await
                    InventoryTransferLine2.
                    setItem(relatedItem2);
                }
            
        }
        
    
        
    
        
            
            async function associateInventoryTransferLineWithLot() {
            
                const relatedLot0 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const InventoryTransferLine0 = await InventoryTransferLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryTransferLine0?.setLot)
                {
                    await
                    InventoryTransferLine0.
                    setLot(relatedLot0);
                }
            
                const relatedLot1 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const InventoryTransferLine1 = await InventoryTransferLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryTransferLine1?.setLot)
                {
                    await
                    InventoryTransferLine1.
                    setLot(relatedLot1);
                }
            
                const relatedLot2 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const InventoryTransferLine2 = await InventoryTransferLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryTransferLine2?.setLot)
                {
                    await
                    InventoryTransferLine2.
                    setLot(relatedLot2);
                }
            
        }
        
    
        
            
            async function associateInventoryTransferLineWithSerial_number() {
            
                const relatedSerial_number0 = await SerialNumbers.findOne({
                    offset: Math.floor(Math.random() * (await SerialNumbers.count())),
                });
                const InventoryTransferLine0 = await InventoryTransferLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryTransferLine0?.setSerial_number)
                {
                    await
                    InventoryTransferLine0.
                    setSerial_number(relatedSerial_number0);
                }
            
                const relatedSerial_number1 = await SerialNumbers.findOne({
                    offset: Math.floor(Math.random() * (await SerialNumbers.count())),
                });
                const InventoryTransferLine1 = await InventoryTransferLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryTransferLine1?.setSerial_number)
                {
                    await
                    InventoryTransferLine1.
                    setSerial_number(relatedSerial_number1);
                }
            
                const relatedSerial_number2 = await SerialNumbers.findOne({
                    offset: Math.floor(Math.random() * (await SerialNumbers.count())),
                });
                const InventoryTransferLine2 = await InventoryTransferLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryTransferLine2?.setSerial_number)
                {
                    await
                    InventoryTransferLine2.
                    setSerial_number(relatedSerial_number2);
                }
            
        }
        
    
        
    
        
            
            async function associateInventoryTransferLineWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryTransferLine0 = await InventoryTransferLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryTransferLine0?.setOrganization)
                {
                    await
                    InventoryTransferLine0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryTransferLine1 = await InventoryTransferLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryTransferLine1?.setOrganization)
                {
                    await
                    InventoryTransferLine1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryTransferLine2 = await InventoryTransferLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryTransferLine2?.setOrganization)
                {
                    await
                    InventoryTransferLine2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateStockMovementWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const StockMovement0 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (StockMovement0?.setTenant)
                {
                    await
                    StockMovement0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const StockMovement1 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (StockMovement1?.setTenant)
                {
                    await
                    StockMovement1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const StockMovement2 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (StockMovement2?.setTenant)
                {
                    await
                    StockMovement2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
    
        
            
            async function associateStockMovementWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const StockMovement0 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (StockMovement0?.setItem)
                {
                    await
                    StockMovement0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const StockMovement1 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (StockMovement1?.setItem)
                {
                    await
                    StockMovement1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const StockMovement2 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (StockMovement2?.setItem)
                {
                    await
                    StockMovement2.
                    setItem(relatedItem2);
                }
            
        }
        
    
        
            
            async function associateStockMovementWithFrom_location() {
            
                const relatedFrom_location0 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const StockMovement0 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (StockMovement0?.setFrom_location)
                {
                    await
                    StockMovement0.
                    setFrom_location(relatedFrom_location0);
                }
            
                const relatedFrom_location1 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const StockMovement1 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (StockMovement1?.setFrom_location)
                {
                    await
                    StockMovement1.
                    setFrom_location(relatedFrom_location1);
                }
            
                const relatedFrom_location2 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const StockMovement2 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (StockMovement2?.setFrom_location)
                {
                    await
                    StockMovement2.
                    setFrom_location(relatedFrom_location2);
                }
            
        }
        
    
        
            
            async function associateStockMovementWithTo_location() {
            
                const relatedTo_location0 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const StockMovement0 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (StockMovement0?.setTo_location)
                {
                    await
                    StockMovement0.
                    setTo_location(relatedTo_location0);
                }
            
                const relatedTo_location1 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const StockMovement1 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (StockMovement1?.setTo_location)
                {
                    await
                    StockMovement1.
                    setTo_location(relatedTo_location1);
                }
            
                const relatedTo_location2 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const StockMovement2 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (StockMovement2?.setTo_location)
                {
                    await
                    StockMovement2.
                    setTo_location(relatedTo_location2);
                }
            
        }
        
    
        
    
        
            
            async function associateStockMovementWithLot() {
            
                const relatedLot0 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const StockMovement0 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (StockMovement0?.setLot)
                {
                    await
                    StockMovement0.
                    setLot(relatedLot0);
                }
            
                const relatedLot1 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const StockMovement1 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (StockMovement1?.setLot)
                {
                    await
                    StockMovement1.
                    setLot(relatedLot1);
                }
            
                const relatedLot2 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const StockMovement2 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (StockMovement2?.setLot)
                {
                    await
                    StockMovement2.
                    setLot(relatedLot2);
                }
            
        }
        
    
        
            
            async function associateStockMovementWithSerial_number() {
            
                const relatedSerial_number0 = await SerialNumbers.findOne({
                    offset: Math.floor(Math.random() * (await SerialNumbers.count())),
                });
                const StockMovement0 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (StockMovement0?.setSerial_number)
                {
                    await
                    StockMovement0.
                    setSerial_number(relatedSerial_number0);
                }
            
                const relatedSerial_number1 = await SerialNumbers.findOne({
                    offset: Math.floor(Math.random() * (await SerialNumbers.count())),
                });
                const StockMovement1 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (StockMovement1?.setSerial_number)
                {
                    await
                    StockMovement1.
                    setSerial_number(relatedSerial_number1);
                }
            
                const relatedSerial_number2 = await SerialNumbers.findOne({
                    offset: Math.floor(Math.random() * (await SerialNumbers.count())),
                });
                const StockMovement2 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (StockMovement2?.setSerial_number)
                {
                    await
                    StockMovement2.
                    setSerial_number(relatedSerial_number2);
                }
            
        }
        
    
        
    
        
    
        
    
        
            
            async function associateStockMovementWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const StockMovement0 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (StockMovement0?.setOrganization)
                {
                    await
                    StockMovement0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const StockMovement1 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (StockMovement1?.setOrganization)
                {
                    await
                    StockMovement1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const StockMovement2 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (StockMovement2?.setOrganization)
                {
                    await
                    StockMovement2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateQuotationWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Quotation0 = await Quotations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Quotation0?.setTenant)
                {
                    await
                    Quotation0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Quotation1 = await Quotations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Quotation1?.setTenant)
                {
                    await
                    Quotation1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Quotation2 = await Quotations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Quotation2?.setTenant)
                {
                    await
                    Quotation2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
    
        
            
            async function associateQuotationWithCustomer() {
            
                const relatedCustomer0 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Quotation0 = await Quotations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Quotation0?.setCustomer)
                {
                    await
                    Quotation0.
                    setCustomer(relatedCustomer0);
                }
            
                const relatedCustomer1 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Quotation1 = await Quotations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Quotation1?.setCustomer)
                {
                    await
                    Quotation1.
                    setCustomer(relatedCustomer1);
                }
            
                const relatedCustomer2 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Quotation2 = await Quotations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Quotation2?.setCustomer)
                {
                    await
                    Quotation2.
                    setCustomer(relatedCustomer2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    
        
            
            async function associateQuotationWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Quotation0 = await Quotations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Quotation0?.setOrganization)
                {
                    await
                    Quotation0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Quotation1 = await Quotations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Quotation1?.setOrganization)
                {
                    await
                    Quotation1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Quotation2 = await Quotations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Quotation2?.setOrganization)
                {
                    await
                    Quotation2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateQuotationLineWithQuotation() {
            
                const relatedQuotation0 = await Quotations.findOne({
                    offset: Math.floor(Math.random() * (await Quotations.count())),
                });
                const QuotationLine0 = await QuotationLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QuotationLine0?.setQuotation)
                {
                    await
                    QuotationLine0.
                    setQuotation(relatedQuotation0);
                }
            
                const relatedQuotation1 = await Quotations.findOne({
                    offset: Math.floor(Math.random() * (await Quotations.count())),
                });
                const QuotationLine1 = await QuotationLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QuotationLine1?.setQuotation)
                {
                    await
                    QuotationLine1.
                    setQuotation(relatedQuotation1);
                }
            
                const relatedQuotation2 = await Quotations.findOne({
                    offset: Math.floor(Math.random() * (await Quotations.count())),
                });
                const QuotationLine2 = await QuotationLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QuotationLine2?.setQuotation)
                {
                    await
                    QuotationLine2.
                    setQuotation(relatedQuotation2);
                }
            
        }
        
    
        
            
            async function associateQuotationLineWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const QuotationLine0 = await QuotationLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QuotationLine0?.setItem)
                {
                    await
                    QuotationLine0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const QuotationLine1 = await QuotationLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QuotationLine1?.setItem)
                {
                    await
                    QuotationLine1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const QuotationLine2 = await QuotationLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QuotationLine2?.setItem)
                {
                    await
                    QuotationLine2.
                    setItem(relatedItem2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateQuotationLineWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const QuotationLine0 = await QuotationLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QuotationLine0?.setOrganization)
                {
                    await
                    QuotationLine0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const QuotationLine1 = await QuotationLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QuotationLine1?.setOrganization)
                {
                    await
                    QuotationLine1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const QuotationLine2 = await QuotationLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QuotationLine2?.setOrganization)
                {
                    await
                    QuotationLine2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateSalesOrderWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const SalesOrder0 = await SalesOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SalesOrder0?.setTenant)
                {
                    await
                    SalesOrder0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const SalesOrder1 = await SalesOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SalesOrder1?.setTenant)
                {
                    await
                    SalesOrder1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const SalesOrder2 = await SalesOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SalesOrder2?.setTenant)
                {
                    await
                    SalesOrder2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
    
        
            
            async function associateSalesOrderWithCustomer() {
            
                const relatedCustomer0 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const SalesOrder0 = await SalesOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SalesOrder0?.setCustomer)
                {
                    await
                    SalesOrder0.
                    setCustomer(relatedCustomer0);
                }
            
                const relatedCustomer1 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const SalesOrder1 = await SalesOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SalesOrder1?.setCustomer)
                {
                    await
                    SalesOrder1.
                    setCustomer(relatedCustomer1);
                }
            
                const relatedCustomer2 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const SalesOrder2 = await SalesOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SalesOrder2?.setCustomer)
                {
                    await
                    SalesOrder2.
                    setCustomer(relatedCustomer2);
                }
            
        }
        
    
        
            
            async function associateSalesOrderWithQuotation() {
            
                const relatedQuotation0 = await Quotations.findOne({
                    offset: Math.floor(Math.random() * (await Quotations.count())),
                });
                const SalesOrder0 = await SalesOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SalesOrder0?.setQuotation)
                {
                    await
                    SalesOrder0.
                    setQuotation(relatedQuotation0);
                }
            
                const relatedQuotation1 = await Quotations.findOne({
                    offset: Math.floor(Math.random() * (await Quotations.count())),
                });
                const SalesOrder1 = await SalesOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SalesOrder1?.setQuotation)
                {
                    await
                    SalesOrder1.
                    setQuotation(relatedQuotation1);
                }
            
                const relatedQuotation2 = await Quotations.findOne({
                    offset: Math.floor(Math.random() * (await Quotations.count())),
                });
                const SalesOrder2 = await SalesOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SalesOrder2?.setQuotation)
                {
                    await
                    SalesOrder2.
                    setQuotation(relatedQuotation2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    
        
            
            async function associateSalesOrderWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SalesOrder0 = await SalesOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SalesOrder0?.setOrganization)
                {
                    await
                    SalesOrder0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SalesOrder1 = await SalesOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SalesOrder1?.setOrganization)
                {
                    await
                    SalesOrder1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SalesOrder2 = await SalesOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SalesOrder2?.setOrganization)
                {
                    await
                    SalesOrder2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateSalesOrderLineWithSales_order() {
            
                const relatedSales_order0 = await SalesOrders.findOne({
                    offset: Math.floor(Math.random() * (await SalesOrders.count())),
                });
                const SalesOrderLine0 = await SalesOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SalesOrderLine0?.setSales_order)
                {
                    await
                    SalesOrderLine0.
                    setSales_order(relatedSales_order0);
                }
            
                const relatedSales_order1 = await SalesOrders.findOne({
                    offset: Math.floor(Math.random() * (await SalesOrders.count())),
                });
                const SalesOrderLine1 = await SalesOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SalesOrderLine1?.setSales_order)
                {
                    await
                    SalesOrderLine1.
                    setSales_order(relatedSales_order1);
                }
            
                const relatedSales_order2 = await SalesOrders.findOne({
                    offset: Math.floor(Math.random() * (await SalesOrders.count())),
                });
                const SalesOrderLine2 = await SalesOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SalesOrderLine2?.setSales_order)
                {
                    await
                    SalesOrderLine2.
                    setSales_order(relatedSales_order2);
                }
            
        }
        
    
        
            
            async function associateSalesOrderLineWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const SalesOrderLine0 = await SalesOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SalesOrderLine0?.setItem)
                {
                    await
                    SalesOrderLine0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const SalesOrderLine1 = await SalesOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SalesOrderLine1?.setItem)
                {
                    await
                    SalesOrderLine1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const SalesOrderLine2 = await SalesOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SalesOrderLine2?.setItem)
                {
                    await
                    SalesOrderLine2.
                    setItem(relatedItem2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    
        
            
            async function associateSalesOrderLineWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SalesOrderLine0 = await SalesOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SalesOrderLine0?.setOrganization)
                {
                    await
                    SalesOrderLine0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SalesOrderLine1 = await SalesOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SalesOrderLine1?.setOrganization)
                {
                    await
                    SalesOrderLine1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SalesOrderLine2 = await SalesOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SalesOrderLine2?.setOrganization)
                {
                    await
                    SalesOrderLine2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateSalesAllocationWithSales_order_line() {
            
                const relatedSales_order_line0 = await SalesOrderLines.findOne({
                    offset: Math.floor(Math.random() * (await SalesOrderLines.count())),
                });
                const SalesAllocation0 = await SalesAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SalesAllocation0?.setSales_order_line)
                {
                    await
                    SalesAllocation0.
                    setSales_order_line(relatedSales_order_line0);
                }
            
                const relatedSales_order_line1 = await SalesOrderLines.findOne({
                    offset: Math.floor(Math.random() * (await SalesOrderLines.count())),
                });
                const SalesAllocation1 = await SalesAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SalesAllocation1?.setSales_order_line)
                {
                    await
                    SalesAllocation1.
                    setSales_order_line(relatedSales_order_line1);
                }
            
                const relatedSales_order_line2 = await SalesOrderLines.findOne({
                    offset: Math.floor(Math.random() * (await SalesOrderLines.count())),
                });
                const SalesAllocation2 = await SalesAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SalesAllocation2?.setSales_order_line)
                {
                    await
                    SalesAllocation2.
                    setSales_order_line(relatedSales_order_line2);
                }
            
        }
        
    
        
            
            async function associateSalesAllocationWithLot() {
            
                const relatedLot0 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const SalesAllocation0 = await SalesAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SalesAllocation0?.setLot)
                {
                    await
                    SalesAllocation0.
                    setLot(relatedLot0);
                }
            
                const relatedLot1 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const SalesAllocation1 = await SalesAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SalesAllocation1?.setLot)
                {
                    await
                    SalesAllocation1.
                    setLot(relatedLot1);
                }
            
                const relatedLot2 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const SalesAllocation2 = await SalesAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SalesAllocation2?.setLot)
                {
                    await
                    SalesAllocation2.
                    setLot(relatedLot2);
                }
            
        }
        
    
        
            
            async function associateSalesAllocationWithSerial_number() {
            
                const relatedSerial_number0 = await SerialNumbers.findOne({
                    offset: Math.floor(Math.random() * (await SerialNumbers.count())),
                });
                const SalesAllocation0 = await SalesAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SalesAllocation0?.setSerial_number)
                {
                    await
                    SalesAllocation0.
                    setSerial_number(relatedSerial_number0);
                }
            
                const relatedSerial_number1 = await SerialNumbers.findOne({
                    offset: Math.floor(Math.random() * (await SerialNumbers.count())),
                });
                const SalesAllocation1 = await SalesAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SalesAllocation1?.setSerial_number)
                {
                    await
                    SalesAllocation1.
                    setSerial_number(relatedSerial_number1);
                }
            
                const relatedSerial_number2 = await SerialNumbers.findOne({
                    offset: Math.floor(Math.random() * (await SerialNumbers.count())),
                });
                const SalesAllocation2 = await SalesAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SalesAllocation2?.setSerial_number)
                {
                    await
                    SalesAllocation2.
                    setSerial_number(relatedSerial_number2);
                }
            
        }
        
    
        
            
            async function associateSalesAllocationWithLocation() {
            
                const relatedLocation0 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const SalesAllocation0 = await SalesAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SalesAllocation0?.setLocation)
                {
                    await
                    SalesAllocation0.
                    setLocation(relatedLocation0);
                }
            
                const relatedLocation1 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const SalesAllocation1 = await SalesAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SalesAllocation1?.setLocation)
                {
                    await
                    SalesAllocation1.
                    setLocation(relatedLocation1);
                }
            
                const relatedLocation2 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const SalesAllocation2 = await SalesAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SalesAllocation2?.setLocation)
                {
                    await
                    SalesAllocation2.
                    setLocation(relatedLocation2);
                }
            
        }
        
    
        
    
        
            
            async function associateSalesAllocationWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SalesAllocation0 = await SalesAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SalesAllocation0?.setOrganization)
                {
                    await
                    SalesAllocation0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SalesAllocation1 = await SalesAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SalesAllocation1?.setOrganization)
                {
                    await
                    SalesAllocation1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SalesAllocation2 = await SalesAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SalesAllocation2?.setOrganization)
                {
                    await
                    SalesAllocation2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateInvoiceWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Invoice0 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Invoice0?.setTenant)
                {
                    await
                    Invoice0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Invoice1 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Invoice1?.setTenant)
                {
                    await
                    Invoice1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Invoice2 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Invoice2?.setTenant)
                {
                    await
                    Invoice2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
    
        
            
            async function associateInvoiceWithCustomer() {
            
                const relatedCustomer0 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Invoice0 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Invoice0?.setCustomer)
                {
                    await
                    Invoice0.
                    setCustomer(relatedCustomer0);
                }
            
                const relatedCustomer1 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Invoice1 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Invoice1?.setCustomer)
                {
                    await
                    Invoice1.
                    setCustomer(relatedCustomer1);
                }
            
                const relatedCustomer2 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Invoice2 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Invoice2?.setCustomer)
                {
                    await
                    Invoice2.
                    setCustomer(relatedCustomer2);
                }
            
        }
        
    
        
            
            async function associateInvoiceWithSales_order() {
            
                const relatedSales_order0 = await SalesOrders.findOne({
                    offset: Math.floor(Math.random() * (await SalesOrders.count())),
                });
                const Invoice0 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Invoice0?.setSales_order)
                {
                    await
                    Invoice0.
                    setSales_order(relatedSales_order0);
                }
            
                const relatedSales_order1 = await SalesOrders.findOne({
                    offset: Math.floor(Math.random() * (await SalesOrders.count())),
                });
                const Invoice1 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Invoice1?.setSales_order)
                {
                    await
                    Invoice1.
                    setSales_order(relatedSales_order1);
                }
            
                const relatedSales_order2 = await SalesOrders.findOne({
                    offset: Math.floor(Math.random() * (await SalesOrders.count())),
                });
                const Invoice2 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Invoice2?.setSales_order)
                {
                    await
                    Invoice2.
                    setSales_order(relatedSales_order2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    
        
            
            async function associateInvoiceWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Invoice0 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Invoice0?.setOrganization)
                {
                    await
                    Invoice0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Invoice1 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Invoice1?.setOrganization)
                {
                    await
                    Invoice1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Invoice2 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Invoice2?.setOrganization)
                {
                    await
                    Invoice2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateInvoiceLineWithInvoice() {
            
                const relatedInvoice0 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const InvoiceLine0 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InvoiceLine0?.setInvoice)
                {
                    await
                    InvoiceLine0.
                    setInvoice(relatedInvoice0);
                }
            
                const relatedInvoice1 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const InvoiceLine1 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InvoiceLine1?.setInvoice)
                {
                    await
                    InvoiceLine1.
                    setInvoice(relatedInvoice1);
                }
            
                const relatedInvoice2 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const InvoiceLine2 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InvoiceLine2?.setInvoice)
                {
                    await
                    InvoiceLine2.
                    setInvoice(relatedInvoice2);
                }
            
        }
        
    
        
            
            async function associateInvoiceLineWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InvoiceLine0 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InvoiceLine0?.setItem)
                {
                    await
                    InvoiceLine0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InvoiceLine1 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InvoiceLine1?.setItem)
                {
                    await
                    InvoiceLine1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InvoiceLine2 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InvoiceLine2?.setItem)
                {
                    await
                    InvoiceLine2.
                    setItem(relatedItem2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateInvoiceLineWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InvoiceLine0 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InvoiceLine0?.setOrganization)
                {
                    await
                    InvoiceLine0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InvoiceLine1 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InvoiceLine1?.setOrganization)
                {
                    await
                    InvoiceLine1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InvoiceLine2 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InvoiceLine2?.setOrganization)
                {
                    await
                    InvoiceLine2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateCustomerReturnWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const CustomerReturn0 = await CustomerReturns.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CustomerReturn0?.setTenant)
                {
                    await
                    CustomerReturn0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const CustomerReturn1 = await CustomerReturns.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CustomerReturn1?.setTenant)
                {
                    await
                    CustomerReturn1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const CustomerReturn2 = await CustomerReturns.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CustomerReturn2?.setTenant)
                {
                    await
                    CustomerReturn2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
    
        
            
            async function associateCustomerReturnWithCustomer() {
            
                const relatedCustomer0 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const CustomerReturn0 = await CustomerReturns.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CustomerReturn0?.setCustomer)
                {
                    await
                    CustomerReturn0.
                    setCustomer(relatedCustomer0);
                }
            
                const relatedCustomer1 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const CustomerReturn1 = await CustomerReturns.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CustomerReturn1?.setCustomer)
                {
                    await
                    CustomerReturn1.
                    setCustomer(relatedCustomer1);
                }
            
                const relatedCustomer2 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const CustomerReturn2 = await CustomerReturns.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CustomerReturn2?.setCustomer)
                {
                    await
                    CustomerReturn2.
                    setCustomer(relatedCustomer2);
                }
            
        }
        
    
        
            
            async function associateCustomerReturnWithInvoice() {
            
                const relatedInvoice0 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const CustomerReturn0 = await CustomerReturns.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CustomerReturn0?.setInvoice)
                {
                    await
                    CustomerReturn0.
                    setInvoice(relatedInvoice0);
                }
            
                const relatedInvoice1 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const CustomerReturn1 = await CustomerReturns.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CustomerReturn1?.setInvoice)
                {
                    await
                    CustomerReturn1.
                    setInvoice(relatedInvoice1);
                }
            
                const relatedInvoice2 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const CustomerReturn2 = await CustomerReturns.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CustomerReturn2?.setInvoice)
                {
                    await
                    CustomerReturn2.
                    setInvoice(relatedInvoice2);
                }
            
        }
        
    
        
            
            async function associateCustomerReturnWithSales_order() {
            
                const relatedSales_order0 = await SalesOrders.findOne({
                    offset: Math.floor(Math.random() * (await SalesOrders.count())),
                });
                const CustomerReturn0 = await CustomerReturns.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CustomerReturn0?.setSales_order)
                {
                    await
                    CustomerReturn0.
                    setSales_order(relatedSales_order0);
                }
            
                const relatedSales_order1 = await SalesOrders.findOne({
                    offset: Math.floor(Math.random() * (await SalesOrders.count())),
                });
                const CustomerReturn1 = await CustomerReturns.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CustomerReturn1?.setSales_order)
                {
                    await
                    CustomerReturn1.
                    setSales_order(relatedSales_order1);
                }
            
                const relatedSales_order2 = await SalesOrders.findOne({
                    offset: Math.floor(Math.random() * (await SalesOrders.count())),
                });
                const CustomerReturn2 = await CustomerReturns.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CustomerReturn2?.setSales_order)
                {
                    await
                    CustomerReturn2.
                    setSales_order(relatedSales_order2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    
        
            
            async function associateCustomerReturnWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CustomerReturn0 = await CustomerReturns.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CustomerReturn0?.setOrganization)
                {
                    await
                    CustomerReturn0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CustomerReturn1 = await CustomerReturns.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CustomerReturn1?.setOrganization)
                {
                    await
                    CustomerReturn1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CustomerReturn2 = await CustomerReturns.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CustomerReturn2?.setOrganization)
                {
                    await
                    CustomerReturn2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateCustomerReturnLineWithCustomer_return() {
            
                const relatedCustomer_return0 = await CustomerReturns.findOne({
                    offset: Math.floor(Math.random() * (await CustomerReturns.count())),
                });
                const CustomerReturnLine0 = await CustomerReturnLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CustomerReturnLine0?.setCustomer_return)
                {
                    await
                    CustomerReturnLine0.
                    setCustomer_return(relatedCustomer_return0);
                }
            
                const relatedCustomer_return1 = await CustomerReturns.findOne({
                    offset: Math.floor(Math.random() * (await CustomerReturns.count())),
                });
                const CustomerReturnLine1 = await CustomerReturnLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CustomerReturnLine1?.setCustomer_return)
                {
                    await
                    CustomerReturnLine1.
                    setCustomer_return(relatedCustomer_return1);
                }
            
                const relatedCustomer_return2 = await CustomerReturns.findOne({
                    offset: Math.floor(Math.random() * (await CustomerReturns.count())),
                });
                const CustomerReturnLine2 = await CustomerReturnLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CustomerReturnLine2?.setCustomer_return)
                {
                    await
                    CustomerReturnLine2.
                    setCustomer_return(relatedCustomer_return2);
                }
            
        }
        
    
        
            
            async function associateCustomerReturnLineWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const CustomerReturnLine0 = await CustomerReturnLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CustomerReturnLine0?.setItem)
                {
                    await
                    CustomerReturnLine0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const CustomerReturnLine1 = await CustomerReturnLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CustomerReturnLine1?.setItem)
                {
                    await
                    CustomerReturnLine1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const CustomerReturnLine2 = await CustomerReturnLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CustomerReturnLine2?.setItem)
                {
                    await
                    CustomerReturnLine2.
                    setItem(relatedItem2);
                }
            
        }
        
    
        
            
            async function associateCustomerReturnLineWithLot() {
            
                const relatedLot0 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const CustomerReturnLine0 = await CustomerReturnLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CustomerReturnLine0?.setLot)
                {
                    await
                    CustomerReturnLine0.
                    setLot(relatedLot0);
                }
            
                const relatedLot1 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const CustomerReturnLine1 = await CustomerReturnLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CustomerReturnLine1?.setLot)
                {
                    await
                    CustomerReturnLine1.
                    setLot(relatedLot1);
                }
            
                const relatedLot2 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const CustomerReturnLine2 = await CustomerReturnLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CustomerReturnLine2?.setLot)
                {
                    await
                    CustomerReturnLine2.
                    setLot(relatedLot2);
                }
            
        }
        
    
        
            
            async function associateCustomerReturnLineWithSerial_number() {
            
                const relatedSerial_number0 = await SerialNumbers.findOne({
                    offset: Math.floor(Math.random() * (await SerialNumbers.count())),
                });
                const CustomerReturnLine0 = await CustomerReturnLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CustomerReturnLine0?.setSerial_number)
                {
                    await
                    CustomerReturnLine0.
                    setSerial_number(relatedSerial_number0);
                }
            
                const relatedSerial_number1 = await SerialNumbers.findOne({
                    offset: Math.floor(Math.random() * (await SerialNumbers.count())),
                });
                const CustomerReturnLine1 = await CustomerReturnLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CustomerReturnLine1?.setSerial_number)
                {
                    await
                    CustomerReturnLine1.
                    setSerial_number(relatedSerial_number1);
                }
            
                const relatedSerial_number2 = await SerialNumbers.findOne({
                    offset: Math.floor(Math.random() * (await SerialNumbers.count())),
                });
                const CustomerReturnLine2 = await CustomerReturnLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CustomerReturnLine2?.setSerial_number)
                {
                    await
                    CustomerReturnLine2.
                    setSerial_number(relatedSerial_number2);
                }
            
        }
        
    
        
    
        
    
        
    
        
            
            async function associateCustomerReturnLineWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CustomerReturnLine0 = await CustomerReturnLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CustomerReturnLine0?.setOrganization)
                {
                    await
                    CustomerReturnLine0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CustomerReturnLine1 = await CustomerReturnLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CustomerReturnLine1?.setOrganization)
                {
                    await
                    CustomerReturnLine1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CustomerReturnLine2 = await CustomerReturnLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CustomerReturnLine2?.setOrganization)
                {
                    await
                    CustomerReturnLine2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associatePurchaseOrderWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const PurchaseOrder0 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PurchaseOrder0?.setTenant)
                {
                    await
                    PurchaseOrder0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const PurchaseOrder1 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PurchaseOrder1?.setTenant)
                {
                    await
                    PurchaseOrder1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const PurchaseOrder2 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PurchaseOrder2?.setTenant)
                {
                    await
                    PurchaseOrder2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
    
        
            
            async function associatePurchaseOrderWithSupplier() {
            
                const relatedSupplier0 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const PurchaseOrder0 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PurchaseOrder0?.setSupplier)
                {
                    await
                    PurchaseOrder0.
                    setSupplier(relatedSupplier0);
                }
            
                const relatedSupplier1 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const PurchaseOrder1 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PurchaseOrder1?.setSupplier)
                {
                    await
                    PurchaseOrder1.
                    setSupplier(relatedSupplier1);
                }
            
                const relatedSupplier2 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const PurchaseOrder2 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PurchaseOrder2?.setSupplier)
                {
                    await
                    PurchaseOrder2.
                    setSupplier(relatedSupplier2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    
        
            
            async function associatePurchaseOrderWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const PurchaseOrder0 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PurchaseOrder0?.setOrganization)
                {
                    await
                    PurchaseOrder0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const PurchaseOrder1 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PurchaseOrder1?.setOrganization)
                {
                    await
                    PurchaseOrder1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const PurchaseOrder2 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PurchaseOrder2?.setOrganization)
                {
                    await
                    PurchaseOrder2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associatePurchaseOrderLineWithPurchase_order() {
            
                const relatedPurchase_order0 = await PurchaseOrders.findOne({
                    offset: Math.floor(Math.random() * (await PurchaseOrders.count())),
                });
                const PurchaseOrderLine0 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PurchaseOrderLine0?.setPurchase_order)
                {
                    await
                    PurchaseOrderLine0.
                    setPurchase_order(relatedPurchase_order0);
                }
            
                const relatedPurchase_order1 = await PurchaseOrders.findOne({
                    offset: Math.floor(Math.random() * (await PurchaseOrders.count())),
                });
                const PurchaseOrderLine1 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PurchaseOrderLine1?.setPurchase_order)
                {
                    await
                    PurchaseOrderLine1.
                    setPurchase_order(relatedPurchase_order1);
                }
            
                const relatedPurchase_order2 = await PurchaseOrders.findOne({
                    offset: Math.floor(Math.random() * (await PurchaseOrders.count())),
                });
                const PurchaseOrderLine2 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PurchaseOrderLine2?.setPurchase_order)
                {
                    await
                    PurchaseOrderLine2.
                    setPurchase_order(relatedPurchase_order2);
                }
            
        }
        
    
        
            
            async function associatePurchaseOrderLineWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const PurchaseOrderLine0 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PurchaseOrderLine0?.setItem)
                {
                    await
                    PurchaseOrderLine0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const PurchaseOrderLine1 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PurchaseOrderLine1?.setItem)
                {
                    await
                    PurchaseOrderLine1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const PurchaseOrderLine2 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PurchaseOrderLine2?.setItem)
                {
                    await
                    PurchaseOrderLine2.
                    setItem(relatedItem2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associatePurchaseOrderLineWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const PurchaseOrderLine0 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PurchaseOrderLine0?.setOrganization)
                {
                    await
                    PurchaseOrderLine0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const PurchaseOrderLine1 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PurchaseOrderLine1?.setOrganization)
                {
                    await
                    PurchaseOrderLine1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const PurchaseOrderLine2 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PurchaseOrderLine2?.setOrganization)
                {
                    await
                    PurchaseOrderLine2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateReceiptWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Receipt0 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Receipt0?.setTenant)
                {
                    await
                    Receipt0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Receipt1 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Receipt1?.setTenant)
                {
                    await
                    Receipt1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Receipt2 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Receipt2?.setTenant)
                {
                    await
                    Receipt2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
    
        
            
            async function associateReceiptWithPurchase_order() {
            
                const relatedPurchase_order0 = await PurchaseOrders.findOne({
                    offset: Math.floor(Math.random() * (await PurchaseOrders.count())),
                });
                const Receipt0 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Receipt0?.setPurchase_order)
                {
                    await
                    Receipt0.
                    setPurchase_order(relatedPurchase_order0);
                }
            
                const relatedPurchase_order1 = await PurchaseOrders.findOne({
                    offset: Math.floor(Math.random() * (await PurchaseOrders.count())),
                });
                const Receipt1 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Receipt1?.setPurchase_order)
                {
                    await
                    Receipt1.
                    setPurchase_order(relatedPurchase_order1);
                }
            
                const relatedPurchase_order2 = await PurchaseOrders.findOne({
                    offset: Math.floor(Math.random() * (await PurchaseOrders.count())),
                });
                const Receipt2 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Receipt2?.setPurchase_order)
                {
                    await
                    Receipt2.
                    setPurchase_order(relatedPurchase_order2);
                }
            
        }
        
    
        
            
            async function associateReceiptWithReceived_into_location() {
            
                const relatedReceived_into_location0 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Receipt0 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Receipt0?.setReceived_into_location)
                {
                    await
                    Receipt0.
                    setReceived_into_location(relatedReceived_into_location0);
                }
            
                const relatedReceived_into_location1 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Receipt1 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Receipt1?.setReceived_into_location)
                {
                    await
                    Receipt1.
                    setReceived_into_location(relatedReceived_into_location1);
                }
            
                const relatedReceived_into_location2 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Receipt2 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Receipt2?.setReceived_into_location)
                {
                    await
                    Receipt2.
                    setReceived_into_location(relatedReceived_into_location2);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateReceiptWithReceived_by() {
            
                const relatedReceived_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Receipt0 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Receipt0?.setReceived_by)
                {
                    await
                    Receipt0.
                    setReceived_by(relatedReceived_by0);
                }
            
                const relatedReceived_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Receipt1 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Receipt1?.setReceived_by)
                {
                    await
                    Receipt1.
                    setReceived_by(relatedReceived_by1);
                }
            
                const relatedReceived_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Receipt2 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Receipt2?.setReceived_by)
                {
                    await
                    Receipt2.
                    setReceived_by(relatedReceived_by2);
                }
            
        }
        
    
        
    
        
            // Similar logic for "relation_many"
        
    
        
            
            async function associateReceiptWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Receipt0 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Receipt0?.setOrganization)
                {
                    await
                    Receipt0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Receipt1 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Receipt1?.setOrganization)
                {
                    await
                    Receipt1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Receipt2 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Receipt2?.setOrganization)
                {
                    await
                    Receipt2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateReceiptLineWithReceipt() {
            
                const relatedReceipt0 = await Receipts.findOne({
                    offset: Math.floor(Math.random() * (await Receipts.count())),
                });
                const ReceiptLine0 = await ReceiptLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ReceiptLine0?.setReceipt)
                {
                    await
                    ReceiptLine0.
                    setReceipt(relatedReceipt0);
                }
            
                const relatedReceipt1 = await Receipts.findOne({
                    offset: Math.floor(Math.random() * (await Receipts.count())),
                });
                const ReceiptLine1 = await ReceiptLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ReceiptLine1?.setReceipt)
                {
                    await
                    ReceiptLine1.
                    setReceipt(relatedReceipt1);
                }
            
                const relatedReceipt2 = await Receipts.findOne({
                    offset: Math.floor(Math.random() * (await Receipts.count())),
                });
                const ReceiptLine2 = await ReceiptLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ReceiptLine2?.setReceipt)
                {
                    await
                    ReceiptLine2.
                    setReceipt(relatedReceipt2);
                }
            
        }
        
    
        
            
            async function associateReceiptLineWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const ReceiptLine0 = await ReceiptLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ReceiptLine0?.setItem)
                {
                    await
                    ReceiptLine0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const ReceiptLine1 = await ReceiptLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ReceiptLine1?.setItem)
                {
                    await
                    ReceiptLine1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const ReceiptLine2 = await ReceiptLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ReceiptLine2?.setItem)
                {
                    await
                    ReceiptLine2.
                    setItem(relatedItem2);
                }
            
        }
        
    
        
    
        
            
            async function associateReceiptLineWithLot() {
            
                const relatedLot0 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const ReceiptLine0 = await ReceiptLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ReceiptLine0?.setLot)
                {
                    await
                    ReceiptLine0.
                    setLot(relatedLot0);
                }
            
                const relatedLot1 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const ReceiptLine1 = await ReceiptLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ReceiptLine1?.setLot)
                {
                    await
                    ReceiptLine1.
                    setLot(relatedLot1);
                }
            
                const relatedLot2 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const ReceiptLine2 = await ReceiptLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ReceiptLine2?.setLot)
                {
                    await
                    ReceiptLine2.
                    setLot(relatedLot2);
                }
            
        }
        
    
        
            
            async function associateReceiptLineWithSerial_number() {
            
                const relatedSerial_number0 = await SerialNumbers.findOne({
                    offset: Math.floor(Math.random() * (await SerialNumbers.count())),
                });
                const ReceiptLine0 = await ReceiptLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ReceiptLine0?.setSerial_number)
                {
                    await
                    ReceiptLine0.
                    setSerial_number(relatedSerial_number0);
                }
            
                const relatedSerial_number1 = await SerialNumbers.findOne({
                    offset: Math.floor(Math.random() * (await SerialNumbers.count())),
                });
                const ReceiptLine1 = await ReceiptLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ReceiptLine1?.setSerial_number)
                {
                    await
                    ReceiptLine1.
                    setSerial_number(relatedSerial_number1);
                }
            
                const relatedSerial_number2 = await SerialNumbers.findOne({
                    offset: Math.floor(Math.random() * (await SerialNumbers.count())),
                });
                const ReceiptLine2 = await ReceiptLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ReceiptLine2?.setSerial_number)
                {
                    await
                    ReceiptLine2.
                    setSerial_number(relatedSerial_number2);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateReceiptLineWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ReceiptLine0 = await ReceiptLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ReceiptLine0?.setOrganization)
                {
                    await
                    ReceiptLine0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ReceiptLine1 = await ReceiptLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ReceiptLine1?.setOrganization)
                {
                    await
                    ReceiptLine1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ReceiptLine2 = await ReceiptLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ReceiptLine2?.setOrganization)
                {
                    await
                    ReceiptLine2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateVendorBillWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const VendorBill0 = await VendorBills.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (VendorBill0?.setTenant)
                {
                    await
                    VendorBill0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const VendorBill1 = await VendorBills.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (VendorBill1?.setTenant)
                {
                    await
                    VendorBill1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const VendorBill2 = await VendorBills.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (VendorBill2?.setTenant)
                {
                    await
                    VendorBill2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
    
        
            
            async function associateVendorBillWithSupplier() {
            
                const relatedSupplier0 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const VendorBill0 = await VendorBills.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (VendorBill0?.setSupplier)
                {
                    await
                    VendorBill0.
                    setSupplier(relatedSupplier0);
                }
            
                const relatedSupplier1 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const VendorBill1 = await VendorBills.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (VendorBill1?.setSupplier)
                {
                    await
                    VendorBill1.
                    setSupplier(relatedSupplier1);
                }
            
                const relatedSupplier2 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const VendorBill2 = await VendorBills.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (VendorBill2?.setSupplier)
                {
                    await
                    VendorBill2.
                    setSupplier(relatedSupplier2);
                }
            
        }
        
    
        
            
            async function associateVendorBillWithPurchase_order() {
            
                const relatedPurchase_order0 = await PurchaseOrders.findOne({
                    offset: Math.floor(Math.random() * (await PurchaseOrders.count())),
                });
                const VendorBill0 = await VendorBills.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (VendorBill0?.setPurchase_order)
                {
                    await
                    VendorBill0.
                    setPurchase_order(relatedPurchase_order0);
                }
            
                const relatedPurchase_order1 = await PurchaseOrders.findOne({
                    offset: Math.floor(Math.random() * (await PurchaseOrders.count())),
                });
                const VendorBill1 = await VendorBills.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (VendorBill1?.setPurchase_order)
                {
                    await
                    VendorBill1.
                    setPurchase_order(relatedPurchase_order1);
                }
            
                const relatedPurchase_order2 = await PurchaseOrders.findOne({
                    offset: Math.floor(Math.random() * (await PurchaseOrders.count())),
                });
                const VendorBill2 = await VendorBills.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (VendorBill2?.setPurchase_order)
                {
                    await
                    VendorBill2.
                    setPurchase_order(relatedPurchase_order2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    
        
            
            async function associateVendorBillWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const VendorBill0 = await VendorBills.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (VendorBill0?.setOrganization)
                {
                    await
                    VendorBill0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const VendorBill1 = await VendorBills.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (VendorBill1?.setOrganization)
                {
                    await
                    VendorBill1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const VendorBill2 = await VendorBills.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (VendorBill2?.setOrganization)
                {
                    await
                    VendorBill2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateVendorBillLineWithVendor_bill() {
            
                const relatedVendor_bill0 = await VendorBills.findOne({
                    offset: Math.floor(Math.random() * (await VendorBills.count())),
                });
                const VendorBillLine0 = await VendorBillLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (VendorBillLine0?.setVendor_bill)
                {
                    await
                    VendorBillLine0.
                    setVendor_bill(relatedVendor_bill0);
                }
            
                const relatedVendor_bill1 = await VendorBills.findOne({
                    offset: Math.floor(Math.random() * (await VendorBills.count())),
                });
                const VendorBillLine1 = await VendorBillLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (VendorBillLine1?.setVendor_bill)
                {
                    await
                    VendorBillLine1.
                    setVendor_bill(relatedVendor_bill1);
                }
            
                const relatedVendor_bill2 = await VendorBills.findOne({
                    offset: Math.floor(Math.random() * (await VendorBills.count())),
                });
                const VendorBillLine2 = await VendorBillLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (VendorBillLine2?.setVendor_bill)
                {
                    await
                    VendorBillLine2.
                    setVendor_bill(relatedVendor_bill2);
                }
            
        }
        
    
        
            
            async function associateVendorBillLineWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const VendorBillLine0 = await VendorBillLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (VendorBillLine0?.setItem)
                {
                    await
                    VendorBillLine0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const VendorBillLine1 = await VendorBillLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (VendorBillLine1?.setItem)
                {
                    await
                    VendorBillLine1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const VendorBillLine2 = await VendorBillLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (VendorBillLine2?.setItem)
                {
                    await
                    VendorBillLine2.
                    setItem(relatedItem2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateVendorBillLineWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const VendorBillLine0 = await VendorBillLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (VendorBillLine0?.setOrganization)
                {
                    await
                    VendorBillLine0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const VendorBillLine1 = await VendorBillLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (VendorBillLine1?.setOrganization)
                {
                    await
                    VendorBillLine1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const VendorBillLine2 = await VendorBillLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (VendorBillLine2?.setOrganization)
                {
                    await
                    VendorBillLine2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateChartOfAccountWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const ChartOfAccount0 = await ChartOfAccounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ChartOfAccount0?.setTenant)
                {
                    await
                    ChartOfAccount0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const ChartOfAccount1 = await ChartOfAccounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ChartOfAccount1?.setTenant)
                {
                    await
                    ChartOfAccount1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const ChartOfAccount2 = await ChartOfAccounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ChartOfAccount2?.setTenant)
                {
                    await
                    ChartOfAccount2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateChartOfAccountWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ChartOfAccount0 = await ChartOfAccounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ChartOfAccount0?.setOrganization)
                {
                    await
                    ChartOfAccount0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ChartOfAccount1 = await ChartOfAccounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ChartOfAccount1?.setOrganization)
                {
                    await
                    ChartOfAccount1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ChartOfAccount2 = await ChartOfAccounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ChartOfAccount2?.setOrganization)
                {
                    await
                    ChartOfAccount2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateFiscalPeriodWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const FiscalPeriod0 = await FiscalPeriods.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (FiscalPeriod0?.setTenant)
                {
                    await
                    FiscalPeriod0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const FiscalPeriod1 = await FiscalPeriods.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (FiscalPeriod1?.setTenant)
                {
                    await
                    FiscalPeriod1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const FiscalPeriod2 = await FiscalPeriods.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (FiscalPeriod2?.setTenant)
                {
                    await
                    FiscalPeriod2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateFiscalPeriodWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const FiscalPeriod0 = await FiscalPeriods.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (FiscalPeriod0?.setOrganization)
                {
                    await
                    FiscalPeriod0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const FiscalPeriod1 = await FiscalPeriods.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (FiscalPeriod1?.setOrganization)
                {
                    await
                    FiscalPeriod1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const FiscalPeriod2 = await FiscalPeriods.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (FiscalPeriod2?.setOrganization)
                {
                    await
                    FiscalPeriod2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateJournalEntryWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const JournalEntry0 = await JournalEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (JournalEntry0?.setTenant)
                {
                    await
                    JournalEntry0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const JournalEntry1 = await JournalEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (JournalEntry1?.setTenant)
                {
                    await
                    JournalEntry1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const JournalEntry2 = await JournalEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (JournalEntry2?.setTenant)
                {
                    await
                    JournalEntry2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateJournalEntryWithFiscal_period() {
            
                const relatedFiscal_period0 = await FiscalPeriods.findOne({
                    offset: Math.floor(Math.random() * (await FiscalPeriods.count())),
                });
                const JournalEntry0 = await JournalEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (JournalEntry0?.setFiscal_period)
                {
                    await
                    JournalEntry0.
                    setFiscal_period(relatedFiscal_period0);
                }
            
                const relatedFiscal_period1 = await FiscalPeriods.findOne({
                    offset: Math.floor(Math.random() * (await FiscalPeriods.count())),
                });
                const JournalEntry1 = await JournalEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (JournalEntry1?.setFiscal_period)
                {
                    await
                    JournalEntry1.
                    setFiscal_period(relatedFiscal_period1);
                }
            
                const relatedFiscal_period2 = await FiscalPeriods.findOne({
                    offset: Math.floor(Math.random() * (await FiscalPeriods.count())),
                });
                const JournalEntry2 = await JournalEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (JournalEntry2?.setFiscal_period)
                {
                    await
                    JournalEntry2.
                    setFiscal_period(relatedFiscal_period2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateJournalEntryWithCreated_by_user() {
            
                const relatedCreated_by_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const JournalEntry0 = await JournalEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (JournalEntry0?.setCreated_by_user)
                {
                    await
                    JournalEntry0.
                    setCreated_by_user(relatedCreated_by_user0);
                }
            
                const relatedCreated_by_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const JournalEntry1 = await JournalEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (JournalEntry1?.setCreated_by_user)
                {
                    await
                    JournalEntry1.
                    setCreated_by_user(relatedCreated_by_user1);
                }
            
                const relatedCreated_by_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const JournalEntry2 = await JournalEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (JournalEntry2?.setCreated_by_user)
                {
                    await
                    JournalEntry2.
                    setCreated_by_user(relatedCreated_by_user2);
                }
            
        }
        
    
        
    
        
            // Similar logic for "relation_many"
        
    
        
            
            async function associateJournalEntryWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const JournalEntry0 = await JournalEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (JournalEntry0?.setOrganization)
                {
                    await
                    JournalEntry0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const JournalEntry1 = await JournalEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (JournalEntry1?.setOrganization)
                {
                    await
                    JournalEntry1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const JournalEntry2 = await JournalEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (JournalEntry2?.setOrganization)
                {
                    await
                    JournalEntry2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateJournalLineWithJournal_entry() {
            
                const relatedJournal_entry0 = await JournalEntries.findOne({
                    offset: Math.floor(Math.random() * (await JournalEntries.count())),
                });
                const JournalLine0 = await JournalLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (JournalLine0?.setJournal_entry)
                {
                    await
                    JournalLine0.
                    setJournal_entry(relatedJournal_entry0);
                }
            
                const relatedJournal_entry1 = await JournalEntries.findOne({
                    offset: Math.floor(Math.random() * (await JournalEntries.count())),
                });
                const JournalLine1 = await JournalLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (JournalLine1?.setJournal_entry)
                {
                    await
                    JournalLine1.
                    setJournal_entry(relatedJournal_entry1);
                }
            
                const relatedJournal_entry2 = await JournalEntries.findOne({
                    offset: Math.floor(Math.random() * (await JournalEntries.count())),
                });
                const JournalLine2 = await JournalLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (JournalLine2?.setJournal_entry)
                {
                    await
                    JournalLine2.
                    setJournal_entry(relatedJournal_entry2);
                }
            
        }
        
    
        
            
            async function associateJournalLineWithAccount() {
            
                const relatedAccount0 = await ChartOfAccounts.findOne({
                    offset: Math.floor(Math.random() * (await ChartOfAccounts.count())),
                });
                const JournalLine0 = await JournalLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (JournalLine0?.setAccount)
                {
                    await
                    JournalLine0.
                    setAccount(relatedAccount0);
                }
            
                const relatedAccount1 = await ChartOfAccounts.findOne({
                    offset: Math.floor(Math.random() * (await ChartOfAccounts.count())),
                });
                const JournalLine1 = await JournalLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (JournalLine1?.setAccount)
                {
                    await
                    JournalLine1.
                    setAccount(relatedAccount1);
                }
            
                const relatedAccount2 = await ChartOfAccounts.findOne({
                    offset: Math.floor(Math.random() * (await ChartOfAccounts.count())),
                });
                const JournalLine2 = await JournalLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (JournalLine2?.setAccount)
                {
                    await
                    JournalLine2.
                    setAccount(relatedAccount2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateJournalLineWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const JournalLine0 = await JournalLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (JournalLine0?.setOrganization)
                {
                    await
                    JournalLine0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const JournalLine1 = await JournalLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (JournalLine1?.setOrganization)
                {
                    await
                    JournalLine1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const JournalLine2 = await JournalLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (JournalLine2?.setOrganization)
                {
                    await
                    JournalLine2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associatePaymentWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Payment0 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payment0?.setTenant)
                {
                    await
                    Payment0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Payment1 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payment1?.setTenant)
                {
                    await
                    Payment1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Payment2 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payment2?.setTenant)
                {
                    await
                    Payment2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
    
        
    
        
    
        
            
            async function associatePaymentWithCustomer() {
            
                const relatedCustomer0 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Payment0 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payment0?.setCustomer)
                {
                    await
                    Payment0.
                    setCustomer(relatedCustomer0);
                }
            
                const relatedCustomer1 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Payment1 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payment1?.setCustomer)
                {
                    await
                    Payment1.
                    setCustomer(relatedCustomer1);
                }
            
                const relatedCustomer2 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Payment2 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payment2?.setCustomer)
                {
                    await
                    Payment2.
                    setCustomer(relatedCustomer2);
                }
            
        }
        
    
        
            
            async function associatePaymentWithSupplier() {
            
                const relatedSupplier0 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const Payment0 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payment0?.setSupplier)
                {
                    await
                    Payment0.
                    setSupplier(relatedSupplier0);
                }
            
                const relatedSupplier1 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const Payment1 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payment1?.setSupplier)
                {
                    await
                    Payment1.
                    setSupplier(relatedSupplier1);
                }
            
                const relatedSupplier2 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const Payment2 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payment2?.setSupplier)
                {
                    await
                    Payment2.
                    setSupplier(relatedSupplier2);
                }
            
        }
        
    
        
            
            async function associatePaymentWithInvoice() {
            
                const relatedInvoice0 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const Payment0 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payment0?.setInvoice)
                {
                    await
                    Payment0.
                    setInvoice(relatedInvoice0);
                }
            
                const relatedInvoice1 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const Payment1 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payment1?.setInvoice)
                {
                    await
                    Payment1.
                    setInvoice(relatedInvoice1);
                }
            
                const relatedInvoice2 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const Payment2 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payment2?.setInvoice)
                {
                    await
                    Payment2.
                    setInvoice(relatedInvoice2);
                }
            
        }
        
    
        
            
            async function associatePaymentWithVendor_bill() {
            
                const relatedVendor_bill0 = await VendorBills.findOne({
                    offset: Math.floor(Math.random() * (await VendorBills.count())),
                });
                const Payment0 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payment0?.setVendor_bill)
                {
                    await
                    Payment0.
                    setVendor_bill(relatedVendor_bill0);
                }
            
                const relatedVendor_bill1 = await VendorBills.findOne({
                    offset: Math.floor(Math.random() * (await VendorBills.count())),
                });
                const Payment1 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payment1?.setVendor_bill)
                {
                    await
                    Payment1.
                    setVendor_bill(relatedVendor_bill1);
                }
            
                const relatedVendor_bill2 = await VendorBills.findOne({
                    offset: Math.floor(Math.random() * (await VendorBills.count())),
                });
                const Payment2 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payment2?.setVendor_bill)
                {
                    await
                    Payment2.
                    setVendor_bill(relatedVendor_bill2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associatePaymentWithPosted_journal_entry() {
            
                const relatedPosted_journal_entry0 = await JournalEntries.findOne({
                    offset: Math.floor(Math.random() * (await JournalEntries.count())),
                });
                const Payment0 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payment0?.setPosted_journal_entry)
                {
                    await
                    Payment0.
                    setPosted_journal_entry(relatedPosted_journal_entry0);
                }
            
                const relatedPosted_journal_entry1 = await JournalEntries.findOne({
                    offset: Math.floor(Math.random() * (await JournalEntries.count())),
                });
                const Payment1 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payment1?.setPosted_journal_entry)
                {
                    await
                    Payment1.
                    setPosted_journal_entry(relatedPosted_journal_entry1);
                }
            
                const relatedPosted_journal_entry2 = await JournalEntries.findOne({
                    offset: Math.floor(Math.random() * (await JournalEntries.count())),
                });
                const Payment2 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payment2?.setPosted_journal_entry)
                {
                    await
                    Payment2.
                    setPosted_journal_entry(relatedPosted_journal_entry2);
                }
            
        }
        
    
        
            
            async function associatePaymentWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Payment0 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payment0?.setOrganization)
                {
                    await
                    Payment0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Payment1 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payment1?.setOrganization)
                {
                    await
                    Payment1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Payment2 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payment2?.setOrganization)
                {
                    await
                    Payment2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateTaxRateWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const TaxRate0 = await TaxRates.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (TaxRate0?.setTenant)
                {
                    await
                    TaxRate0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const TaxRate1 = await TaxRates.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (TaxRate1?.setTenant)
                {
                    await
                    TaxRate1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const TaxRate2 = await TaxRates.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (TaxRate2?.setTenant)
                {
                    await
                    TaxRate2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateTaxRateWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const TaxRate0 = await TaxRates.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (TaxRate0?.setOrganization)
                {
                    await
                    TaxRate0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const TaxRate1 = await TaxRates.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (TaxRate1?.setOrganization)
                {
                    await
                    TaxRate1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const TaxRate2 = await TaxRates.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (TaxRate2?.setOrganization)
                {
                    await
                    TaxRate2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateWebhookWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Webhook0 = await Webhooks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Webhook0?.setTenant)
                {
                    await
                    Webhook0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Webhook1 = await Webhooks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Webhook1?.setTenant)
                {
                    await
                    Webhook1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Webhook2 = await Webhooks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Webhook2?.setTenant)
                {
                    await
                    Webhook2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    
        
            
            async function associateWebhookWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Webhook0 = await Webhooks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Webhook0?.setOrganization)
                {
                    await
                    Webhook0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Webhook1 = await Webhooks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Webhook1?.setOrganization)
                {
                    await
                    Webhook1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Webhook2 = await Webhooks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Webhook2?.setOrganization)
                {
                    await
                    Webhook2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateWebhookSubscriptionWithWebhook() {
            
                const relatedWebhook0 = await Webhooks.findOne({
                    offset: Math.floor(Math.random() * (await Webhooks.count())),
                });
                const WebhookSubscription0 = await WebhookSubscriptions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (WebhookSubscription0?.setWebhook)
                {
                    await
                    WebhookSubscription0.
                    setWebhook(relatedWebhook0);
                }
            
                const relatedWebhook1 = await Webhooks.findOne({
                    offset: Math.floor(Math.random() * (await Webhooks.count())),
                });
                const WebhookSubscription1 = await WebhookSubscriptions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (WebhookSubscription1?.setWebhook)
                {
                    await
                    WebhookSubscription1.
                    setWebhook(relatedWebhook1);
                }
            
                const relatedWebhook2 = await Webhooks.findOne({
                    offset: Math.floor(Math.random() * (await Webhooks.count())),
                });
                const WebhookSubscription2 = await WebhookSubscriptions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (WebhookSubscription2?.setWebhook)
                {
                    await
                    WebhookSubscription2.
                    setWebhook(relatedWebhook2);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateWebhookSubscriptionWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const WebhookSubscription0 = await WebhookSubscriptions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (WebhookSubscription0?.setOrganization)
                {
                    await
                    WebhookSubscription0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const WebhookSubscription1 = await WebhookSubscriptions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (WebhookSubscription1?.setOrganization)
                {
                    await
                    WebhookSubscription1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const WebhookSubscription2 = await WebhookSubscriptions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (WebhookSubscription2?.setOrganization)
                {
                    await
                    WebhookSubscription2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateWebhookDeliveryWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const WebhookDelivery0 = await WebhookDeliveries.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (WebhookDelivery0?.setTenant)
                {
                    await
                    WebhookDelivery0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const WebhookDelivery1 = await WebhookDeliveries.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (WebhookDelivery1?.setTenant)
                {
                    await
                    WebhookDelivery1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const WebhookDelivery2 = await WebhookDeliveries.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (WebhookDelivery2?.setTenant)
                {
                    await
                    WebhookDelivery2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
            
            async function associateWebhookDeliveryWithWebhook() {
            
                const relatedWebhook0 = await Webhooks.findOne({
                    offset: Math.floor(Math.random() * (await Webhooks.count())),
                });
                const WebhookDelivery0 = await WebhookDeliveries.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (WebhookDelivery0?.setWebhook)
                {
                    await
                    WebhookDelivery0.
                    setWebhook(relatedWebhook0);
                }
            
                const relatedWebhook1 = await Webhooks.findOne({
                    offset: Math.floor(Math.random() * (await Webhooks.count())),
                });
                const WebhookDelivery1 = await WebhookDeliveries.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (WebhookDelivery1?.setWebhook)
                {
                    await
                    WebhookDelivery1.
                    setWebhook(relatedWebhook1);
                }
            
                const relatedWebhook2 = await Webhooks.findOne({
                    offset: Math.floor(Math.random() * (await Webhooks.count())),
                });
                const WebhookDelivery2 = await WebhookDeliveries.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (WebhookDelivery2?.setWebhook)
                {
                    await
                    WebhookDelivery2.
                    setWebhook(relatedWebhook2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateWebhookDeliveryWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const WebhookDelivery0 = await WebhookDeliveries.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (WebhookDelivery0?.setOrganization)
                {
                    await
                    WebhookDelivery0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const WebhookDelivery1 = await WebhookDeliveries.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (WebhookDelivery1?.setOrganization)
                {
                    await
                    WebhookDelivery1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const WebhookDelivery2 = await WebhookDeliveries.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (WebhookDelivery2?.setOrganization)
                {
                    await
                    WebhookDelivery2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateEmailNotificationWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const EmailNotification0 = await EmailNotifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (EmailNotification0?.setTenant)
                {
                    await
                    EmailNotification0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const EmailNotification1 = await EmailNotifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (EmailNotification1?.setTenant)
                {
                    await
                    EmailNotification1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const EmailNotification2 = await EmailNotifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (EmailNotification2?.setTenant)
                {
                    await
                    EmailNotification2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
            
            async function associateEmailNotificationWithRecipient() {
            
                const relatedRecipient0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const EmailNotification0 = await EmailNotifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (EmailNotification0?.setRecipient)
                {
                    await
                    EmailNotification0.
                    setRecipient(relatedRecipient0);
                }
            
                const relatedRecipient1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const EmailNotification1 = await EmailNotifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (EmailNotification1?.setRecipient)
                {
                    await
                    EmailNotification1.
                    setRecipient(relatedRecipient1);
                }
            
                const relatedRecipient2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const EmailNotification2 = await EmailNotifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (EmailNotification2?.setRecipient)
                {
                    await
                    EmailNotification2.
                    setRecipient(relatedRecipient2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateEmailNotificationWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EmailNotification0 = await EmailNotifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (EmailNotification0?.setOrganization)
                {
                    await
                    EmailNotification0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EmailNotification1 = await EmailNotifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (EmailNotification1?.setOrganization)
                {
                    await
                    EmailNotification1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EmailNotification2 = await EmailNotifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (EmailNotification2?.setOrganization)
                {
                    await
                    EmailNotification2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateCsvImportJobWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const CsvImportJob0 = await CsvImportJobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CsvImportJob0?.setTenant)
                {
                    await
                    CsvImportJob0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const CsvImportJob1 = await CsvImportJobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CsvImportJob1?.setTenant)
                {
                    await
                    CsvImportJob1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const CsvImportJob2 = await CsvImportJobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CsvImportJob2?.setTenant)
                {
                    await
                    CsvImportJob2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateCsvImportJobWithRequested_by() {
            
                const relatedRequested_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CsvImportJob0 = await CsvImportJobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CsvImportJob0?.setRequested_by)
                {
                    await
                    CsvImportJob0.
                    setRequested_by(relatedRequested_by0);
                }
            
                const relatedRequested_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CsvImportJob1 = await CsvImportJobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CsvImportJob1?.setRequested_by)
                {
                    await
                    CsvImportJob1.
                    setRequested_by(relatedRequested_by1);
                }
            
                const relatedRequested_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CsvImportJob2 = await CsvImportJobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CsvImportJob2?.setRequested_by)
                {
                    await
                    CsvImportJob2.
                    setRequested_by(relatedRequested_by2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateCsvImportJobWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CsvImportJob0 = await CsvImportJobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CsvImportJob0?.setOrganization)
                {
                    await
                    CsvImportJob0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CsvImportJob1 = await CsvImportJobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CsvImportJob1?.setOrganization)
                {
                    await
                    CsvImportJob1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CsvImportJob2 = await CsvImportJobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CsvImportJob2?.setOrganization)
                {
                    await
                    CsvImportJob2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateReportWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Report0 = await Reports.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Report0?.setTenant)
                {
                    await
                    Report0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Report1 = await Reports.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Report1?.setTenant)
                {
                    await
                    Report1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Report2 = await Reports.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Report2?.setTenant)
                {
                    await
                    Report2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateReportWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Report0 = await Reports.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Report0?.setOrganization)
                {
                    await
                    Report0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Report1 = await Reports.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Report1?.setOrganization)
                {
                    await
                    Report1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Report2 = await Reports.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Report2?.setOrganization)
                {
                    await
                    Report2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateDashboardWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Dashboard0 = await Dashboards.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Dashboard0?.setTenant)
                {
                    await
                    Dashboard0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Dashboard1 = await Dashboards.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Dashboard1?.setTenant)
                {
                    await
                    Dashboard1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Dashboard2 = await Dashboards.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Dashboard2?.setTenant)
                {
                    await
                    Dashboard2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateDashboardWithOwner() {
            
                const relatedOwner0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Dashboard0 = await Dashboards.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Dashboard0?.setOwner)
                {
                    await
                    Dashboard0.
                    setOwner(relatedOwner0);
                }
            
                const relatedOwner1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Dashboard1 = await Dashboards.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Dashboard1?.setOwner)
                {
                    await
                    Dashboard1.
                    setOwner(relatedOwner1);
                }
            
                const relatedOwner2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Dashboard2 = await Dashboards.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Dashboard2?.setOwner)
                {
                    await
                    Dashboard2.
                    setOwner(relatedOwner2);
                }
            
        }
        
    
        
            // Similar logic for "relation_many"
        
    
        
            
            async function associateDashboardWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Dashboard0 = await Dashboards.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Dashboard0?.setOrganization)
                {
                    await
                    Dashboard0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Dashboard1 = await Dashboards.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Dashboard1?.setOrganization)
                {
                    await
                    Dashboard1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Dashboard2 = await Dashboards.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Dashboard2?.setOrganization)
                {
                    await
                    Dashboard2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateDashboardWidgetWithDashboard() {
            
                const relatedDashboard0 = await Dashboards.findOne({
                    offset: Math.floor(Math.random() * (await Dashboards.count())),
                });
                const DashboardWidget0 = await DashboardWidgets.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (DashboardWidget0?.setDashboard)
                {
                    await
                    DashboardWidget0.
                    setDashboard(relatedDashboard0);
                }
            
                const relatedDashboard1 = await Dashboards.findOne({
                    offset: Math.floor(Math.random() * (await Dashboards.count())),
                });
                const DashboardWidget1 = await DashboardWidgets.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (DashboardWidget1?.setDashboard)
                {
                    await
                    DashboardWidget1.
                    setDashboard(relatedDashboard1);
                }
            
                const relatedDashboard2 = await Dashboards.findOne({
                    offset: Math.floor(Math.random() * (await Dashboards.count())),
                });
                const DashboardWidget2 = await DashboardWidgets.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (DashboardWidget2?.setDashboard)
                {
                    await
                    DashboardWidget2.
                    setDashboard(relatedDashboard2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateDashboardWidgetWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const DashboardWidget0 = await DashboardWidgets.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (DashboardWidget0?.setOrganization)
                {
                    await
                    DashboardWidget0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const DashboardWidget1 = await DashboardWidgets.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (DashboardWidget1?.setOrganization)
                {
                    await
                    DashboardWidget1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const DashboardWidget2 = await DashboardWidgets.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (DashboardWidget2?.setOrganization)
                {
                    await
                    DashboardWidget2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    


module.exports = {
    up: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
                
                await Organizations.bulkCreate(OrganizationsData);
                
            
            
                
                await Tenants.bulkCreate(TenantsData);
                
            
            
                
                await Memberships.bulkCreate(MembershipsData);
                
            
            
                
                await RoleAssignments.bulkCreate(RoleAssignmentsData);
                
            
            
                
                await ApprovalWorkflows.bulkCreate(ApprovalWorkflowsData);
                
            
            
                
                await ApprovalSteps.bulkCreate(ApprovalStepsData);
                
            
            
                
                await ApprovalRequests.bulkCreate(ApprovalRequestsData);
                
            
            
                
                await ApprovalDecisions.bulkCreate(ApprovalDecisionsData);
                
            
            
                
                await Companies.bulkCreate(CompaniesData);
                
            
            
                
                await Customers.bulkCreate(CustomersData);
                
            
            
                
                await Suppliers.bulkCreate(SuppliersData);
                
            
            
                
                await Uoms.bulkCreate(UomsData);
                
            
            
                
                await ItemCategories.bulkCreate(ItemCategoriesData);
                
            
            
                
                await Items.bulkCreate(ItemsData);
                
            
            
                
                await Warehouses.bulkCreate(WarehousesData);
                
            
            
                
                await Locations.bulkCreate(LocationsData);
                
            
            
                
                await Lots.bulkCreate(LotsData);
                
            
            
                
                await SerialNumbers.bulkCreate(SerialNumbersData);
                
            
            
                
                await InventoryTransfers.bulkCreate(InventoryTransfersData);
                
            
            
                
                await InventoryTransferLines.bulkCreate(InventoryTransferLinesData);
                
            
            
                
                await StockMovements.bulkCreate(StockMovementsData);
                
            
            
                
                await Quotations.bulkCreate(QuotationsData);
                
            
            
                
                await QuotationLines.bulkCreate(QuotationLinesData);
                
            
            
                
                await SalesOrders.bulkCreate(SalesOrdersData);
                
            
            
                
                await SalesOrderLines.bulkCreate(SalesOrderLinesData);
                
            
            
                
                await SalesAllocations.bulkCreate(SalesAllocationsData);
                
            
            
                
                await Invoices.bulkCreate(InvoicesData);
                
            
            
                
                await InvoiceLines.bulkCreate(InvoiceLinesData);
                
            
            
                
                await CustomerReturns.bulkCreate(CustomerReturnsData);
                
            
            
                
                await CustomerReturnLines.bulkCreate(CustomerReturnLinesData);
                
            
            
                
                await PurchaseOrders.bulkCreate(PurchaseOrdersData);
                
            
            
                
                await PurchaseOrderLines.bulkCreate(PurchaseOrderLinesData);
                
            
            
                
                await Receipts.bulkCreate(ReceiptsData);
                
            
            
                
                await ReceiptLines.bulkCreate(ReceiptLinesData);
                
            
            
                
                await VendorBills.bulkCreate(VendorBillsData);
                
            
            
                
                await VendorBillLines.bulkCreate(VendorBillLinesData);
                
            
            
                
                await ChartOfAccounts.bulkCreate(ChartOfAccountsData);
                
            
            
                
                await FiscalPeriods.bulkCreate(FiscalPeriodsData);
                
            
            
                
                await JournalEntries.bulkCreate(JournalEntriesData);
                
            
            
                
                await JournalLines.bulkCreate(JournalLinesData);
                
            
            
                
                await Payments.bulkCreate(PaymentsData);
                
            
            
                
                await TaxRates.bulkCreate(TaxRatesData);
                
            
            
                
                await Webhooks.bulkCreate(WebhooksData);
                
            
            
                
                await WebhookSubscriptions.bulkCreate(WebhookSubscriptionsData);
                
            
            
                
                await WebhookDeliveries.bulkCreate(WebhookDeliveriesData);
                
            
            
                
                await EmailNotifications.bulkCreate(EmailNotificationsData);
                
            
            
                
                await CsvImportJobs.bulkCreate(CsvImportJobsData);
                
            
            
                
                await Reports.bulkCreate(ReportsData);
                
            
            
                
                await Dashboards.bulkCreate(DashboardsData);
                
            
            
                
                await DashboardWidgets.bulkCreate(DashboardWidgetsData);
                
            
            await Promise.all([
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateUserWithOrganization(),
                    
                
            
                
                
                
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateTenantWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateMembershipWithTenant(),
                    
                
                    
                        
                        await associateMembershipWithUser(),
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateMembershipWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateRoleAssignmentWithMembership(),
                    
                
                    
                
                    
                
                    
                        
                        await associateRoleAssignmentWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateApprovalWorkflowWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateApprovalWorkflowWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateApprovalStepWithWorkflow(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateApprovalStepWithApprover_user(),
                    
                
                    
                
                    
                
                    
                        
                        await associateApprovalStepWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateApprovalRequestWithTenant(),
                    
                
                    
                
                    
                
                    
                        
                        await associateApprovalRequestWithWorkflow(),
                    
                
                    
                
                    
                        
                        await associateApprovalRequestWithRequested_by(),
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateApprovalRequestWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateApprovalDecisionWithRequest(),
                    
                
                    
                        
                        await associateApprovalDecisionWithDecided_by(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateApprovalDecisionWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateCompanyWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateCompanyWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateCustomerWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateCustomerWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateSupplierWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateSupplierWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateUomWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateUomWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateItemCategoryWithTenant(),
                    
                
                    
                
                    
                
                    
                        
                        await associateItemCategoryWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateItemWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateItemWithCategory(),
                    
                
                    
                        
                        await associateItemWithUom(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateItemWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateWarehousWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateWarehousWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateLocationWithWarehouse(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateLocationWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateLotWithTenant(),
                    
                
                    
                        
                        await associateLotWithItem(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateLotWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateSerialNumberWithTenant(),
                    
                
                    
                        
                        await associateSerialNumberWithItem(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateSerialNumberWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateInventoryTransferWithTenant(),
                    
                
                    
                
                    
                        
                        await associateInventoryTransferWithFrom_location(),
                    
                
                    
                        
                        await associateInventoryTransferWithTo_location(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateInventoryTransferWithRequested_by(),
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateInventoryTransferWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateInventoryTransferLineWithTransfer(),
                    
                
                    
                        
                        await associateInventoryTransferLineWithItem(),
                    
                
                    
                
                    
                        
                        await associateInventoryTransferLineWithLot(),
                    
                
                    
                        
                        await associateInventoryTransferLineWithSerial_number(),
                    
                
                    
                
                    
                        
                        await associateInventoryTransferLineWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateStockMovementWithTenant(),
                    
                
                    
                
                    
                        
                        await associateStockMovementWithItem(),
                    
                
                    
                        
                        await associateStockMovementWithFrom_location(),
                    
                
                    
                        
                        await associateStockMovementWithTo_location(),
                    
                
                    
                
                    
                        
                        await associateStockMovementWithLot(),
                    
                
                    
                        
                        await associateStockMovementWithSerial_number(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateStockMovementWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateQuotationWithTenant(),
                    
                
                    
                
                    
                        
                        await associateQuotationWithCustomer(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateQuotationWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateQuotationLineWithQuotation(),
                    
                
                    
                        
                        await associateQuotationLineWithItem(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateQuotationLineWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateSalesOrderWithTenant(),
                    
                
                    
                
                    
                        
                        await associateSalesOrderWithCustomer(),
                    
                
                    
                        
                        await associateSalesOrderWithQuotation(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateSalesOrderWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateSalesOrderLineWithSales_order(),
                    
                
                    
                        
                        await associateSalesOrderLineWithItem(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateSalesOrderLineWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateSalesAllocationWithSales_order_line(),
                    
                
                    
                        
                        await associateSalesAllocationWithLot(),
                    
                
                    
                        
                        await associateSalesAllocationWithSerial_number(),
                    
                
                    
                        
                        await associateSalesAllocationWithLocation(),
                    
                
                    
                
                    
                        
                        await associateSalesAllocationWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateInvoiceWithTenant(),
                    
                
                    
                
                    
                        
                        await associateInvoiceWithCustomer(),
                    
                
                    
                        
                        await associateInvoiceWithSales_order(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateInvoiceWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateInvoiceLineWithInvoice(),
                    
                
                    
                        
                        await associateInvoiceLineWithItem(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateInvoiceLineWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateCustomerReturnWithTenant(),
                    
                
                    
                
                    
                        
                        await associateCustomerReturnWithCustomer(),
                    
                
                    
                        
                        await associateCustomerReturnWithInvoice(),
                    
                
                    
                        
                        await associateCustomerReturnWithSales_order(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateCustomerReturnWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateCustomerReturnLineWithCustomer_return(),
                    
                
                    
                        
                        await associateCustomerReturnLineWithItem(),
                    
                
                    
                        
                        await associateCustomerReturnLineWithLot(),
                    
                
                    
                        
                        await associateCustomerReturnLineWithSerial_number(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateCustomerReturnLineWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associatePurchaseOrderWithTenant(),
                    
                
                    
                
                    
                        
                        await associatePurchaseOrderWithSupplier(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associatePurchaseOrderWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associatePurchaseOrderLineWithPurchase_order(),
                    
                
                    
                        
                        await associatePurchaseOrderLineWithItem(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associatePurchaseOrderLineWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateReceiptWithTenant(),
                    
                
                    
                
                    
                        
                        await associateReceiptWithPurchase_order(),
                    
                
                    
                        
                        await associateReceiptWithReceived_into_location(),
                    
                
                    
                
                    
                
                    
                        
                        await associateReceiptWithReceived_by(),
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateReceiptWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateReceiptLineWithReceipt(),
                    
                
                    
                        
                        await associateReceiptLineWithItem(),
                    
                
                    
                
                    
                        
                        await associateReceiptLineWithLot(),
                    
                
                    
                        
                        await associateReceiptLineWithSerial_number(),
                    
                
                    
                
                    
                
                    
                        
                        await associateReceiptLineWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateVendorBillWithTenant(),
                    
                
                    
                
                    
                        
                        await associateVendorBillWithSupplier(),
                    
                
                    
                        
                        await associateVendorBillWithPurchase_order(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateVendorBillWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateVendorBillLineWithVendor_bill(),
                    
                
                    
                        
                        await associateVendorBillLineWithItem(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateVendorBillLineWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateChartOfAccountWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateChartOfAccountWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateFiscalPeriodWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateFiscalPeriodWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateJournalEntryWithTenant(),
                    
                
                    
                
                    
                
                    
                        
                        await associateJournalEntryWithFiscal_period(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateJournalEntryWithCreated_by_user(),
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateJournalEntryWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateJournalLineWithJournal_entry(),
                    
                
                    
                        
                        await associateJournalLineWithAccount(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateJournalLineWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associatePaymentWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associatePaymentWithCustomer(),
                    
                
                    
                        
                        await associatePaymentWithSupplier(),
                    
                
                    
                        
                        await associatePaymentWithInvoice(),
                    
                
                    
                        
                        await associatePaymentWithVendor_bill(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associatePaymentWithPosted_journal_entry(),
                    
                
                    
                        
                        await associatePaymentWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateTaxRateWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateTaxRateWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateWebhookWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateWebhookWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateWebhookSubscriptionWithWebhook(),
                    
                
                    
                
                    
                
                    
                        
                        await associateWebhookSubscriptionWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateWebhookDeliveryWithTenant(),
                    
                
                    
                        
                        await associateWebhookDeliveryWithWebhook(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateWebhookDeliveryWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateEmailNotificationWithTenant(),
                    
                
                    
                        
                        await associateEmailNotificationWithRecipient(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateEmailNotificationWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateCsvImportJobWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateCsvImportJobWithRequested_by(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateCsvImportJobWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateReportWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateReportWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateDashboardWithTenant(),
                    
                
                    
                
                    
                
                    
                        
                        await associateDashboardWithOwner(),
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateDashboardWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateDashboardWidgetWithDashboard(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateDashboardWidgetWithOrganization(),
                    
                
            
            ]);
        
    },

    down: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
            await queryInterface.bulkDelete('organizations', null, {});
            
            
            await queryInterface.bulkDelete('tenants', null, {});
            
            
            await queryInterface.bulkDelete('memberships', null, {});
            
            
            await queryInterface.bulkDelete('role_assignments', null, {});
            
            
            await queryInterface.bulkDelete('approval_workflows', null, {});
            
            
            await queryInterface.bulkDelete('approval_steps', null, {});
            
            
            await queryInterface.bulkDelete('approval_requests', null, {});
            
            
            await queryInterface.bulkDelete('approval_decisions', null, {});
            
            
            await queryInterface.bulkDelete('companies', null, {});
            
            
            await queryInterface.bulkDelete('customers', null, {});
            
            
            await queryInterface.bulkDelete('suppliers', null, {});
            
            
            await queryInterface.bulkDelete('uoms', null, {});
            
            
            await queryInterface.bulkDelete('item_categories', null, {});
            
            
            await queryInterface.bulkDelete('items', null, {});
            
            
            await queryInterface.bulkDelete('warehouses', null, {});
            
            
            await queryInterface.bulkDelete('locations', null, {});
            
            
            await queryInterface.bulkDelete('lots', null, {});
            
            
            await queryInterface.bulkDelete('serial_numbers', null, {});
            
            
            await queryInterface.bulkDelete('inventory_transfers', null, {});
            
            
            await queryInterface.bulkDelete('inventory_transfer_lines', null, {});
            
            
            await queryInterface.bulkDelete('stock_movements', null, {});
            
            
            await queryInterface.bulkDelete('quotations', null, {});
            
            
            await queryInterface.bulkDelete('quotation_lines', null, {});
            
            
            await queryInterface.bulkDelete('sales_orders', null, {});
            
            
            await queryInterface.bulkDelete('sales_order_lines', null, {});
            
            
            await queryInterface.bulkDelete('sales_allocations', null, {});
            
            
            await queryInterface.bulkDelete('invoices', null, {});
            
            
            await queryInterface.bulkDelete('invoice_lines', null, {});
            
            
            await queryInterface.bulkDelete('customer_returns', null, {});
            
            
            await queryInterface.bulkDelete('customer_return_lines', null, {});
            
            
            await queryInterface.bulkDelete('purchase_orders', null, {});
            
            
            await queryInterface.bulkDelete('purchase_order_lines', null, {});
            
            
            await queryInterface.bulkDelete('receipts', null, {});
            
            
            await queryInterface.bulkDelete('receipt_lines', null, {});
            
            
            await queryInterface.bulkDelete('vendor_bills', null, {});
            
            
            await queryInterface.bulkDelete('vendor_bill_lines', null, {});
            
            
            await queryInterface.bulkDelete('chart_of_accounts', null, {});
            
            
            await queryInterface.bulkDelete('fiscal_periods', null, {});
            
            
            await queryInterface.bulkDelete('journal_entries', null, {});
            
            
            await queryInterface.bulkDelete('journal_lines', null, {});
            
            
            await queryInterface.bulkDelete('payments', null, {});
            
            
            await queryInterface.bulkDelete('tax_rates', null, {});
            
            
            await queryInterface.bulkDelete('webhooks', null, {});
            
            
            await queryInterface.bulkDelete('webhook_subscriptions', null, {});
            
            
            await queryInterface.bulkDelete('webhook_deliveries', null, {});
            
            
            await queryInterface.bulkDelete('email_notifications', null, {});
            
            
            await queryInterface.bulkDelete('csv_import_jobs', null, {});
            
            
            await queryInterface.bulkDelete('reports', null, {});
            
            
            await queryInterface.bulkDelete('dashboards', null, {});
            
            
            await queryInterface.bulkDelete('dashboard_widgets', null, {});
            
        
    },
};