← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 705797] Re: [trunk][account][low] Inversion of two columns in a many2many field

 

Server: revno. 3322
Client-web: revno. 4468
Addons: revno. 4380

1. Create a new database, like test_inversion
2. Add account module
3. Create one CashBox in Bank and Cash
4. Open this CashBox, then close it.
5. Create a new one and open it
6. Create 2 cash transactions
7. Do what is necessary to close the cashbox (add some money into cashbox) then close it
8. Go to the database with "psql test_inversion"
9. Do this : 
    \d account_bank_statement_line_move_rel

It returns this : 
"account_bank_statement_line_move_rel_move_id_fkey" FOREIGN KEY (move_id) REFERENCES account_bank_statement_line(id) ON DELETE CASCADE
"account_bank_statement_line_move_rel_statement_id_fkey" FOREIGN KEY (statement_id) REFERENCES account_move(id) ON DELETE CASCADE

That show us that a statement_id references an account move ??? And a
move_id references an account bank statement line ???

It's not a problem of integrity or function error. It's just a
consistency problem.

You can easily understand that by requesting the content of the table :

    select * from account_bank_statement_line_move_rel;
    select * from account_move;
    select * from account_bank_statement_line;

Link all ids you see. They seems not to be where they should be.

The branch I put forward aims to resolve this.

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/705797

Title:
  [trunk][account][low] Inversion of two columns in a many2many field

Status in OpenERP Modules (addons):
  Invalid

Bug description:
  Addons: revno. 4372

  By browsing the table account_bank_statement_line_move_rel in a database created with the trunk, I see that this table have two columns : 
  - move_id
  - statement_id

  The first should refers to account_move, the second to
  account_bank_statement.

  By using openerp, I have some values inserted into the database. It
  seems that move_id contains values that should be in statement_id and
  inversely.

  In fact it's easy to change this. You just have to go to
  account/account_bank_statement.py#465-467 and change lines :

  'move_ids': fields.many2many('account.move',
      'account_bank_statement_line_move_rel', 'move_id','statement_id',
      'Moves'),

  by :

  'move_ids': fields.many2many('account.move',
      'account_bank_statement_line_move_rel', 'statement_id','move_id',
      'Moves'),

  It's not so important because of ORM methods use (like browse, etc.).
  But imagine someone develop a module which use a sql query like in
  account/account_move_line.py#786-790 but on
  account_bank_statement_line_move_rel ... that will affect the
  developer's result.

  Thanks for advance about this non-critical bug but important for those
  who parses the database and develops modules ;)





References