Bug 54

Title: select seems to prune multiple rows
Type: behavior Severity: major
Components: Versions:
Status: new Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: ced, risto3
Priority: Keywords:

Created on 2017-07-29 10:57 by risto3, last changed 2017-07-29 17:32 by risto3.

msg56 Author: [hidden] (risto3) Date: 2017-07-29 10:57
I encounter an issue with openerp2tryton in
where there are missing move lines returned (select
statement at line 1051).

After debugging a bit it seems in oerp the values selected
are not unique
so I needed to add to the select statement to get
over the issue.

testing directly in python interpreter and avoiding the
joins, it seems okay:
>>> ...
>>> line = Table('account_move_line')
>>> query =,, line.state,
...     where=((line.move_id == 1) & (line.account_id == 458)))
>>> cur.execute(*query)
>>> cur
<cursor object at 0x7f2070f72b48; closed: 0>
>>> for line in cur:
...     line
Record(debit=Decimal('0.00'), credit=Decimal('3918.00'),
Record(debit=Decimal('0.00'), credit=Decimal('38.00'),
Record(debit=Decimal('0.00'), credit=Decimal('7131.00'),
Record(debit=Decimal('0.00'), credit=Decimal('7131.00'),
Record(debit=Decimal('0.00'), credit=Decimal('7133.00'),
Record(debit=Decimal('0.00'), credit=Decimal('1412.00'),
Record(debit=Decimal('0.00'), credit=Decimal('28125.00'),

the two lines with credit == '7131.00' are where the issue
comes up returning only one record.

is this perhaps an issue where somewhere update() is used
instead of append()?
msg57 Author: [hidden] (ced) Date: 2017-07-29 11:47
It is probably data integrity that is bad and so joins are
not unique.
I see no python-sql issue here.
msg58 Author: [hidden] (risto3) Date: 2017-07-29 17:32
no, nothing wrong with the data, just that I needed to
revamp the query statement when I torched the Sum() and
started pulling in each move line both its debit and credit. 
Turns out using id for uniqueness is not such a bad idea if
continuing with such inner joins.
Sorry for the rusty noise.
Date User Action Args
2017-07-29 17:32:27risto3setmessages: + msg58
2017-07-29 11:47:13cedsetresolution: rejected
messages: + msg57
nosy: + ced
2017-07-29 10:57:03risto3create