protected virtual void UpdateBranchesParents(Ledger ledger)
        {
            IEnumerable <Branch> ledgerBranches = BranchMaint.GetBranchesWithLedgerID(this, ledger.LedgerID);

            foreach (Branch branch in ledgerBranches)
            {
                BranchMaint.SetBranchParentID(branch, ledger.DefBranchID);

                BranchView.Update(branch);
            }
        }
        protected virtual void Branch_LedgerID_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
        {
            Branch branch = e.Row as Branch;

            if (branch == null)
            {
                return;
            }

            Ledger ledger = GeneralLedgerMaint.FindLedgerByID(this, branch.LedgerID);

            BranchMaint.SetBranchParentID(branch, ledger?.DefBranchID);
        }