Error in return of account_voucher function

Asked by Jose Moreno

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)

Question information

Language:
English Edit question
Status:
Answered
For:
Odoo Addons (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:

This question was originally filed as bug #1197469.

Revision history for this message
Launchpad Janitor (janitor) said :
#1

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

Revision history for this message
Serpent Consulting Services (serpent-consulting-services) said :
#2

Jose,

This seems probably due to custom module where your module sends move_id to be a boolean.

Would it be possible for you to send the module here, so we can end up with a solution, either for your module or for core 6.0 ?

Thanks.

Revision history for this message
Serpent Consulting Services (serpent-consulting-services) said :
#3

Jose,

Please share the line of code you have written for calling super method.

Thanks.

Can you help with this problem?

Provide an answer of your own, or ask Jose Moreno for more information if necessary.

To post a message you must log in.