odoo / odoo

Odoo. Open Source Apps To Grow Your Business.
https://www.odoo.com
Other
37.41k stars 24.32k forks source link

'Cannot create unbalanced journal entry.' while Import #33469

Closed bhaveshselarka closed 4 years ago

bhaveshselarka commented 5 years ago

Impacted versions: v10, v11

http://521675-10-0-4039fc.runbot11.odoo.com/web?debug=1#model=account.move&action=import http://521681-11-0-daf976.runbot17.odoo.com/web?#model=account.move&action=import

account.move (4).csv.zip

Simply trying to import Journal entries. Here I have attached the sample file as well.

gdgellatly commented 5 years ago

No you can't, its well known you can't import journal entries via the standard csv import. Plenty of other solutions exist. Odoo themselves has a tool somewhere, and OCA too.

bhaveshselarka commented 5 years ago

@sswapnesh @Yenthe666 Any Idea about this? Please let me know if you have.

bhaveshselarka commented 5 years ago

@gdgellatly I have found this one. But a lot more depended on modules which are not required.

https://apps.odoo.com/apps/modules/10.0/account_move_csv_import/

gdgellatly commented 5 years ago

@bhaveshselarka I don't them so well. When I hit this we just used odoo shell scripts to connect to a remote system, transform the data and create the entries. But if all your data is in csv's with correct column headings, it would be easy to use a shell script to do the creation.

Alternatively, you could just disable the constraint for import if you are sure your data is correct.

sswapnesh commented 5 years ago

Or Create Python function which reads and Creates move (and AML). Ps: It would be faster than debugging this error on Import..

pedrobaeza commented 4 years ago

Closing this as answered and no Odoo issue at all.

medianeclick commented 4 years ago

ONLY DO THIS IF YOU KNOW JOURNAL ENTRY DATA IS BALANCED: You have to comment line in file account_move.py what validates this unbalanced journal in file (this could be different in your version odoo-12.0.post20190618-py3.7.egg)

/opt/bitnami/apps/odoo/lib/odoo-12.0.post20190618-py3.7.egg/odoo/addons/account/models

  1. replace this line : if len(self.cr.fetchall()) != 0: raise UserError(("Cannot create unbalanced journal entry."))

  2. putting in comment line

    if len(self._cr.fetchall()) != 0:

        #raise UserError(_("Cannot create unbalanced journal entry."))
  3. RESTART ODOO AND APACHE

  4. IMPORT YOUR DATA (successful import)

  5. AFTER THAT UNCOMMENT THE LINE (in 2) TO PUT THE RIGHT CODE AGAIN

  6. RESTART ODOO AND APACHE