← Back to team overview

openerp-india team mailing list archive

[Bug 1027923] Re: openerp.sql_db: bad query: delete from account_account_type where id IN (x)

 

<FLAME-ON>
The modifications to the french PCG should have been subject to a FLAG DAY in order to signal site maintainers arrival of incompatible modifications necessitating migration!
</FLAME-ON>

The account plan in operation was based upon the previous French PCG,
which was modified in a incompatible manner.

Luckily, with a bit of head-scratching and pgadmin3, I was able to manually convert a few hundred account_account user-types to the 9 base types which were not adheared to in the previous release.
the upgrade (using -u all) then worked without error.

For other users, I would recommend a creating a migration wizard to
"upgrade" all user_types > 9 to the applicable value in the range 1..9.

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1027923

Title:
  openerp.sql_db: bad query: delete from account_account_type where id
  IN (x)

Status in OpenERP Addons (modules):
  New

Bug description:
  problem updating all since the latest pull from 6.1

  2012-07-23 12:49:05,161 9424 WARNING test1 openerp.modules.loading: Model account.analytic.plan is declared but cannot be loaded! (Perhaps a module was partially removed or renamed)
  2012-07-23 12:49:05,161 9424 WARNING test1 openerp.modules.loading: Model account.analytic.plan.line is declared but cannot be loaded! (Perhaps a module was partially removed or renamed)
  2012-07-23 12:49:05,162 9424 WARNING test1 openerp.modules.loading: Model account.analytic.plan.instance is declared but cannot be loaded! (Perhaps a module was partially removed or renamed)
  2012-07-23 12:49:05,162 9424 WARNING test1 openerp.modules.loading: Model account.analytic.plan.instance.line is declared but cannot be loaded! (Perhaps a module was partially removed or renamed)
  2012-07-23 12:49:05,163 9424 WARNING test1 openerp.modules.loading: Model analytic.plan.create.model is declared but cannot be loaded! (Perhaps a module was partially removed or renamed)
  2012-07-23 12:49:05,163 9424 WARNING test1 openerp.modules.loading: Model account.crossovered.analytic is declared but cannot be loaded! (Perhaps a module was partially removed or renamed)
  2012-07-23 12:49:05,370 9424 INFO test1 openerp.addons.base.ir.ir_model: Deleting 10@xxxxxxxxxxxxxxxxxxxx
  2012-07-23 12:49:05,375 9424 ERROR test1 openerp.sql_db: bad query: delete from account_account_type where id IN (10)
  Traceback (most recent call last):
    File "/home/richard/src/openerp/server/6.1/openerp/sql_db.py", line 212, in execute
      res = self._obj.execute(query, params)
  IntegrityError: null value in column "user_type" violates not-null constraint
  CONTEXT:  SQL statement "UPDATE ONLY "public"."account_account" SET "user_type" = NULL WHERE $1 OPERATOR(pg_catalog.=) "user_type""

  2012-07-23 12:49:05,376 9424 WARNING test1 openerp.addons.base.ir.ir_model: Could not delete obsolete record with id: 10 of model account.account.type
  There should be some relation that points to this resource
  You should manually fix this and restart with --update=module
  2012-07-23 12:49:05,376 9424 INFO test1 openerp.addons.base.ir.ir_model: Deleting 11@xxxxxxxxxxxxxxxxxxxx
  2012-07-23 12:49:05,379 9424 ERROR test1 openerp.sql_db: bad query: delete from account_account_type where id IN (11)
  Traceback (most recent call last):
    File "/home/richard/src/openerp/server/6.1/openerp/sql_db.py", line 212, in execute
      res = self._obj.execute(query, params)
  IntegrityError: null value in column "user_type" violates not-null constraint
  CONTEXT:  SQL statement "UPDATE ONLY "public"."account_account" SET "user_type" = NULL WHERE $1 OPERATOR(pg_catalog.=) "user_type""

  2012-07-23 12:49:05,379 9424 WARNING test1 openerp.addons.base.ir.ir_model: Could not delete obsolete record with id: 11 of model account.account.type
  There should be some relation that points to this resource
  You should manually fix this and restart with --update=module
  2012-07-23 12:49:05,380 9424 INFO test1 openerp.addons.base.ir.ir_model: Deleting 14@xxxxxxxxxxxxxxxxxxxx
  2012-07-23 12:49:05,382 9424 ERROR test1 openerp.sql_db: bad query: delete from account_account_type where id IN (14)
  Traceback (most recent call last):
    File "/home/richard/src/openerp/server/6.1/openerp/sql_db.py", line 212, in execute
      res = self._obj.execute(query, params)
  IntegrityError: null value in column "user_type" violates not-null constraint
  CONTEXT:  SQL statement "UPDATE ONLY "public"."account_account" SET "user_type" = NULL WHERE $1 OPERATOR(pg_catalog.=) "user_type""

  2012-07-23 12:49:05,383 9424 WARNING test1 openerp.addons.base.ir.ir_model: Could not delete obsolete record with id: 14 of model account.account.type
  There should be some relation that points to this resource
  You should manually fix this and restart with --update=module
  2012-07-23 12:49:05,383 9424 INFO test1 openerp.addons.base.ir.ir_model: Deleting 15@xxxxxxxxxxxxxxxxxxxx
  2012-07-23 12:49:05,386 9424 ERROR test1 openerp.sql_db: bad query: delete from account_account_type where id IN (15)
  Traceback (most recent call last):
    File "/home/richard/src/openerp/server/6.1/openerp/sql_db.py", line 212, in execute
      res = self._obj.execute(query, params)
  IntegrityError: null value in column "user_type" violates not-null constraint
  CONTEXT:  SQL statement "UPDATE ONLY "public"."account_account" SET "user_type" = NULL WHERE $1 OPERATOR(pg_catalog.=) "user_type""

  2012-07-23 12:49:05,391 9424 WARNING test1 openerp.addons.base.ir.ir_model: Could not delete obsolete record with id: 15 of model account.account.type
  There should be some relation that points to this resource
  You should manually fix this and restart with --update=module
  2012-07-23 12:49:05,391 9424 INFO test1 openerp.addons.base.ir.ir_model: Deleting 16@xxxxxxxxxxxxxxxxxxxx
  2012-07-23 12:49:05,394 9424 ERROR test1 openerp.sql_db: bad query: delete from account_account_type where id IN (16)
  Traceback (most recent call last):
    File "/home/richard/src/openerp/server/6.1/openerp/sql_db.py", line 212, in execute
      res = self._obj.execute(query, params)
  IntegrityError: null value in column "user_type" violates not-null constraint
  CONTEXT:  SQL statement "UPDATE ONLY "public"."account_account" SET "user_type" = NULL WHERE $1 OPERATOR(pg_catalog.=) "user_type""

  2012-07-23 12:49:05,394 9424 WARNING test1 openerp.addons.base.ir.ir_model: Could not delete obsolete record with id: 16 of model account.account.type
  There should be some relation that points to this resource
  You should manually fix this and restart with --update=module
  2012-07-23 12:49:05,394 9424 INFO test1 openerp.addons.base.ir.ir_model: Deleting 17@xxxxxxxxxxxxxxxxxxxx
  2012-07-23 12:49:05,398 9424 ERROR test1 openerp.sql_db: bad query: delete from account_account_type where id IN (17)
  Traceback (most recent call last):
    File "/home/richard/src/openerp/server/6.1/openerp/sql_db.py", line 212, in execute
      res = self._obj.execute(query, params)
  IntegrityError: null value in column "user_type" violates not-null constraint
  CONTEXT:  SQL statement "UPDATE ONLY "public"."account_account" SET "user_type" = NULL WHERE $1 OPERATOR(pg_catalog.=) "user_type""

  2012-07-23 12:49:05,398 9424 WARNING test1 openerp.addons.base.ir.ir_model: Could not delete obsolete record with id: 17 of model account.account.type
  There should be some relation that points to this resource
  You should manually fix this and restart with --update=module
  2012-07-23 12:49:05,398 9424 INFO test1 openerp.addons.base.ir.ir_model: Deleting 18@xxxxxxxxxxxxxxxxxxxx
  2012-07-23 12:49:05,401 9424 ERROR test1 openerp.sql_db: bad query: delete from account_account_type where id IN (18)
  Traceback (most recent call last):
    File "/home/richard/src/openerp/server/6.1/openerp/sql_db.py", line 212, in execute
      res = self._obj.execute(query, params)
  IntegrityError: null value in column "user_type" violates not-null constraint
  CONTEXT:  SQL statement "UPDATE ONLY "public"."account_account" SET "user_type" = NULL WHERE $1 OPERATOR(pg_catalog.=) "user_type""

  2012-07-23 12:49:05,425 9424 WARNING test1 openerp.addons.base.ir.ir_model: Could not delete obsolete record with id: 18 of model account.account.type
  There should be some relation that points to this resource
  You should manually fix this and restart with --update=module
  2012-07-23 12:49:05,425 9424 INFO test1 openerp.addons.base.ir.ir_model: Deleting 19@xxxxxxxxxxxxxxxxxxxx
  2012-07-23 12:49:05,430 9424 ERROR test1 openerp.sql_db: bad query: delete from account_account_type where id IN (19)
  Traceback (most recent call last):
    File "/home/richard/src/openerp/server/6.1/openerp/sql_db.py", line 212, in execute
      res = self._obj.execute(query, params)
  IntegrityError: null value in column "user_type" violates not-null constraint
  CONTEXT:  SQL statement "UPDATE ONLY "public"."account_account" SET "user_type" = NULL WHERE $1 OPERATOR(pg_catalog.=) "user_type""

  2012-07-23 12:49:05,431 9424 WARNING test1 openerp.addons.base.ir.ir_model: Could not delete obsolete record with id: 19 of model account.account.type
  There should be some relation that points to this resource
  You should manually fix this and restart with --update=module
  2012-07-23 12:49:05,431 9424 INFO test1 openerp.addons.base.ir.ir_model: Deleting 20@xxxxxxxxxxxxxxxxxxxx
  2012-07-23 12:49:05,435 9424 ERROR test1 openerp.sql_db: bad query: delete from account_account_type where id IN (20)
  Traceback (most recent call last):
    File "/home/richard/src/openerp/server/6.1/openerp/sql_db.py", line 212, in execute
      res = self._obj.execute(query, params)
  IntegrityError: null value in column "user_type" violates not-null constraint
  CONTEXT:  SQL statement "UPDATE ONLY "public"."account_account" SET "user_type" = NULL WHERE $1 OPERATOR(pg_catalog.=) "user_type""

  2012-07-23 12:49:05,436 9424 WARNING test1 openerp.addons.base.ir.ir_model: Could not delete obsolete record with id: 20 of model account.account.type
  There should be some relation that points to this resource
  You should manually fix this and restart with --update=module
  2012-07-23 12:49:05,437 9424 INFO test1 openerp.addons.base.ir.ir_model: Deleting 21@xxxxxxxxxxxxxxxxxxxx
  2012-07-23 12:49:05,441 9424 ERROR test1 openerp.sql_db: bad query: delete from account_account_type where id IN (21)
  Traceback (most recent call last):
    File "/home/richard/src/openerp/server/6.1/openerp/sql_db.py", line 212, in execute
      res = self._obj.execute(query, params)
  IntegrityError: null value in column "user_type" violates not-null constraint
  CONTEXT:  SQL statement "UPDATE ONLY "public"."account_account" SET "user_type" = NULL WHERE $1 OPERATOR(pg_catalog.=) "user_type""

  2012-07-23 12:49:05,442 9424 WARNING test1 openerp.addons.base.ir.ir_model: Could not delete obsolete record with id: 21 of model account.account.type
  There should be some relation that points to this resource
  You should manually fix this and restart with --update=module
  2012-07-23 12:49:05,442 9424 INFO test1 openerp.addons.base.ir.ir_model: Deleting 22@xxxxxxxxxxxxxxxxxxxx
  2012-07-23 12:49:05,447 9424 ERROR test1 openerp.sql_db: bad query: delete from account_account_type where id IN (22)
  Traceback (most recent call last):
    File "/home/richard/src/openerp/server/6.1/openerp/sql_db.py", line 212, in execute
      res = self._obj.execute(query, params)
  IntegrityError: null value in column "user_type" violates not-null constraint
  CONTEXT:  SQL statement "UPDATE ONLY "public"."account_account" SET "user_type" = NULL WHERE $1 OPERATOR(pg_catalog.=) "user_type""

  2012-07-23 12:49:05,448 9424 WARNING test1 openerp.addons.base.ir.ir_model: Could not delete obsolete record with id: 22 of model account.account.type
  There should be some relation that points to this resource
  You should manually fix this and restart with --update=module
  2012-07-23 12:49:05,457 9424 INFO test1 openerp.addons.base.ir.ir_model: Deleting 23@xxxxxxxxxxxxxxxxxxxx
  2012-07-23 12:49:05,462 9424 ERROR test1 openerp.sql_db: bad query: delete from account_account_type where id IN (23)
  Traceback (most recent call last):
    File "/home/richard/src/openerp/server/6.1/openerp/sql_db.py", line 212, in execute
      res = self._obj.execute(query, params)
  IntegrityError: null value in column "user_type" violates not-null constraint
  CONTEXT:  SQL statement "UPDATE ONLY "public"."account_account" SET "user_type" = NULL WHERE $1 OPERATOR(pg_catalog.=) "user_type""

  2012-07-23 12:49:05,486 9424 WARNING test1 openerp.addons.base.ir.ir_model: Could not delete obsolete record with id: 23 of model account.account.type
  There should be some relation that points to this resource
  You should manually fix this and restart with --update=module
  2012-07-23 12:49:05,487 9424 INFO test1 openerp.addons.base.ir.ir_model: Deleting 24@xxxxxxxxxxxxxxxxxxxx
  2012-07-23 12:49:05,490 9424 ERROR test1 openerp.sql_db: bad query: delete from account_account_type where id IN (24)
  Traceback (most recent call last):
    File "/home/richard/src/openerp/server/6.1/openerp/sql_db.py", line 212, in execute
      res = self._obj.execute(query, params)
  IntegrityError: null value in column "user_type" violates not-null constraint
  CONTEXT:  SQL statement "UPDATE ONLY "public"."account_account" SET "user_type" = NULL WHERE $1 OPERATOR(pg_catalog.=) "user_type""

  2012-07-23 12:49:05,490 9424 WARNING test1 openerp.addons.base.ir.ir_model: Could not delete obsolete record with id: 24 of model account.account.type
  There should be some relation that points to this resource
  You should manually fix this and restart with --update=module
  2012-07-23 12:49:05,491 9424 INFO test1 openerp.addons.base.ir.ir_model: Deleting 25@xxxxxxxxxxxxxxxxxxxx
  2012-07-23 12:49:05,496 9424 ERROR test1 openerp.sql_db: bad query: delete from account_account_type where id IN (25)
  Traceback (most recent call last):
    File "/home/richard/src/openerp/server/6.1/openerp/sql_db.py", line 212, in execute
      res = self._obj.execute(query, params)
  IntegrityError: null value in column "user_type" violates not-null constraint
  CONTEXT:  SQL statement "UPDATE ONLY "public"."account_account" SET "user_type" = NULL WHERE $1 OPERATOR(pg_catalog.=) "user_type""

  2012-07-23 12:49:05,509 9424 WARNING test1 openerp.addons.base.ir.ir_model: Could not delete obsolete record with id: 25 of model account.account.type
  There should be some relation that points to this resource
  You should manually fix this and restart with --update=module
  2012-07-23 12:49:05,510 9424 INFO test1 openerp.addons.base.ir.ir_model: Deleting 26@xxxxxxxxxxxxxxxxxxxx
  2012-07-23 12:49:05,513 9424 ERROR test1 openerp.sql_db: bad query: delete from account_account_type where id IN (26)
  Traceback (most recent call last):
    File "/home/richard/src/openerp/server/6.1/openerp/sql_db.py", line 212, in execute
      res = self._obj.execute(query, params)
  IntegrityError: null value in column "user_type" violates not-null constraint
  CONTEXT:  SQL statement "UPDATE ONLY "public"."account_account" SET "user_type" = NULL WHERE $1 OPERATOR(pg_catalog.=) "user_type""

  2012-07-23 12:49:05,514 9424 WARNING test1 openerp.addons.base.ir.ir_model: Could not delete obsolete record with id: 26 of model account.account.type
  There should be some relation that points to this resource
  You should manually fix this and restart with --update=module
  2012-07-23 12:49:05,514 9424 INFO test1 openerp.addons.base.ir.ir_model: Deleting 27@xxxxxxxxxxxxxxxxxxxx
  2012-07-23 12:49:05,518 9424 ERROR test1 openerp.sql_db: bad query: delete from account_account_type where id IN (27)
  Traceback (most recent call last):
    File "/home/richard/src/openerp/server/6.1/openerp/sql_db.py", line 212, in execute
      res = self._obj.execute(query, params)
  IntegrityError: null value in column "user_type" violates not-null constraint
  CONTEXT:  SQL statement "UPDATE ONLY "public"."account_account" SET "user_type" = NULL WHERE $1 OPERATOR(pg_catalog.=) "user_type""

  2012-07-23 12:49:05,519 9424 WARNING test1 openerp.addons.base.ir.ir_model: Could not delete obsolete record with id: 27 of model account.account.type
  There should be some relation that points to this resource
  You should manually fix this and restart with --update=module
  2012-07-23 12:49:05,519 9424 INFO test1 openerp.modules.loading: Modules loaded.
  2012-07-23 12:49:05,542 9424 INFO test1 openerp.service.web_services: successful login from 'admin' using database 'test1'

  ================
  local repository and dateabase up to date last week, an update since this weekend causes the problem.

  richard@x3200:~/src/openerp/addons/6.1$ bzr version-info
  revision-id: xal@xxxxxxxxxxx-20120723110455-ny5oicnpdtislyeg
  date: 2012-07-23 13:04:55 +0200
  build-date: 2012-07-23 14:55:13 +0200
  revno: 6912
  branch-nick: 6.1
  richard@x3200:~/src/openerp/addons/6.1$ cd ../..
  richard@x3200:~/src/openerp$ cd server/6.1/
  richard@x3200:~/src/openerp/server/6.1$ bzr version-info
  revision-id: launchpad_translations_on_behalf_of_openerp-20120723053050-uc6m7fi0o92l5wb9
  date: 2012-07-23 05:30:50 +0000
  build-date: 2012-07-23 14:55:32 +0200
  revno: 4245
  branch-nick: 6.1

  from pgadmin, here is the table output for account_account_type:
  1;1;"2012-05-02 08:22:22.906667";"";;"none";"";"view";"Root/View"
  2;1;"2012-05-02 08:22:22.906667";"";;"unreconciled";"";"receivable";"Receivable"
  3;1;"2012-05-02 08:22:22.906667";"";;"unreconciled";"";"payable";"Payable"
  4;1;"2012-05-02 08:22:22.906667";"";;"balance";"";"bank";"Bank"
  5;1;"2012-05-02 08:22:22.906667";"";;"balance";"";"cash";"Cash"
  6;1;"2012-05-02 08:22:22.906667";"";;"balance";"";"asset";"Asset"
  7;1;"2012-05-02 08:22:22.906667";"";;"balance";"";"liability";"Liability"
  8;1;"2012-05-02 08:22:22.906667";"";;"none";"";"income";"Income"
  9;1;"2012-05-02 08:22:22.906667";"";;"none";"";"expense";"Expense"
  10;1;"2012-05-02 08:22:54.876363";"";;"balance";"";"dettes";"Dettes long terme"
  11;1;"2012-05-02 08:22:54.876363";"";;"balance";"";"immobilization";"Immobilisations"
  14;1;"2012-05-02 08:22:54.876363";"";;"unreconciled";"";"receivable";"Receivable"
  15;1;"2012-05-02 08:22:54.876363";"";;"unreconciled";"";"payable";"Payable"
  16;1;"2012-05-02 08:22:54.876363";"";;"none";"";"view";"View"
  17;1;"2012-05-02 08:22:54.876363";"";;"none";"";"income";"Income"
  18;1;"2012-05-02 08:22:54.876363";"";;"none";"";"expense";"Expense"
  19;1;"2012-05-02 08:22:54.876363";"";;"unreconciled";"";"tax";"Tax"
  20;1;"2012-05-02 08:22:54.876363";"";;"balance";"";"bank";"Bank"
  21;1;"2012-05-02 08:22:54.876363";"";;"balance";"";"cash";"Cash"
  22;1;"2012-05-02 08:22:54.876363";"";;"balance";"";"asset";"Asset"
  23;1;"2012-05-02 08:22:54.876363";"";;"balance";"";"equity";"Equity"
  24;1;"2012-05-02 08:22:54.876363";"";;"balance";"";"provision";"Provisions"
  25;1;"2012-05-02 08:22:54.876363";"";;"balance";"";"commitment";"Engagements"
  26;1;"2012-05-02 08:22:54.876363";"";;"balance";"";"current asset";"Actif circulant"
  27;1;"2012-05-02 08:22:54.876363";"";;"none";"";"special";"Comptes spéciaux"
  ;;"";"";;"";"";"";""

  If I try to manually delete, for example, id=10, the constraint error is displayed:
  Une erreur s'est produite :

  ERROR:  null value in column "user_type" violates not-null constraint
  CONTEXT:  SQL statement "UPDATE ONLY "public"."account_account" SET "user_type" = NULL WHERE $1 OPERATOR(pg_catalog.=) "user_type""

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1027923/+subscriptions


References