python-sql

Message56

Author risto3
Recipients
Date 2017-07-29.10:57:02
Message-id <1501318623.37.0.863799670365.bug54@tryton.org>
In-reply-to
I encounter an issue with openerp2tryton in
migrate_account_balance
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 line.id 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.select(line.debit, line.credit, 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'),
state='valid')
Record(debit=Decimal('0.00'), credit=Decimal('38.00'),
state='valid')
Record(debit=Decimal('0.00'), credit=Decimal('7131.00'),
state='valid')
Record(debit=Decimal('0.00'), credit=Decimal('7131.00'),
state='valid')
Record(debit=Decimal('0.00'), credit=Decimal('7133.00'),
state='valid')
Record(debit=Decimal('0.00'), credit=Decimal('1412.00'),
state='valid')
Record(debit=Decimal('0.00'), credit=Decimal('28125.00'),
state='valid')

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()?
History
Date User Action Args
2017-07-29 10:57:03risto3setmessageid: <1501318623.37.0.863799670365.bug54@tryton.org>
2017-07-29 10:57:03risto3linkbug54 messages
2017-07-29 10:57:02risto3create