Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Adding new bank account: "Constraint Error The code of the account must be unique per company !"

By
Mario Gielissen | Openworx
on 11/4/15, 4:19 AM 711 views

When adding a second bankaccount under Accounting: "The code of the account must be unique per company"

Odoo log:

2015-11-04 09:17:16,527 5068 ERROR XX openerp.sql_db: bad query: INSERT INTO "account_account" ("id", "code", "reconcile", "type", "company_id", "centralized", "user_type", "parent_id", "currency_mode", "active", "name", "create_uid", "write_uid", "create_date", "write_date") VALUES(nextval('account_account_id_seq'), '100001', false, 'liquidity', 1, false, 1, 153, 'current', true, 'BE BE68 5390 0754 7034', 1, 1, (now() at time zone 'UTC'), (now() at time zone 'UTC')) RETURNING id
Traceback (most recent call last):
File "/opt/odoo/odoo-server/openerp/sql_db.py", line 234, in execute
res = self._obj.execute(query, params)
IntegrityError: duplicate key value violates unique constraint "account_account_code_company_uniq"
DETAIL: Key (code, company_id)=(100001, 1) already exists.

2015-11-04 09:17:16,528 5068 ERROR XX openerp.http: Exception during JSON request handling.
Traceback (most recent call last):
File "/opt/odoo/odoo-server/openerp/http.py", line 537, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/opt/odoo/odoo-server/openerp/http.py", line 574, in dispatch
result = self._call_function(**self.params)
File "/opt/odoo/odoo-server/openerp/http.py", line 310, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/service/model.py", line 129, in wrapper
raise openerp.osv.orm.except_orm(_('Constraint Error'), tr(registry._sql_error[key], 'sql_constraint') or inst[0])
except_orm: ('Constraint Error', 'The code of the account must be unique per company !')

Edit: It was an inactive account 100001, deleting this solved the problem.

Mario Gielissen | Openworx
on 11/4/15, 5:27 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 11/4/15, 4:19 AM
Seen: 711 times
Last updated: 11/4/15, 5:27 AM