





















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






const Organizations = db.organizations;

const OrganizationMemberships = db.organization_memberships;

const RolePermissions = db.role_permissions;

const Addresses = db.addresses;

const Customers = db.customers;

const Suppliers = db.suppliers;

const PaymentTerms = db.payment_terms;

const Taxes = db.taxes;

const Units = db.units;

const Categories = db.categories;

const Products = db.products;

const Warehouses = db.warehouses;

const InventoryItems = db.inventory_items;

const InventoryMovements = db.inventory_movements;

const PriceLists = db.price_lists;

const PriceListItems = db.price_list_items;

const SalesOrders = db.sales_orders;

const SalesOrderLines = db.sales_order_lines;

const PurchaseOrders = db.purchase_orders;

const PurchaseOrderLines = db.purchase_order_lines;

const GoodsReceipts = db.goods_receipts;

const GoodsReceiptLines = db.goods_receipt_lines;

const Shipments = db.shipments;

const ShipmentLines = db.shipment_lines;

const Invoices = db.invoices;

const InvoiceLines = db.invoice_lines;

const Payments = db.payments;







const OrganizationsData = [
    
    {
    
        
        
            
                "name": "Grace Hopper",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Marie Curie",
            
        
    
    },
    
];



const OrganizationMembershipsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "joined_on": new Date(Date.now()),
            
        
    
        
        
            
                "last_access_at": new Date(Date.now()),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "joined_on": new Date(Date.now()),
            
        
    
        
        
            
                "last_access_at": new Date(Date.now()),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "is_active": false,
            
        
    
        
        
            
                "joined_on": new Date(Date.now()),
            
        
    
        
        
            
                "last_access_at": new Date(Date.now()),
            
        
    
    },
    
];



const RolePermissionsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "allowed": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "allowed": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "allowed": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const AddressesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "type": "warehouse",
            
        
    
        
        
            
                "label": "Marie Curie",
            
        
    
        
        
            
                "contact_name": "Alan Turing",
            
        
    
        
        
            
                "phone": "Marie Curie",
            
        
    
        
        
            
                "line1": "Alan Turing",
            
        
    
        
        
            
                "line2": "Grace Hopper",
            
        
    
        
        
            
                "city": "Marie Curie",
            
        
    
        
        
            
                "state": "Grace Hopper",
            
        
    
        
        
            
                "postal_code": "Grace Hopper",
            
        
    
        
        
            
                "country": "Alan Turing",
            
        
    
        
        
            
                "is_default": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "type": "billing",
            
        
    
        
        
            
                "label": "Marie Curie",
            
        
    
        
        
            
                "contact_name": "Ada Lovelace",
            
        
    
        
        
            
                "phone": "Ada Lovelace",
            
        
    
        
        
            
                "line1": "Marie Curie",
            
        
    
        
        
            
                "line2": "Marie Curie",
            
        
    
        
        
            
                "city": "Alan Turing",
            
        
    
        
        
            
                "state": "Ada Lovelace",
            
        
    
        
        
            
                "postal_code": "Alan Turing",
            
        
    
        
        
            
                "country": "Alan Turing",
            
        
    
        
        
            
                "is_default": false,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "type": "billing",
            
        
    
        
        
            
                "label": "Grace Hopper",
            
        
    
        
        
            
                "contact_name": "Grace Hopper",
            
        
    
        
        
            
                "phone": "Marie Curie",
            
        
    
        
        
            
                "line1": "Marie Curie",
            
        
    
        
        
            
                "line2": "Ada Lovelace",
            
        
    
        
        
            
                "city": "Marie Curie",
            
        
    
        
        
            
                "state": "Marie Curie",
            
        
    
        
        
            
                "postal_code": "Ada Lovelace",
            
        
    
        
        
            
                "country": "Alan Turing",
            
        
    
        
        
            
                "is_default": true,
            
        
    
    },
    
];



const CustomersData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "customer_number": "Grace Hopper",
            
        
    
        
        
            
                "name": "Alan Turing",
            
        
    
        
        
            
                "email": "Ada Lovelace",
            
        
    
        
        
            
                "phone": "Alan Turing",
            
        
    
        
        
            
                "tax_number": "Marie Curie",
            
        
    
        
        
            
                "status": "on_hold",
            
        
    
        
        
            
                "credit_limit": 9.62,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "customer_number": "Alan Turing",
            
        
    
        
        
            
                "name": "Marie Curie",
            
        
    
        
        
            
                "email": "Ada Lovelace",
            
        
    
        
        
            
                "phone": "Grace Hopper",
            
        
    
        
        
            
                "tax_number": "Grace Hopper",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "credit_limit": 7.11,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "customer_number": "Alan Turing",
            
        
    
        
        
            
                "name": "Grace Hopper",
            
        
    
        
        
            
                "email": "Grace Hopper",
            
        
    
        
        
            
                "phone": "Marie Curie",
            
        
    
        
        
            
                "tax_number": "Alan Turing",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "credit_limit": 1.48,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
    },
    
];



const SuppliersData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "supplier_number": "Ada Lovelace",
            
        
    
        
        
            
                "name": "Marie Curie",
            
        
    
        
        
            
                "email": "Grace Hopper",
            
        
    
        
        
            
                "phone": "Ada Lovelace",
            
        
    
        
        
            
                "tax_number": "Ada Lovelace",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Grace Hopper",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "supplier_number": "Grace Hopper",
            
        
    
        
        
            
                "name": "Marie Curie",
            
        
    
        
        
            
                "email": "Alan Turing",
            
        
    
        
        
            
                "phone": "Grace Hopper",
            
        
    
        
        
            
                "tax_number": "Alan Turing",
            
        
    
        
        
            
                "status": "inactive",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Grace Hopper",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "supplier_number": "Ada Lovelace",
            
        
    
        
        
            
                "name": "Grace Hopper",
            
        
    
        
        
            
                "email": "Grace Hopper",
            
        
    
        
        
            
                "phone": "Marie Curie",
            
        
    
        
        
            
                "tax_number": "Alan Turing",
            
        
    
        
        
            
                "status": "on_hold",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
    },
    
];



const PaymentTermsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Alan Turing",
            
        
    
        
        
            
                "net_days": 8,
            
        
    
        
        
            
                "discount_days": 1,
            
        
    
        
        
            
                "discount_percent": 1.68,
            
        
    
        
        
            
                "is_default": true,
            
        
    
        
        
            
                "notes": "Grace Hopper",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Ada Lovelace",
            
        
    
        
        
            
                "net_days": 4,
            
        
    
        
        
            
                "discount_days": 1,
            
        
    
        
        
            
                "discount_percent": 2.41,
            
        
    
        
        
            
                "is_default": true,
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Alan Turing",
            
        
    
        
        
            
                "net_days": 6,
            
        
    
        
        
            
                "discount_days": 7,
            
        
    
        
        
            
                "discount_percent": 3.39,
            
        
    
        
        
            
                "is_default": true,
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
    },
    
];



const TaxesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Ada Lovelace",
            
        
    
        
        
            
                "code": "Marie Curie",
            
        
    
        
        
            
                "rate": 5.12,
            
        
    
        
        
            
                "scope": "purchase",
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Marie Curie",
            
        
    
        
        
            
                "code": "Ada Lovelace",
            
        
    
        
        
            
                "rate": 8.43,
            
        
    
        
        
            
                "scope": "both",
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Ada Lovelace",
            
        
    
        
        
            
                "code": "Alan Turing",
            
        
    
        
        
            
                "rate": 7.48,
            
        
    
        
        
            
                "scope": "both",
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
];



const UnitsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Alan Turing",
            
        
    
        
        
            
                "symbol": "Marie Curie",
            
        
    
        
        
            
                "base_factor": 3.2,
            
        
    
        
        
            
                "is_active": false,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Marie Curie",
            
        
    
        
        
            
                "symbol": "Alan Turing",
            
        
    
        
        
            
                "base_factor": 6.96,
            
        
    
        
        
            
                "is_active": false,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Ada Lovelace",
            
        
    
        
        
            
                "symbol": "Marie Curie",
            
        
    
        
        
            
                "base_factor": 3.04,
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
];



const CategoriesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Ada Lovelace",
            
        
    
        
        
            
                "description": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Alan Turing",
            
        
    
        
        
            
                "description": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Marie Curie",
            
        
    
        
        
            
                "description": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "is_active": false,
            
        
    
    },
    
];



const ProductsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sku": "Marie Curie",
            
        
    
        
        
            
                "name": "Marie Curie",
            
        
    
        
        
            
                "description": "Marie Curie",
            
        
    
        
        
            
                "type": "service",
            
        
    
        
        
            
                "status": "inactive",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "standard_cost": 9.92,
            
        
    
        
        
            
                "default_price": 9.86,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "track_inventory": false,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sku": "Ada Lovelace",
            
        
    
        
        
            
                "name": "Ada Lovelace",
            
        
    
        
        
            
                "description": "Alan Turing",
            
        
    
        
        
            
                "type": "non_stocked",
            
        
    
        
        
            
                "status": "inactive",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "standard_cost": 6.6,
            
        
    
        
        
            
                "default_price": 3.23,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "track_inventory": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sku": "Grace Hopper",
            
        
    
        
        
            
                "name": "Alan Turing",
            
        
    
        
        
            
                "description": "Marie Curie",
            
        
    
        
        
            
                "type": "service",
            
        
    
        
        
            
                "status": "inactive",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "standard_cost": 6.71,
            
        
    
        
        
            
                "default_price": 9.94,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "track_inventory": true,
            
        
    
    },
    
];



const WarehousesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "code": "Marie Curie",
            
        
    
        
        
            
                "name": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "code": "Ada Lovelace",
            
        
    
        
        
            
                "name": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "is_active": false,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "code": "Ada Lovelace",
            
        
    
        
        
            
                "name": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
];



const InventoryItemsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_on_hand": 4.59,
            
        
    
        
        
            
                "quantity_reserved": 0.38,
            
        
    
        
        
            
                "reorder_point": 7.7,
            
        
    
        
        
            
                "reorder_quantity": 1.26,
            
        
    
        
        
            
                "last_counted_at": new Date(Date.now()),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_on_hand": 4.34,
            
        
    
        
        
            
                "quantity_reserved": 0.42,
            
        
    
        
        
            
                "reorder_point": 4.09,
            
        
    
        
        
            
                "reorder_quantity": 0.05,
            
        
    
        
        
            
                "last_counted_at": new Date(Date.now()),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_on_hand": 8.35,
            
        
    
        
        
            
                "quantity_reserved": 1.86,
            
        
    
        
        
            
                "reorder_point": 6.81,
            
        
    
        
        
            
                "reorder_quantity": 4.82,
            
        
    
        
        
            
                "last_counted_at": new Date(Date.now()),
            
        
    
    },
    
];



const InventoryMovementsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "movement_type": "transfer_in",
            
        
    
        
        
            
                "quantity": 7.24,
            
        
    
        
        
            
                "unit_cost": 9.51,
            
        
    
        
        
            
                "movement_at": new Date(Date.now()),
            
        
    
        
        
            
                "reference": "Marie Curie",
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "movement_type": "adjustment",
            
        
    
        
        
            
                "quantity": 3.01,
            
        
    
        
        
            
                "unit_cost": 9.48,
            
        
    
        
        
            
                "movement_at": new Date(Date.now()),
            
        
    
        
        
            
                "reference": "Alan Turing",
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "movement_type": "adjustment",
            
        
    
        
        
            
                "quantity": 6.87,
            
        
    
        
        
            
                "unit_cost": 1.47,
            
        
    
        
        
            
                "movement_at": new Date(Date.now()),
            
        
    
        
        
            
                "reference": "Ada Lovelace",
            
        
    
        
        
            
                "notes": "Grace Hopper",
            
        
    
    },
    
];



const PriceListsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Grace Hopper",
            
        
    
        
        
            
                "currency_code": "Grace Hopper",
            
        
    
        
        
            
                "valid_from": new Date(Date.now()),
            
        
    
        
        
            
                "valid_to": new Date(Date.now()),
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Grace Hopper",
            
        
    
        
        
            
                "currency_code": "Grace Hopper",
            
        
    
        
        
            
                "valid_from": new Date(Date.now()),
            
        
    
        
        
            
                "valid_to": new Date(Date.now()),
            
        
    
        
        
            
                "is_active": false,
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Grace Hopper",
            
        
    
        
        
            
                "currency_code": "Ada Lovelace",
            
        
    
        
        
            
                "valid_from": new Date(Date.now()),
            
        
    
        
        
            
                "valid_to": new Date(Date.now()),
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
];



const PriceListItemsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "price": 8.72,
            
        
    
        
        
            
                "min_quantity": 2,
            
        
    
        
        
            
                "valid_from": new Date(Date.now()),
            
        
    
        
        
            
                "valid_to": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "price": 5.97,
            
        
    
        
        
            
                "min_quantity": 4,
            
        
    
        
        
            
                "valid_from": new Date(Date.now()),
            
        
    
        
        
            
                "valid_to": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "price": 9.76,
            
        
    
        
        
            
                "min_quantity": 2,
            
        
    
        
        
            
                "valid_from": new Date(Date.now()),
            
        
    
        
        
            
                "valid_to": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const SalesOrdersData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "order_number": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "order_date": new Date(Date.now()),
            
        
    
        
        
            
                "requested_ship_date": new Date(Date.now()),
            
        
    
        
        
            
                "promised_ship_date": new Date(Date.now()),
            
        
    
        
        
            
                "subtotal": 3.13,
            
        
    
        
        
            
                "tax_total": 7.85,
            
        
    
        
        
            
                "total": 6.38,
            
        
    
        
        
            
                "notes": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "order_number": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                "order_date": new Date(Date.now()),
            
        
    
        
        
            
                "requested_ship_date": new Date(Date.now()),
            
        
    
        
        
            
                "promised_ship_date": new Date(Date.now()),
            
        
    
        
        
            
                "subtotal": 8.61,
            
        
    
        
        
            
                "tax_total": 6.41,
            
        
    
        
        
            
                "total": 2.84,
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "order_number": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "order_date": new Date(Date.now()),
            
        
    
        
        
            
                "requested_ship_date": new Date(Date.now()),
            
        
    
        
        
            
                "promised_ship_date": new Date(Date.now()),
            
        
    
        
        
            
                "subtotal": 2.22,
            
        
    
        
        
            
                "tax_total": 6.46,
            
        
    
        
        
            
                "total": 4.51,
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
];



const SalesOrderLinesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Alan Turing",
            
        
    
        
        
            
                "quantity": 9.1,
            
        
    
        
        
            
                "unit_price": 6.98,
            
        
    
        
        
            
                "discount_percent": 5.67,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_total": 0.28,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Alan Turing",
            
        
    
        
        
            
                "quantity": 7.95,
            
        
    
        
        
            
                "unit_price": 1.11,
            
        
    
        
        
            
                "discount_percent": 4.37,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_total": 3.35,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Ada Lovelace",
            
        
    
        
        
            
                "quantity": 8.16,
            
        
    
        
        
            
                "unit_price": 6.85,
            
        
    
        
        
            
                "discount_percent": 0.26,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_total": 7.13,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const PurchaseOrdersData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "po_number": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "approved",
            
        
    
        
        
            
                "order_date": new Date(Date.now()),
            
        
    
        
        
            
                "expected_delivery_date": new Date(Date.now()),
            
        
    
        
        
            
                "subtotal": 6.33,
            
        
    
        
        
            
                "tax_total": 6.64,
            
        
    
        
        
            
                "total": 4.57,
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "po_number": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                "order_date": new Date(Date.now()),
            
        
    
        
        
            
                "expected_delivery_date": new Date(Date.now()),
            
        
    
        
        
            
                "subtotal": 9.76,
            
        
    
        
        
            
                "tax_total": 8.77,
            
        
    
        
        
            
                "total": 9.34,
            
        
    
        
        
            
                "notes": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "po_number": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "ordered",
            
        
    
        
        
            
                "order_date": new Date(Date.now()),
            
        
    
        
        
            
                "expected_delivery_date": new Date(Date.now()),
            
        
    
        
        
            
                "subtotal": 7.09,
            
        
    
        
        
            
                "tax_total": 3.79,
            
        
    
        
        
            
                "total": 2.32,
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
];



const PurchaseOrderLinesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Alan Turing",
            
        
    
        
        
            
                "quantity": 4.89,
            
        
    
        
        
            
                "unit_cost": 5.63,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_total": 1.84,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Ada Lovelace",
            
        
    
        
        
            
                "quantity": 0.63,
            
        
    
        
        
            
                "unit_cost": 1.15,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_total": 0.36,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Grace Hopper",
            
        
    
        
        
            
                "quantity": 8.52,
            
        
    
        
        
            
                "unit_cost": 9.38,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_total": 7.12,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const GoodsReceiptsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "gr_number": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "received_at": new Date(Date.now()),
            
        
    
        
        
            
                "posted_at": new Date(Date.now()),
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "gr_number": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "received_at": new Date(Date.now()),
            
        
    
        
        
            
                "posted_at": new Date(Date.now()),
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "gr_number": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "received_at": new Date(Date.now()),
            
        
    
        
        
            
                "posted_at": new Date(Date.now()),
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
];



const GoodsReceiptLinesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_received": 2.46,
            
        
    
        
        
            
                "unit_cost": 8.15,
            
        
    
        
        
            
                "line_total": 4.53,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_received": 9.66,
            
        
    
        
        
            
                "unit_cost": 5.55,
            
        
    
        
        
            
                "line_total": 9.59,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_received": 0.5,
            
        
    
        
        
            
                "unit_cost": 1.09,
            
        
    
        
        
            
                "line_total": 9.08,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ShipmentsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "shipment_number": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                "packed_at": new Date(Date.now()),
            
        
    
        
        
            
                "shipped_at": new Date(Date.now()),
            
        
    
        
        
            
                "delivered_at": new Date(Date.now()),
            
        
    
        
        
            
                "carrier": "Alan Turing",
            
        
    
        
        
            
                "tracking_number": "Ada Lovelace",
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "shipment_number": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "shipped",
            
        
    
        
        
            
                "packed_at": new Date(Date.now()),
            
        
    
        
        
            
                "shipped_at": new Date(Date.now()),
            
        
    
        
        
            
                "delivered_at": new Date(Date.now()),
            
        
    
        
        
            
                "carrier": "Grace Hopper",
            
        
    
        
        
            
                "tracking_number": "Grace Hopper",
            
        
    
        
        
            
                "notes": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "shipment_number": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "shipped",
            
        
    
        
        
            
                "packed_at": new Date(Date.now()),
            
        
    
        
        
            
                "shipped_at": new Date(Date.now()),
            
        
    
        
        
            
                "delivered_at": new Date(Date.now()),
            
        
    
        
        
            
                "carrier": "Ada Lovelace",
            
        
    
        
        
            
                "tracking_number": "Alan Turing",
            
        
    
        
        
            
                "notes": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
];



const ShipmentLinesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 6.65,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 3.58,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 2.17,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const InvoicesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "invoice_number": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "issued",
            
        
    
        
        
            
                "issue_date": new Date(Date.now()),
            
        
    
        
        
            
                "due_date": new Date(Date.now()),
            
        
    
        
        
            
                "paid_at": new Date(Date.now()),
            
        
    
        
        
            
                "subtotal": 2.93,
            
        
    
        
        
            
                "tax_total": 2.19,
            
        
    
        
        
            
                "total": 9.7,
            
        
    
        
        
            
                "balance_due": 8.98,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "invoice_number": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "overdue",
            
        
    
        
        
            
                "issue_date": new Date(Date.now()),
            
        
    
        
        
            
                "due_date": new Date(Date.now()),
            
        
    
        
        
            
                "paid_at": new Date(Date.now()),
            
        
    
        
        
            
                "subtotal": 5.44,
            
        
    
        
        
            
                "tax_total": 1.3,
            
        
    
        
        
            
                "total": 1.98,
            
        
    
        
        
            
                "balance_due": 4.25,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "invoice_number": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "overdue",
            
        
    
        
        
            
                "issue_date": new Date(Date.now()),
            
        
    
        
        
            
                "due_date": new Date(Date.now()),
            
        
    
        
        
            
                "paid_at": new Date(Date.now()),
            
        
    
        
        
            
                "subtotal": 0.81,
            
        
    
        
        
            
                "tax_total": 6.6,
            
        
    
        
        
            
                "total": 2.32,
            
        
    
        
        
            
                "balance_due": 3.58,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
];



const InvoiceLinesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Ada Lovelace",
            
        
    
        
        
            
                "quantity": 5.32,
            
        
    
        
        
            
                "unit_price": 6.79,
            
        
    
        
        
            
                "discount_percent": 3.68,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_total": 6.55,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Ada Lovelace",
            
        
    
        
        
            
                "quantity": 0.01,
            
        
    
        
        
            
                "unit_price": 6.81,
            
        
    
        
        
            
                "discount_percent": 1.45,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_total": 3.26,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Alan Turing",
            
        
    
        
        
            
                "quantity": 4.37,
            
        
    
        
        
            
                "unit_price": 9.58,
            
        
    
        
        
            
                "discount_percent": 7.85,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_total": 8.42,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const PaymentsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "payment_reference": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "method": "cash",
            
        
    
        
        
            
                "status": "pending",
            
        
    
        
        
            
                "amount": 2.51,
            
        
    
        
        
            
                "paid_at": new Date(Date.now()),
            
        
    
        
        
            
                "notes": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "payment_reference": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "method": "bank_transfer",
            
        
    
        
        
            
                "status": "failed",
            
        
    
        
        
            
                "amount": 7.38,
            
        
    
        
        
            
                "paid_at": new Date(Date.now()),
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "payment_reference": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "method": "check",
            
        
    
        
        
            
                "status": "refunded",
            
        
    
        
        
            
                "amount": 0.67,
            
        
    
        
        
            
                "paid_at": new Date(Date.now()),
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "files" 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);
                }
            
        }
        
    

    
    
    
    
    
        
    

    
    
    
        
            
            async function associateOrganizationMembershipWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const OrganizationMembership0 = await OrganizationMemberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (OrganizationMembership0?.setOrganization)
                {
                    await
                    OrganizationMembership0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const OrganizationMembership1 = await OrganizationMemberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (OrganizationMembership1?.setOrganization)
                {
                    await
                    OrganizationMembership1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const OrganizationMembership2 = await OrganizationMemberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (OrganizationMembership2?.setOrganization)
                {
                    await
                    OrganizationMembership2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    
        
            
            async function associateOrganizationMembershipWithUser() {
            
                const relatedUser0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const OrganizationMembership0 = await OrganizationMemberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (OrganizationMembership0?.setUser)
                {
                    await
                    OrganizationMembership0.
                    setUser(relatedUser0);
                }
            
                const relatedUser1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const OrganizationMembership1 = await OrganizationMemberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (OrganizationMembership1?.setUser)
                {
                    await
                    OrganizationMembership1.
                    setUser(relatedUser1);
                }
            
                const relatedUser2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const OrganizationMembership2 = await OrganizationMemberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (OrganizationMembership2?.setUser)
                {
                    await
                    OrganizationMembership2.
                    setUser(relatedUser2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
            
            async function associateRolePermissionWithPermission() {
            
                const relatedPermission0 = await Permissions.findOne({
                    offset: Math.floor(Math.random() * (await Permissions.count())),
                });
                const RolePermission0 = await RolePermissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RolePermission0?.setPermission)
                {
                    await
                    RolePermission0.
                    setPermission(relatedPermission0);
                }
            
                const relatedPermission1 = await Permissions.findOne({
                    offset: Math.floor(Math.random() * (await Permissions.count())),
                });
                const RolePermission1 = await RolePermissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RolePermission1?.setPermission)
                {
                    await
                    RolePermission1.
                    setPermission(relatedPermission1);
                }
            
                const relatedPermission2 = await Permissions.findOne({
                    offset: Math.floor(Math.random() * (await Permissions.count())),
                });
                const RolePermission2 = await RolePermissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RolePermission2?.setPermission)
                {
                    await
                    RolePermission2.
                    setPermission(relatedPermission2);
                }
            
        }
        
    
        
    
        
            
            async function associateRolePermissionWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RolePermission0 = await RolePermissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RolePermission0?.setOrganization)
                {
                    await
                    RolePermission0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RolePermission1 = await RolePermissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RolePermission1?.setOrganization)
                {
                    await
                    RolePermission1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RolePermission2 = await RolePermissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RolePermission2?.setOrganization)
                {
                    await
                    RolePermission2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateAddressWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Address0 = await Addresses.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Address0?.setOrganization)
                {
                    await
                    Address0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Address1 = await Addresses.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Address1?.setOrganization)
                {
                    await
                    Address1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Address2 = await Addresses.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Address2?.setOrganization)
                {
                    await
                    Address2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            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 associateCustomerWithBilling_addres() {
            
                const relatedBilling_addres0 = await Addresses.findOne({
                    offset: Math.floor(Math.random() * (await Addresses.count())),
                });
                const Customer0 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Customer0?.setBilling_addres)
                {
                    await
                    Customer0.
                    setBilling_addres(relatedBilling_addres0);
                }
            
                const relatedBilling_addres1 = await Addresses.findOne({
                    offset: Math.floor(Math.random() * (await Addresses.count())),
                });
                const Customer1 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Customer1?.setBilling_addres)
                {
                    await
                    Customer1.
                    setBilling_addres(relatedBilling_addres1);
                }
            
                const relatedBilling_addres2 = await Addresses.findOne({
                    offset: Math.floor(Math.random() * (await Addresses.count())),
                });
                const Customer2 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Customer2?.setBilling_addres)
                {
                    await
                    Customer2.
                    setBilling_addres(relatedBilling_addres2);
                }
            
        }
        
    
        
            
            async function associateCustomerWithShipping_addres() {
            
                const relatedShipping_addres0 = await Addresses.findOne({
                    offset: Math.floor(Math.random() * (await Addresses.count())),
                });
                const Customer0 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Customer0?.setShipping_addres)
                {
                    await
                    Customer0.
                    setShipping_addres(relatedShipping_addres0);
                }
            
                const relatedShipping_addres1 = await Addresses.findOne({
                    offset: Math.floor(Math.random() * (await Addresses.count())),
                });
                const Customer1 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Customer1?.setShipping_addres)
                {
                    await
                    Customer1.
                    setShipping_addres(relatedShipping_addres1);
                }
            
                const relatedShipping_addres2 = await Addresses.findOne({
                    offset: Math.floor(Math.random() * (await Addresses.count())),
                });
                const Customer2 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Customer2?.setShipping_addres)
                {
                    await
                    Customer2.
                    setShipping_addres(relatedShipping_addres2);
                }
            
        }
        
    
        
            
            async function associateCustomerWithPayment_term() {
            
                const relatedPayment_term0 = await PaymentTerms.findOne({
                    offset: Math.floor(Math.random() * (await PaymentTerms.count())),
                });
                const Customer0 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Customer0?.setPayment_term)
                {
                    await
                    Customer0.
                    setPayment_term(relatedPayment_term0);
                }
            
                const relatedPayment_term1 = await PaymentTerms.findOne({
                    offset: Math.floor(Math.random() * (await PaymentTerms.count())),
                });
                const Customer1 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Customer1?.setPayment_term)
                {
                    await
                    Customer1.
                    setPayment_term(relatedPayment_term1);
                }
            
                const relatedPayment_term2 = await PaymentTerms.findOne({
                    offset: Math.floor(Math.random() * (await PaymentTerms.count())),
                });
                const Customer2 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Customer2?.setPayment_term)
                {
                    await
                    Customer2.
                    setPayment_term(relatedPayment_term2);
                }
            
        }
        
    
        
    

    
    
    
        
            
            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 associateSupplierWithBilling_addres() {
            
                const relatedBilling_addres0 = await Addresses.findOne({
                    offset: Math.floor(Math.random() * (await Addresses.count())),
                });
                const Supplier0 = await Suppliers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Supplier0?.setBilling_addres)
                {
                    await
                    Supplier0.
                    setBilling_addres(relatedBilling_addres0);
                }
            
                const relatedBilling_addres1 = await Addresses.findOne({
                    offset: Math.floor(Math.random() * (await Addresses.count())),
                });
                const Supplier1 = await Suppliers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Supplier1?.setBilling_addres)
                {
                    await
                    Supplier1.
                    setBilling_addres(relatedBilling_addres1);
                }
            
                const relatedBilling_addres2 = await Addresses.findOne({
                    offset: Math.floor(Math.random() * (await Addresses.count())),
                });
                const Supplier2 = await Suppliers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Supplier2?.setBilling_addres)
                {
                    await
                    Supplier2.
                    setBilling_addres(relatedBilling_addres2);
                }
            
        }
        
    
        
            
            async function associateSupplierWithShipping_addres() {
            
                const relatedShipping_addres0 = await Addresses.findOne({
                    offset: Math.floor(Math.random() * (await Addresses.count())),
                });
                const Supplier0 = await Suppliers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Supplier0?.setShipping_addres)
                {
                    await
                    Supplier0.
                    setShipping_addres(relatedShipping_addres0);
                }
            
                const relatedShipping_addres1 = await Addresses.findOne({
                    offset: Math.floor(Math.random() * (await Addresses.count())),
                });
                const Supplier1 = await Suppliers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Supplier1?.setShipping_addres)
                {
                    await
                    Supplier1.
                    setShipping_addres(relatedShipping_addres1);
                }
            
                const relatedShipping_addres2 = await Addresses.findOne({
                    offset: Math.floor(Math.random() * (await Addresses.count())),
                });
                const Supplier2 = await Suppliers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Supplier2?.setShipping_addres)
                {
                    await
                    Supplier2.
                    setShipping_addres(relatedShipping_addres2);
                }
            
        }
        
    
        
            
            async function associateSupplierWithPayment_term() {
            
                const relatedPayment_term0 = await PaymentTerms.findOne({
                    offset: Math.floor(Math.random() * (await PaymentTerms.count())),
                });
                const Supplier0 = await Suppliers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Supplier0?.setPayment_term)
                {
                    await
                    Supplier0.
                    setPayment_term(relatedPayment_term0);
                }
            
                const relatedPayment_term1 = await PaymentTerms.findOne({
                    offset: Math.floor(Math.random() * (await PaymentTerms.count())),
                });
                const Supplier1 = await Suppliers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Supplier1?.setPayment_term)
                {
                    await
                    Supplier1.
                    setPayment_term(relatedPayment_term1);
                }
            
                const relatedPayment_term2 = await PaymentTerms.findOne({
                    offset: Math.floor(Math.random() * (await PaymentTerms.count())),
                });
                const Supplier2 = await Suppliers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Supplier2?.setPayment_term)
                {
                    await
                    Supplier2.
                    setPayment_term(relatedPayment_term2);
                }
            
        }
        
    
        
    

    
    
    
        
            
            async function associatePaymentTermWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const PaymentTerm0 = await PaymentTerms.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PaymentTerm0?.setOrganization)
                {
                    await
                    PaymentTerm0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const PaymentTerm1 = await PaymentTerms.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PaymentTerm1?.setOrganization)
                {
                    await
                    PaymentTerm1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const PaymentTerm2 = await PaymentTerms.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PaymentTerm2?.setOrganization)
                {
                    await
                    PaymentTerm2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateTaxeWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Taxe0 = await Taxes.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Taxe0?.setOrganization)
                {
                    await
                    Taxe0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Taxe1 = await Taxes.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Taxe1?.setOrganization)
                {
                    await
                    Taxe1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Taxe2 = await Taxes.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Taxe2?.setOrganization)
                {
                    await
                    Taxe2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateUnitWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Unit0 = await Units.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Unit0?.setOrganization)
                {
                    await
                    Unit0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Unit1 = await Units.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Unit1?.setOrganization)
                {
                    await
                    Unit1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Unit2 = await Units.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Unit2?.setOrganization)
                {
                    await
                    Unit2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateCategoryWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Category0 = await Categories.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Category0?.setOrganization)
                {
                    await
                    Category0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Category1 = await Categories.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Category1?.setOrganization)
                {
                    await
                    Category1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Category2 = await Categories.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Category2?.setOrganization)
                {
                    await
                    Category2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateCategoryWithParent_category() {
            
                const relatedParent_category0 = await Categories.findOne({
                    offset: Math.floor(Math.random() * (await Categories.count())),
                });
                const Category0 = await Categories.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Category0?.setParent_category)
                {
                    await
                    Category0.
                    setParent_category(relatedParent_category0);
                }
            
                const relatedParent_category1 = await Categories.findOne({
                    offset: Math.floor(Math.random() * (await Categories.count())),
                });
                const Category1 = await Categories.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Category1?.setParent_category)
                {
                    await
                    Category1.
                    setParent_category(relatedParent_category1);
                }
            
                const relatedParent_category2 = await Categories.findOne({
                    offset: Math.floor(Math.random() * (await Categories.count())),
                });
                const Category2 = await Categories.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Category2?.setParent_category)
                {
                    await
                    Category2.
                    setParent_category(relatedParent_category2);
                }
            
        }
        
    
        
    

    
    
    
        
            
            async function associateProductWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Product0 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Product0?.setOrganization)
                {
                    await
                    Product0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Product1 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Product1?.setOrganization)
                {
                    await
                    Product1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Product2 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Product2?.setOrganization)
                {
                    await
                    Product2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateProductWithCategory() {
            
                const relatedCategory0 = await Categories.findOne({
                    offset: Math.floor(Math.random() * (await Categories.count())),
                });
                const Product0 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Product0?.setCategory)
                {
                    await
                    Product0.
                    setCategory(relatedCategory0);
                }
            
                const relatedCategory1 = await Categories.findOne({
                    offset: Math.floor(Math.random() * (await Categories.count())),
                });
                const Product1 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Product1?.setCategory)
                {
                    await
                    Product1.
                    setCategory(relatedCategory1);
                }
            
                const relatedCategory2 = await Categories.findOne({
                    offset: Math.floor(Math.random() * (await Categories.count())),
                });
                const Product2 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Product2?.setCategory)
                {
                    await
                    Product2.
                    setCategory(relatedCategory2);
                }
            
        }
        
    
        
            
            async function associateProductWithUnit() {
            
                const relatedUnit0 = await Units.findOne({
                    offset: Math.floor(Math.random() * (await Units.count())),
                });
                const Product0 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Product0?.setUnit)
                {
                    await
                    Product0.
                    setUnit(relatedUnit0);
                }
            
                const relatedUnit1 = await Units.findOne({
                    offset: Math.floor(Math.random() * (await Units.count())),
                });
                const Product1 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Product1?.setUnit)
                {
                    await
                    Product1.
                    setUnit(relatedUnit1);
                }
            
                const relatedUnit2 = await Units.findOne({
                    offset: Math.floor(Math.random() * (await Units.count())),
                });
                const Product2 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Product2?.setUnit)
                {
                    await
                    Product2.
                    setUnit(relatedUnit2);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateProductWithTax() {
            
                const relatedTax0 = await Taxes.findOne({
                    offset: Math.floor(Math.random() * (await Taxes.count())),
                });
                const Product0 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Product0?.setTax)
                {
                    await
                    Product0.
                    setTax(relatedTax0);
                }
            
                const relatedTax1 = await Taxes.findOne({
                    offset: Math.floor(Math.random() * (await Taxes.count())),
                });
                const Product1 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Product1?.setTax)
                {
                    await
                    Product1.
                    setTax(relatedTax1);
                }
            
                const relatedTax2 = await Taxes.findOne({
                    offset: Math.floor(Math.random() * (await Taxes.count())),
                });
                const Product2 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Product2?.setTax)
                {
                    await
                    Product2.
                    setTax(relatedTax2);
                }
            
        }
        
    
        
    
        
    

    
    
    
        
            
            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 associateWarehousWithAddres() {
            
                const relatedAddres0 = await Addresses.findOne({
                    offset: Math.floor(Math.random() * (await Addresses.count())),
                });
                const Warehous0 = await Warehouses.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Warehous0?.setAddres)
                {
                    await
                    Warehous0.
                    setAddres(relatedAddres0);
                }
            
                const relatedAddres1 = await Addresses.findOne({
                    offset: Math.floor(Math.random() * (await Addresses.count())),
                });
                const Warehous1 = await Warehouses.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Warehous1?.setAddres)
                {
                    await
                    Warehous1.
                    setAddres(relatedAddres1);
                }
            
                const relatedAddres2 = await Addresses.findOne({
                    offset: Math.floor(Math.random() * (await Addresses.count())),
                });
                const Warehous2 = await Warehouses.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Warehous2?.setAddres)
                {
                    await
                    Warehous2.
                    setAddres(relatedAddres2);
                }
            
        }
        
    
        
    

    
    
    
        
            
            async function associateInventoryItemWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryItem0 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryItem0?.setOrganization)
                {
                    await
                    InventoryItem0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryItem1 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryItem1?.setOrganization)
                {
                    await
                    InventoryItem1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryItem2 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryItem2?.setOrganization)
                {
                    await
                    InventoryItem2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    
        
            
            async function associateInventoryItemWithWarehouse() {
            
                const relatedWarehouse0 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const InventoryItem0 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryItem0?.setWarehouse)
                {
                    await
                    InventoryItem0.
                    setWarehouse(relatedWarehouse0);
                }
            
                const relatedWarehouse1 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const InventoryItem1 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryItem1?.setWarehouse)
                {
                    await
                    InventoryItem1.
                    setWarehouse(relatedWarehouse1);
                }
            
                const relatedWarehouse2 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const InventoryItem2 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryItem2?.setWarehouse)
                {
                    await
                    InventoryItem2.
                    setWarehouse(relatedWarehouse2);
                }
            
        }
        
    
        
            
            async function associateInventoryItemWithProduct() {
            
                const relatedProduct0 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InventoryItem0 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryItem0?.setProduct)
                {
                    await
                    InventoryItem0.
                    setProduct(relatedProduct0);
                }
            
                const relatedProduct1 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InventoryItem1 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryItem1?.setProduct)
                {
                    await
                    InventoryItem1.
                    setProduct(relatedProduct1);
                }
            
                const relatedProduct2 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InventoryItem2 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryItem2?.setProduct)
                {
                    await
                    InventoryItem2.
                    setProduct(relatedProduct2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateInventoryMovementWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryMovement0 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryMovement0?.setOrganization)
                {
                    await
                    InventoryMovement0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryMovement1 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryMovement1?.setOrganization)
                {
                    await
                    InventoryMovement1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryMovement2 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryMovement2?.setOrganization)
                {
                    await
                    InventoryMovement2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    
        
            
            async function associateInventoryMovementWithWarehouse() {
            
                const relatedWarehouse0 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const InventoryMovement0 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryMovement0?.setWarehouse)
                {
                    await
                    InventoryMovement0.
                    setWarehouse(relatedWarehouse0);
                }
            
                const relatedWarehouse1 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const InventoryMovement1 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryMovement1?.setWarehouse)
                {
                    await
                    InventoryMovement1.
                    setWarehouse(relatedWarehouse1);
                }
            
                const relatedWarehouse2 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const InventoryMovement2 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryMovement2?.setWarehouse)
                {
                    await
                    InventoryMovement2.
                    setWarehouse(relatedWarehouse2);
                }
            
        }
        
    
        
            
            async function associateInventoryMovementWithProduct() {
            
                const relatedProduct0 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InventoryMovement0 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryMovement0?.setProduct)
                {
                    await
                    InventoryMovement0.
                    setProduct(relatedProduct0);
                }
            
                const relatedProduct1 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InventoryMovement1 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryMovement1?.setProduct)
                {
                    await
                    InventoryMovement1.
                    setProduct(relatedProduct1);
                }
            
                const relatedProduct2 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InventoryMovement2 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryMovement2?.setProduct)
                {
                    await
                    InventoryMovement2.
                    setProduct(relatedProduct2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    

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

    
    
    
        
            
            async function associatePriceListItemWithPrice_list() {
            
                const relatedPrice_list0 = await PriceLists.findOne({
                    offset: Math.floor(Math.random() * (await PriceLists.count())),
                });
                const PriceListItem0 = await PriceListItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PriceListItem0?.setPrice_list)
                {
                    await
                    PriceListItem0.
                    setPrice_list(relatedPrice_list0);
                }
            
                const relatedPrice_list1 = await PriceLists.findOne({
                    offset: Math.floor(Math.random() * (await PriceLists.count())),
                });
                const PriceListItem1 = await PriceListItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PriceListItem1?.setPrice_list)
                {
                    await
                    PriceListItem1.
                    setPrice_list(relatedPrice_list1);
                }
            
                const relatedPrice_list2 = await PriceLists.findOne({
                    offset: Math.floor(Math.random() * (await PriceLists.count())),
                });
                const PriceListItem2 = await PriceListItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PriceListItem2?.setPrice_list)
                {
                    await
                    PriceListItem2.
                    setPrice_list(relatedPrice_list2);
                }
            
        }
        
    
        
            
            async function associatePriceListItemWithProduct() {
            
                const relatedProduct0 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const PriceListItem0 = await PriceListItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PriceListItem0?.setProduct)
                {
                    await
                    PriceListItem0.
                    setProduct(relatedProduct0);
                }
            
                const relatedProduct1 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const PriceListItem1 = await PriceListItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PriceListItem1?.setProduct)
                {
                    await
                    PriceListItem1.
                    setProduct(relatedProduct1);
                }
            
                const relatedProduct2 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const PriceListItem2 = await PriceListItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PriceListItem2?.setProduct)
                {
                    await
                    PriceListItem2.
                    setProduct(relatedProduct2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associatePriceListItemWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const PriceListItem0 = await PriceListItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PriceListItem0?.setOrganization)
                {
                    await
                    PriceListItem0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const PriceListItem1 = await PriceListItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PriceListItem1?.setOrganization)
                {
                    await
                    PriceListItem1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const PriceListItem2 = await PriceListItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PriceListItem2?.setOrganization)
                {
                    await
                    PriceListItem2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            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 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 associateSalesOrderWithWarehouse() {
            
                const relatedWarehouse0 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const SalesOrder0 = await SalesOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SalesOrder0?.setWarehouse)
                {
                    await
                    SalesOrder0.
                    setWarehouse(relatedWarehouse0);
                }
            
                const relatedWarehouse1 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const SalesOrder1 = await SalesOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SalesOrder1?.setWarehouse)
                {
                    await
                    SalesOrder1.
                    setWarehouse(relatedWarehouse1);
                }
            
                const relatedWarehouse2 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const SalesOrder2 = await SalesOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SalesOrder2?.setWarehouse)
                {
                    await
                    SalesOrder2.
                    setWarehouse(relatedWarehouse2);
                }
            
        }
        
    
        
            
            async function associateSalesOrderWithPrice_list() {
            
                const relatedPrice_list0 = await PriceLists.findOne({
                    offset: Math.floor(Math.random() * (await PriceLists.count())),
                });
                const SalesOrder0 = await SalesOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SalesOrder0?.setPrice_list)
                {
                    await
                    SalesOrder0.
                    setPrice_list(relatedPrice_list0);
                }
            
                const relatedPrice_list1 = await PriceLists.findOne({
                    offset: Math.floor(Math.random() * (await PriceLists.count())),
                });
                const SalesOrder1 = await SalesOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SalesOrder1?.setPrice_list)
                {
                    await
                    SalesOrder1.
                    setPrice_list(relatedPrice_list1);
                }
            
                const relatedPrice_list2 = await PriceLists.findOne({
                    offset: Math.floor(Math.random() * (await PriceLists.count())),
                });
                const SalesOrder2 = await SalesOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SalesOrder2?.setPrice_list)
                {
                    await
                    SalesOrder2.
                    setPrice_list(relatedPrice_list2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    

    
    
    
        
            
            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 associateSalesOrderLineWithProduct() {
            
                const relatedProduct0 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const SalesOrderLine0 = await SalesOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SalesOrderLine0?.setProduct)
                {
                    await
                    SalesOrderLine0.
                    setProduct(relatedProduct0);
                }
            
                const relatedProduct1 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const SalesOrderLine1 = await SalesOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SalesOrderLine1?.setProduct)
                {
                    await
                    SalesOrderLine1.
                    setProduct(relatedProduct1);
                }
            
                const relatedProduct2 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const SalesOrderLine2 = await SalesOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SalesOrderLine2?.setProduct)
                {
                    await
                    SalesOrderLine2.
                    setProduct(relatedProduct2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateSalesOrderLineWithTax() {
            
                const relatedTax0 = await Taxes.findOne({
                    offset: Math.floor(Math.random() * (await Taxes.count())),
                });
                const SalesOrderLine0 = await SalesOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SalesOrderLine0?.setTax)
                {
                    await
                    SalesOrderLine0.
                    setTax(relatedTax0);
                }
            
                const relatedTax1 = await Taxes.findOne({
                    offset: Math.floor(Math.random() * (await Taxes.count())),
                });
                const SalesOrderLine1 = await SalesOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SalesOrderLine1?.setTax)
                {
                    await
                    SalesOrderLine1.
                    setTax(relatedTax1);
                }
            
                const relatedTax2 = await Taxes.findOne({
                    offset: Math.floor(Math.random() * (await Taxes.count())),
                });
                const SalesOrderLine2 = await SalesOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SalesOrderLine2?.setTax)
                {
                    await
                    SalesOrderLine2.
                    setTax(relatedTax2);
                }
            
        }
        
    
        
    
        
            
            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 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 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);
                }
            
        }
        
    
        
            
            async function associatePurchaseOrderWithWarehouse() {
            
                const relatedWarehouse0 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const PurchaseOrder0 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PurchaseOrder0?.setWarehouse)
                {
                    await
                    PurchaseOrder0.
                    setWarehouse(relatedWarehouse0);
                }
            
                const relatedWarehouse1 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const PurchaseOrder1 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PurchaseOrder1?.setWarehouse)
                {
                    await
                    PurchaseOrder1.
                    setWarehouse(relatedWarehouse1);
                }
            
                const relatedWarehouse2 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const PurchaseOrder2 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PurchaseOrder2?.setWarehouse)
                {
                    await
                    PurchaseOrder2.
                    setWarehouse(relatedWarehouse2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    

    
    
    
        
            
            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 associatePurchaseOrderLineWithProduct() {
            
                const relatedProduct0 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const PurchaseOrderLine0 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PurchaseOrderLine0?.setProduct)
                {
                    await
                    PurchaseOrderLine0.
                    setProduct(relatedProduct0);
                }
            
                const relatedProduct1 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const PurchaseOrderLine1 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PurchaseOrderLine1?.setProduct)
                {
                    await
                    PurchaseOrderLine1.
                    setProduct(relatedProduct1);
                }
            
                const relatedProduct2 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const PurchaseOrderLine2 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PurchaseOrderLine2?.setProduct)
                {
                    await
                    PurchaseOrderLine2.
                    setProduct(relatedProduct2);
                }
            
        }
        
    
        
    
        
    
        
    
        
            
            async function associatePurchaseOrderLineWithTax() {
            
                const relatedTax0 = await Taxes.findOne({
                    offset: Math.floor(Math.random() * (await Taxes.count())),
                });
                const PurchaseOrderLine0 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PurchaseOrderLine0?.setTax)
                {
                    await
                    PurchaseOrderLine0.
                    setTax(relatedTax0);
                }
            
                const relatedTax1 = await Taxes.findOne({
                    offset: Math.floor(Math.random() * (await Taxes.count())),
                });
                const PurchaseOrderLine1 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PurchaseOrderLine1?.setTax)
                {
                    await
                    PurchaseOrderLine1.
                    setTax(relatedTax1);
                }
            
                const relatedTax2 = await Taxes.findOne({
                    offset: Math.floor(Math.random() * (await Taxes.count())),
                });
                const PurchaseOrderLine2 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PurchaseOrderLine2?.setTax)
                {
                    await
                    PurchaseOrderLine2.
                    setTax(relatedTax2);
                }
            
        }
        
    
        
    
        
            
            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 associateGoodsReceiptWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const GoodsReceipt0 = await GoodsReceipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (GoodsReceipt0?.setOrganization)
                {
                    await
                    GoodsReceipt0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const GoodsReceipt1 = await GoodsReceipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (GoodsReceipt1?.setOrganization)
                {
                    await
                    GoodsReceipt1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const GoodsReceipt2 = await GoodsReceipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (GoodsReceipt2?.setOrganization)
                {
                    await
                    GoodsReceipt2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    
        
    
        
            
            async function associateGoodsReceiptWithPurchase_order() {
            
                const relatedPurchase_order0 = await PurchaseOrders.findOne({
                    offset: Math.floor(Math.random() * (await PurchaseOrders.count())),
                });
                const GoodsReceipt0 = await GoodsReceipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (GoodsReceipt0?.setPurchase_order)
                {
                    await
                    GoodsReceipt0.
                    setPurchase_order(relatedPurchase_order0);
                }
            
                const relatedPurchase_order1 = await PurchaseOrders.findOne({
                    offset: Math.floor(Math.random() * (await PurchaseOrders.count())),
                });
                const GoodsReceipt1 = await GoodsReceipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (GoodsReceipt1?.setPurchase_order)
                {
                    await
                    GoodsReceipt1.
                    setPurchase_order(relatedPurchase_order1);
                }
            
                const relatedPurchase_order2 = await PurchaseOrders.findOne({
                    offset: Math.floor(Math.random() * (await PurchaseOrders.count())),
                });
                const GoodsReceipt2 = await GoodsReceipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (GoodsReceipt2?.setPurchase_order)
                {
                    await
                    GoodsReceipt2.
                    setPurchase_order(relatedPurchase_order2);
                }
            
        }
        
    
        
            
            async function associateGoodsReceiptWithWarehouse() {
            
                const relatedWarehouse0 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const GoodsReceipt0 = await GoodsReceipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (GoodsReceipt0?.setWarehouse)
                {
                    await
                    GoodsReceipt0.
                    setWarehouse(relatedWarehouse0);
                }
            
                const relatedWarehouse1 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const GoodsReceipt1 = await GoodsReceipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (GoodsReceipt1?.setWarehouse)
                {
                    await
                    GoodsReceipt1.
                    setWarehouse(relatedWarehouse1);
                }
            
                const relatedWarehouse2 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const GoodsReceipt2 = await GoodsReceipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (GoodsReceipt2?.setWarehouse)
                {
                    await
                    GoodsReceipt2.
                    setWarehouse(relatedWarehouse2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    

    
    
    
        
            
            async function associateGoodsReceiptLineWithGoods_receipt() {
            
                const relatedGoods_receipt0 = await GoodsReceipts.findOne({
                    offset: Math.floor(Math.random() * (await GoodsReceipts.count())),
                });
                const GoodsReceiptLine0 = await GoodsReceiptLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (GoodsReceiptLine0?.setGoods_receipt)
                {
                    await
                    GoodsReceiptLine0.
                    setGoods_receipt(relatedGoods_receipt0);
                }
            
                const relatedGoods_receipt1 = await GoodsReceipts.findOne({
                    offset: Math.floor(Math.random() * (await GoodsReceipts.count())),
                });
                const GoodsReceiptLine1 = await GoodsReceiptLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (GoodsReceiptLine1?.setGoods_receipt)
                {
                    await
                    GoodsReceiptLine1.
                    setGoods_receipt(relatedGoods_receipt1);
                }
            
                const relatedGoods_receipt2 = await GoodsReceipts.findOne({
                    offset: Math.floor(Math.random() * (await GoodsReceipts.count())),
                });
                const GoodsReceiptLine2 = await GoodsReceiptLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (GoodsReceiptLine2?.setGoods_receipt)
                {
                    await
                    GoodsReceiptLine2.
                    setGoods_receipt(relatedGoods_receipt2);
                }
            
        }
        
    
        
            
            async function associateGoodsReceiptLineWithProduct() {
            
                const relatedProduct0 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const GoodsReceiptLine0 = await GoodsReceiptLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (GoodsReceiptLine0?.setProduct)
                {
                    await
                    GoodsReceiptLine0.
                    setProduct(relatedProduct0);
                }
            
                const relatedProduct1 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const GoodsReceiptLine1 = await GoodsReceiptLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (GoodsReceiptLine1?.setProduct)
                {
                    await
                    GoodsReceiptLine1.
                    setProduct(relatedProduct1);
                }
            
                const relatedProduct2 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const GoodsReceiptLine2 = await GoodsReceiptLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (GoodsReceiptLine2?.setProduct)
                {
                    await
                    GoodsReceiptLine2.
                    setProduct(relatedProduct2);
                }
            
        }
        
    
        
    
        
    
        
    
        
            
            async function associateGoodsReceiptLineWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const GoodsReceiptLine0 = await GoodsReceiptLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (GoodsReceiptLine0?.setOrganization)
                {
                    await
                    GoodsReceiptLine0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const GoodsReceiptLine1 = await GoodsReceiptLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (GoodsReceiptLine1?.setOrganization)
                {
                    await
                    GoodsReceiptLine1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const GoodsReceiptLine2 = await GoodsReceiptLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (GoodsReceiptLine2?.setOrganization)
                {
                    await
                    GoodsReceiptLine2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateShipmentWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Shipment0 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Shipment0?.setOrganization)
                {
                    await
                    Shipment0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Shipment1 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Shipment1?.setOrganization)
                {
                    await
                    Shipment1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Shipment2 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Shipment2?.setOrganization)
                {
                    await
                    Shipment2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    
        
    
        
            
            async function associateShipmentWithSales_order() {
            
                const relatedSales_order0 = await SalesOrders.findOne({
                    offset: Math.floor(Math.random() * (await SalesOrders.count())),
                });
                const Shipment0 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Shipment0?.setSales_order)
                {
                    await
                    Shipment0.
                    setSales_order(relatedSales_order0);
                }
            
                const relatedSales_order1 = await SalesOrders.findOne({
                    offset: Math.floor(Math.random() * (await SalesOrders.count())),
                });
                const Shipment1 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Shipment1?.setSales_order)
                {
                    await
                    Shipment1.
                    setSales_order(relatedSales_order1);
                }
            
                const relatedSales_order2 = await SalesOrders.findOne({
                    offset: Math.floor(Math.random() * (await SalesOrders.count())),
                });
                const Shipment2 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Shipment2?.setSales_order)
                {
                    await
                    Shipment2.
                    setSales_order(relatedSales_order2);
                }
            
        }
        
    
        
            
            async function associateShipmentWithWarehouse() {
            
                const relatedWarehouse0 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const Shipment0 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Shipment0?.setWarehouse)
                {
                    await
                    Shipment0.
                    setWarehouse(relatedWarehouse0);
                }
            
                const relatedWarehouse1 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const Shipment1 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Shipment1?.setWarehouse)
                {
                    await
                    Shipment1.
                    setWarehouse(relatedWarehouse1);
                }
            
                const relatedWarehouse2 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const Shipment2 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Shipment2?.setWarehouse)
                {
                    await
                    Shipment2.
                    setWarehouse(relatedWarehouse2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    

    
    
    
        
            
            async function associateShipmentLineWithShipment() {
            
                const relatedShipment0 = await Shipments.findOne({
                    offset: Math.floor(Math.random() * (await Shipments.count())),
                });
                const ShipmentLine0 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ShipmentLine0?.setShipment)
                {
                    await
                    ShipmentLine0.
                    setShipment(relatedShipment0);
                }
            
                const relatedShipment1 = await Shipments.findOne({
                    offset: Math.floor(Math.random() * (await Shipments.count())),
                });
                const ShipmentLine1 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ShipmentLine1?.setShipment)
                {
                    await
                    ShipmentLine1.
                    setShipment(relatedShipment1);
                }
            
                const relatedShipment2 = await Shipments.findOne({
                    offset: Math.floor(Math.random() * (await Shipments.count())),
                });
                const ShipmentLine2 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ShipmentLine2?.setShipment)
                {
                    await
                    ShipmentLine2.
                    setShipment(relatedShipment2);
                }
            
        }
        
    
        
            
            async function associateShipmentLineWithProduct() {
            
                const relatedProduct0 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const ShipmentLine0 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ShipmentLine0?.setProduct)
                {
                    await
                    ShipmentLine0.
                    setProduct(relatedProduct0);
                }
            
                const relatedProduct1 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const ShipmentLine1 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ShipmentLine1?.setProduct)
                {
                    await
                    ShipmentLine1.
                    setProduct(relatedProduct1);
                }
            
                const relatedProduct2 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const ShipmentLine2 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ShipmentLine2?.setProduct)
                {
                    await
                    ShipmentLine2.
                    setProduct(relatedProduct2);
                }
            
        }
        
    
        
    
        
            
            async function associateShipmentLineWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ShipmentLine0 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ShipmentLine0?.setOrganization)
                {
                    await
                    ShipmentLine0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ShipmentLine1 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ShipmentLine1?.setOrganization)
                {
                    await
                    ShipmentLine1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ShipmentLine2 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ShipmentLine2?.setOrganization)
                {
                    await
                    ShipmentLine2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            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 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);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateInvoiceWithBilling_addres() {
            
                const relatedBilling_addres0 = await Addresses.findOne({
                    offset: Math.floor(Math.random() * (await Addresses.count())),
                });
                const Invoice0 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Invoice0?.setBilling_addres)
                {
                    await
                    Invoice0.
                    setBilling_addres(relatedBilling_addres0);
                }
            
                const relatedBilling_addres1 = await Addresses.findOne({
                    offset: Math.floor(Math.random() * (await Addresses.count())),
                });
                const Invoice1 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Invoice1?.setBilling_addres)
                {
                    await
                    Invoice1.
                    setBilling_addres(relatedBilling_addres1);
                }
            
                const relatedBilling_addres2 = await Addresses.findOne({
                    offset: Math.floor(Math.random() * (await Addresses.count())),
                });
                const Invoice2 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Invoice2?.setBilling_addres)
                {
                    await
                    Invoice2.
                    setBilling_addres(relatedBilling_addres2);
                }
            
        }
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    

    
    
    
        
            
            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 associateInvoiceLineWithProduct() {
            
                const relatedProduct0 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InvoiceLine0 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InvoiceLine0?.setProduct)
                {
                    await
                    InvoiceLine0.
                    setProduct(relatedProduct0);
                }
            
                const relatedProduct1 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InvoiceLine1 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InvoiceLine1?.setProduct)
                {
                    await
                    InvoiceLine1.
                    setProduct(relatedProduct1);
                }
            
                const relatedProduct2 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InvoiceLine2 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InvoiceLine2?.setProduct)
                {
                    await
                    InvoiceLine2.
                    setProduct(relatedProduct2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateInvoiceLineWithTax() {
            
                const relatedTax0 = await Taxes.findOne({
                    offset: Math.floor(Math.random() * (await Taxes.count())),
                });
                const InvoiceLine0 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InvoiceLine0?.setTax)
                {
                    await
                    InvoiceLine0.
                    setTax(relatedTax0);
                }
            
                const relatedTax1 = await Taxes.findOne({
                    offset: Math.floor(Math.random() * (await Taxes.count())),
                });
                const InvoiceLine1 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InvoiceLine1?.setTax)
                {
                    await
                    InvoiceLine1.
                    setTax(relatedTax1);
                }
            
                const relatedTax2 = await Taxes.findOne({
                    offset: Math.floor(Math.random() * (await Taxes.count())),
                });
                const InvoiceLine2 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InvoiceLine2?.setTax)
                {
                    await
                    InvoiceLine2.
                    setTax(relatedTax2);
                }
            
        }
        
    
        
    
        
            
            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 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 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);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    


module.exports = {
    up: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
                
                await Organizations.bulkCreate(OrganizationsData);
                
            
            
                
                await OrganizationMemberships.bulkCreate(OrganizationMembershipsData);
                
            
            
                
                await RolePermissions.bulkCreate(RolePermissionsData);
                
            
            
                
                await Addresses.bulkCreate(AddressesData);
                
            
            
                
                await Customers.bulkCreate(CustomersData);
                
            
            
                
                await Suppliers.bulkCreate(SuppliersData);
                
            
            
                
                await PaymentTerms.bulkCreate(PaymentTermsData);
                
            
            
                
                await Taxes.bulkCreate(TaxesData);
                
            
            
                
                await Units.bulkCreate(UnitsData);
                
            
            
                
                await Categories.bulkCreate(CategoriesData);
                
            
            
                
                await Products.bulkCreate(ProductsData);
                
            
            
                
                await Warehouses.bulkCreate(WarehousesData);
                
            
            
                
                await InventoryItems.bulkCreate(InventoryItemsData);
                
            
            
                
                await InventoryMovements.bulkCreate(InventoryMovementsData);
                
            
            
                
                await PriceLists.bulkCreate(PriceListsData);
                
            
            
                
                await PriceListItems.bulkCreate(PriceListItemsData);
                
            
            
                
                await SalesOrders.bulkCreate(SalesOrdersData);
                
            
            
                
                await SalesOrderLines.bulkCreate(SalesOrderLinesData);
                
            
            
                
                await PurchaseOrders.bulkCreate(PurchaseOrdersData);
                
            
            
                
                await PurchaseOrderLines.bulkCreate(PurchaseOrderLinesData);
                
            
            
                
                await GoodsReceipts.bulkCreate(GoodsReceiptsData);
                
            
            
                
                await GoodsReceiptLines.bulkCreate(GoodsReceiptLinesData);
                
            
            
                
                await Shipments.bulkCreate(ShipmentsData);
                
            
            
                
                await ShipmentLines.bulkCreate(ShipmentLinesData);
                
            
            
                
                await Invoices.bulkCreate(InvoicesData);
                
            
            
                
                await InvoiceLines.bulkCreate(InvoiceLinesData);
                
            
            
                
                await Payments.bulkCreate(PaymentsData);
                
            
            await Promise.all([
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateUserWithOrganization(),
                    
                
            
                
                
                
                
                    
                
            
                
                
                    
                        
                        await associateOrganizationMembershipWithOrganization(),
                    
                
                    
                        
                        await associateOrganizationMembershipWithUser(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateRolePermissionWithPermission(),
                    
                
                    
                
                    
                        
                        await associateRolePermissionWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateAddressWithOrganization(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateCustomerWithOrganization(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateCustomerWithBilling_addres(),
                    
                
                    
                        
                        await associateCustomerWithShipping_addres(),
                    
                
                    
                        
                        await associateCustomerWithPayment_term(),
                    
                
                    
                
            
                
                
                    
                        
                        await associateSupplierWithOrganization(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateSupplierWithBilling_addres(),
                    
                
                    
                        
                        await associateSupplierWithShipping_addres(),
                    
                
                    
                        
                        await associateSupplierWithPayment_term(),
                    
                
                    
                
            
                
                
                    
                        
                        await associatePaymentTermWithOrganization(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateTaxeWithOrganization(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateUnitWithOrganization(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateCategoryWithOrganization(),
                    
                
                    
                
                    
                
                    
                        
                        await associateCategoryWithParent_category(),
                    
                
                    
                
            
                
                
                    
                        
                        await associateProductWithOrganization(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateProductWithCategory(),
                    
                
                    
                        
                        await associateProductWithUnit(),
                    
                
                    
                
                    
                
                    
                        
                        await associateProductWithTax(),
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateWarehousWithOrganization(),
                    
                
                    
                
                    
                
                    
                        
                        await associateWarehousWithAddres(),
                    
                
                    
                
            
                
                
                    
                        
                        await associateInventoryItemWithOrganization(),
                    
                
                    
                        
                        await associateInventoryItemWithWarehouse(),
                    
                
                    
                        
                        await associateInventoryItemWithProduct(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateInventoryMovementWithOrganization(),
                    
                
                    
                        
                        await associateInventoryMovementWithWarehouse(),
                    
                
                    
                        
                        await associateInventoryMovementWithProduct(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associatePriceListWithOrganization(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
            
                
                
                    
                        
                        await associatePriceListItemWithPrice_list(),
                    
                
                    
                        
                        await associatePriceListItemWithProduct(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associatePriceListItemWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateSalesOrderWithOrganization(),
                    
                
                    
                
                    
                        
                        await associateSalesOrderWithCustomer(),
                    
                
                    
                        
                        await associateSalesOrderWithWarehouse(),
                    
                
                    
                        
                        await associateSalesOrderWithPrice_list(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
            
                
                
                    
                        
                        await associateSalesOrderLineWithSales_order(),
                    
                
                    
                        
                        await associateSalesOrderLineWithProduct(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateSalesOrderLineWithTax(),
                    
                
                    
                
                    
                        
                        await associateSalesOrderLineWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associatePurchaseOrderWithOrganization(),
                    
                
                    
                
                    
                        
                        await associatePurchaseOrderWithSupplier(),
                    
                
                    
                        
                        await associatePurchaseOrderWithWarehouse(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
            
                
                
                    
                        
                        await associatePurchaseOrderLineWithPurchase_order(),
                    
                
                    
                        
                        await associatePurchaseOrderLineWithProduct(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associatePurchaseOrderLineWithTax(),
                    
                
                    
                
                    
                        
                        await associatePurchaseOrderLineWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateGoodsReceiptWithOrganization(),
                    
                
                    
                
                    
                        
                        await associateGoodsReceiptWithPurchase_order(),
                    
                
                    
                        
                        await associateGoodsReceiptWithWarehouse(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
            
                
                
                    
                        
                        await associateGoodsReceiptLineWithGoods_receipt(),
                    
                
                    
                        
                        await associateGoodsReceiptLineWithProduct(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateGoodsReceiptLineWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateShipmentWithOrganization(),
                    
                
                    
                
                    
                        
                        await associateShipmentWithSales_order(),
                    
                
                    
                        
                        await associateShipmentWithWarehouse(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
            
                
                
                    
                        
                        await associateShipmentLineWithShipment(),
                    
                
                    
                        
                        await associateShipmentLineWithProduct(),
                    
                
                    
                
                    
                        
                        await associateShipmentLineWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateInvoiceWithOrganization(),
                    
                
                    
                
                    
                        
                        await associateInvoiceWithCustomer(),
                    
                
                    
                        
                        await associateInvoiceWithSales_order(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateInvoiceWithBilling_addres(),
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
            
                
                
                    
                        
                        await associateInvoiceLineWithInvoice(),
                    
                
                    
                        
                        await associateInvoiceLineWithProduct(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateInvoiceLineWithTax(),
                    
                
                    
                
                    
                        
                        await associateInvoiceLineWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associatePaymentWithOrganization(),
                    
                
                    
                
                    
                        
                        await associatePaymentWithInvoice(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            ]);
        
    },

    down: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
            await queryInterface.bulkDelete('organizations', null, {});
            
            
            await queryInterface.bulkDelete('organization_memberships', null, {});
            
            
            await queryInterface.bulkDelete('role_permissions', null, {});
            
            
            await queryInterface.bulkDelete('addresses', null, {});
            
            
            await queryInterface.bulkDelete('customers', null, {});
            
            
            await queryInterface.bulkDelete('suppliers', null, {});
            
            
            await queryInterface.bulkDelete('payment_terms', null, {});
            
            
            await queryInterface.bulkDelete('taxes', null, {});
            
            
            await queryInterface.bulkDelete('units', null, {});
            
            
            await queryInterface.bulkDelete('categories', null, {});
            
            
            await queryInterface.bulkDelete('products', null, {});
            
            
            await queryInterface.bulkDelete('warehouses', null, {});
            
            
            await queryInterface.bulkDelete('inventory_items', null, {});
            
            
            await queryInterface.bulkDelete('inventory_movements', null, {});
            
            
            await queryInterface.bulkDelete('price_lists', null, {});
            
            
            await queryInterface.bulkDelete('price_list_items', null, {});
            
            
            await queryInterface.bulkDelete('sales_orders', null, {});
            
            
            await queryInterface.bulkDelete('sales_order_lines', null, {});
            
            
            await queryInterface.bulkDelete('purchase_orders', null, {});
            
            
            await queryInterface.bulkDelete('purchase_order_lines', null, {});
            
            
            await queryInterface.bulkDelete('goods_receipts', null, {});
            
            
            await queryInterface.bulkDelete('goods_receipt_lines', null, {});
            
            
            await queryInterface.bulkDelete('shipments', null, {});
            
            
            await queryInterface.bulkDelete('shipment_lines', null, {});
            
            
            await queryInterface.bulkDelete('invoices', null, {});
            
            
            await queryInterface.bulkDelete('invoice_lines', null, {});
            
            
            await queryInterface.bulkDelete('payments', null, {});
            
        
    },
};