Error in return of account_voucher function

Bug #1197469 reported by Jose Moreno

This bug report was converted into a question: question #235311: Error in return of account_voucher function.

8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Invalid
Undecided
Unassigned

Bug Description

Move_ID True
Number d-01630223632233003511/2013/6055/1
[2013-07-03 11:42:08,999][20130701diana] ERROR:db.cursor:Programming error: operator does not exist: integer = boolean
LINE 1: ...='DP 369852',write_uid=1,write_date=now() where id IN (true)
                                                              ^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
, in query update account_move set "ref"=%s,write_uid=%s,write_date=now() where id IN %s
[2013-07-03 11:42:08,999][20130701diana] ERROR:web-services:Uncaught exception
Traceback (most recent call last):
  File "/home/jmoreno/instancia/6.0/server/bin/osv/osv.py", line 122, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/jmoreno/instancia/6.0/server/bin/osv/osv.py", line 176, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/jmoreno/instancia/6.0/server/bin/osv/osv.py", line 167, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/jmoreno/instancia/6.0/modules/sisb_banking/model/account_bank_statement.py", line 121, in button_confirm_bank
    uid, ids, context=context)
  File "/home/jmoreno/instancia/6.0/modules/account/account_bank_statement.py", line 355, in button_confirm_bank
    self.create_move_from_st_line(cr, uid, st_line.id, company_currency_id, st_line_number, context)
  File "/home/jmoreno/instancia/6.0/modules/sisb_banking/model/account_bank_statement.py", line 45, in create_move_from_st_line
    res = account_move_obj.write(cr, uid, mov_id, {'ref': st_line.name,}, context=context)
  File "/home/jmoreno/instancia/6.0/modules/account/account.py", line 1257, in write
    result = super(osv.osv, self).write(cr, uid, ids, vals, c)
  File "/home/jmoreno/instancia/6.0/server/bin/osv/orm.py", line 3443, in write
    'where id IN %s', upd1 + [sub_ids])
  File "/home/jmoreno/instancia/6.0/server/bin/sql_db.py", line 78, in wrapper
    return f(self, *args, **kwargs)
  File "/home/jmoreno/instancia/6.0/server/bin/sql_db.py", line 131, in execute
    res = self._obj.execute(query, params)
ProgrammingError: operator does not exist: integer = boolean
LINE 1: ...='DP 369852',write_uid=1,write_date=now() where id IN (true)
                                                              ^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.

[2013-07-03 11:42:09,002][20130701diana] DEBUG:web-services:netrpc: rpc-dispatching exception
Traceback (most recent call last):
  File "/home/jmoreno/instancia/6.0/server/bin/service/netrpc_server.py", line 70, in run
    result = self.dispatch(msg[0], msg[1], msg[2:])
  File "/home/jmoreno/instancia/6.0/server/bin/netsvc.py", line 499, in dispatch
    raise OpenERPDispatcherException(e, tb_s)
OpenERPDispatcherException

the function to run in account_voucher this overwriting the return value to a boolean should return an integer, as well was defined in the original function.

Original Inherit Fuction:

def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, next_number, context=None):
        voucher_obj = self.pool.get('account.voucher')
        wf_service = netsvc.LocalService("workflow")
        move_line_obj = self.pool.get('account.move.line')
        bank_st_line_obj = self.pool.get('account.bank.statement.line')
        st_line = bank_st_line_obj.browse(cr, uid, st_line_id, context=context)
        if st_line.voucher_id:
            voucher_obj.write(cr, uid, [st_line.voucher_id.id],
                            {'number': next_number,
                            'date': st_line.date,
                            'period_id': st_line.statement_id.period_id.id},
                            context=context)
            if st_line.voucher_id.state == 'cancel':
                voucher_obj.action_cancel_draft(cr, uid, [st_line.voucher_id.id], context=context)
            wf_service.trg_validate(uid, 'account.voucher', st_line.voucher_id.id, 'proforma_voucher', cr)

            v = voucher_obj.browse(cr, uid, st_line.voucher_id.id, context=context)
            bank_st_line_obj.write(cr, uid, [st_line_id], {
                'move_ids': [(4, v.move_id.id, False)]
            })

            return move_line_obj.write(cr, uid, [x.id for x in v.move_ids], {'statement_id': st_line.statement_id.id}, context=context)
        return super(account_bank_statement, self).create_move_from_st_line(cr, uid, st_line.id, company_currency_id, next_number, context=context)

Proposal for the correction function:

def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, next_number, context=None):
        voucher_obj = self.pool.get('account.voucher')
        wf_service = netsvc.LocalService("workflow")
        move_line_obj = self.pool.get('account.move.line')
        bank_st_line_obj = self.pool.get('account.bank.statement.line')
        st_line = bank_st_line_obj.browse(cr, uid, st_line_id, context=context)
        if st_line.voucher_id:
            voucher_obj.write(cr, uid, [st_line.voucher_id.id],
                            {'number': next_number,
                            'date': st_line.date,
                            'period_id': st_line.statement_id.period_id.id},
                            context=context)
            if st_line.voucher_id.state == 'cancel':
                voucher_obj.action_cancel_draft(cr, uid, [st_line.voucher_id.id], context=context)
            wf_service.trg_validate(uid, 'account.voucher', st_line.voucher_id.id, 'proforma_voucher', cr)

            v = voucher_obj.browse(cr, uid, st_line.voucher_id.id, context=context)
            bank_st_line_obj.write(cr, uid, [st_line_id], {
                'move_ids': [(4, v.move_id.id, False)]
            })

            move_line_obj.write(cr, uid, [x.id for x in v.move_ids], {'statement_id': st_line.statement_id.id}, context=context)
        return super(account_bank_statement, self).create_move_from_st_line(cr, uid, st_line.id, company_currency_id, next_number, context=context)

Revision history for this message
Jose Moreno (jmoreno-8) wrote :
Revision history for this message
Twinkle Christian(OpenERP) (tch-openerp) wrote :

Hello Jose,

Would you please provide your precise steps to reproduce this bug or any video ?

Thanks & waiting for your answer.

Changed in openobject-addons:
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for OpenERP Addons because there has been no activity for 60 days.]

Changed in openobject-addons:
status: Incomplete → Expired
Changed in openobject-addons:
status: Expired → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.