This question has been flagged
5009 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 !')

Avatar
Discard
Author

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