Error when Registering to Ledger: Try to insert a non balanced transaction in book

Hello fellows,
I am jregistering transactions in ledger for sales journal in dolibarr version 10 but I get an error:
Try to insert a non balanced transaction in book for FA1908-0026. Canceled. Surely a bug.

I have checked all the ledgers (accounting account), and products in the mentioned invoices and compared the Debits and Credits and they seem to match, but I still get that error. I am also using multi-entity module, and this error is appearing in one of the entities. Also, some transactions went through successfully there are few invoices with these error. Please help if there is some extra information to use.

Hi Zodiac,
Have a look at the logs. I faced a similar problem, and in turned out to be due to “different trimming” of the accounting accounts in the various tables (I mean 411 was 4110 or 41100 somewhere else) and this prevented the proper loading of the accounting account information and of course resulted in a final unbalance blocking state…
Regards,
Marc

Thanks Simicar,
I checked the log and did not see anything of help. Also, out of more than 200 invoices, it is only about 12 which are giving this error message, while the others process well, and it is the same accounts which are used by the successful ones.

Ok, it is maybe totally unrelated then. However if we want to exclude this possibility completely, if you feel like modifying the code, you could modify the function fetch() in htdocs/accountancy/class/accountingaccount.class.php around line 170 from

                          if ($rowid) {
                                 $sql .= " a.rowid = " . (int) $rowid;
                        } elseif ($account_number) {
                                 $sql .= " a.account_number = '" . $this->db->escape($account_number) . "'";
                                 $sql .= " AND a.entity = ".$conf->entity;
                       }

to

                        if ($rowid) {
                                $sql .= " a.rowid = " . (int) $rowid;
                        } elseif ($account_number) {
                                $sql .= " TRIM(TRAILING '0' FROM a.account_number) = '" . $this->db->escape(rtrim($account_number,"0")) . "'";
                                // Ensure trailing 0 don't prevent finding the right account number !
                                $sql .= " AND a.entity = ".$conf->entity;
                        }

and tell us whether you still observe the same behaviour.
Regards,
Marc

Thanks, I tried that as well, but still nothing has changed.

Ok. In the same function you could try to print out the fetch result to ensure the account is readable by the entity trying to access it.
Regards,
Marc

Hi Zodiac, did you find a solution to this situation.
I have a similar situation, that is involving 2 invoices with multi currency being used on them.
Although the selljournals.php show a balanced transaction prior to trying to register the journal, it fails with the same message