← Back to team overview

openerp-india team mailing list archive

[Bug 928458] Re: Generate Opening Entries wizard crashes

 

Ok, I found out what happened.

The difference between the two databases:
The failing database had one purchase order in EUROs
The company currency is USD
The purchase order was exactly created between the dates that the database is correct and is failing.

The cause of the error is that (apparently) in the table
account_move_line an attempt is made to set the field centralisation to
'currency'. The centralisation field is varchar(6) so this causes the
exception.

I have seen that in account.py a new record is created with centralisation: 'currency' (line 1400). It is likely that the problem is induced here.
However I am not sure whether the problem is in the field descriptor of account_move_line.centralisation OR that the value 'currency' is incorrect.

I have changed the descriptor of account_move_line.centralisation to
varchar(8) and now the wizard does not raise an exception anymore.
Although this seems to be a workaround I don't have the faintest idea
what other side-effects this could have if 'currency' is a value which
is not normally written into this field.

jlinkels

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/928458

Title:
  Generate Opening Entries wizard crashes

Status in OpenERP Addons (modules):
  New

Bug description:
  When I run the wizard "Generate Opening Entries" for a new fiscal
  year, the server raises an exception. I ran the server with the debug
  option, and these are the messages:

  [2012-02-07 16:06:55,423][opening] ERROR:web-services:Uncaught exception
  Traceback (most recent call last):
    File "/usr/share/pyshared/openerp-server/osv/osv.py", line 122, in wrapper
      return f(self, dbname, *args, **kwargs)
    File "/usr/share/pyshared/openerp-server/osv/osv.py", line 176, in execute
      res = self.execute_cr(cr, uid, obj, method, *args, **kw)
    File "/usr/share/pyshared/openerp-server/osv/osv.py", line 167, in execute_cr
      return getattr(object, method)(cr, uid, *args, **kw)
    File "/usr/share/pyshared/openerp-server/addons/account/wizard/account_fiscalyear_close.py", line 210, in data_save
      obj_acc_move_line.create(cr, uid, move)
    File "/usr/share/pyshared/openerp-server/addons/account/account_move_line.py", line 1362, in create
      tmp = move_obj.validate(cr, uid, [vals['move_id']], context)
    File "/usr/share/pyshared/openerp-server/addons/account/account.py", line 1496, in validate
      self._centralise(cr, uid, move, 'debit', context=context)
    File "/usr/share/pyshared/openerp-server/addons/account/account.py", line 1410, in _centralise
      }, context)
    File "/usr/share/pyshared/openerp-server/addons/account/account_move_line.py", line 1296, in create
      result = super(osv.osv, self).create(cr, uid, vals, context=context)
    File "/usr/share/pyshared/openerp-server/osv/orm.py", line 3651, in create
      cr.execute('insert into "'+self._table+'" (id'+upd0+") values ("+str(id_new)+upd1+')', tuple(upd2))
    File "/usr/share/pyshared/openerp-server/sql_db.py", line 78, in wrapper
      return f(self, *args, **kwargs)
    File "/usr/share/pyshared/openerp-server/sql_db.py", line 131, in execute
      res = self._obj.execute(query, params)
  DataError: value too long for type character varying(6)

  > /usr/share/pyshared/openerp-server/sql_db.py(131)execute()

  Upon inspection of the query and params variables, this is the value:
  (Pdb) print query
  insert into "account_move_line" (id,"account_id","credit","centralisation","company_id","name","currency_id","journal_id","state","period_id","debit","date","date_created","amount_currency","move_id","blocked",create_uid,create_date) values (236,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,now())
  (Pdb) print params
  (508, '0.00', 'currency', '1', 'Currency Adjustment', 1, 11, 'draft', 13, '0.00', '2012-01-31', '2012-02-07', '279.71', 40, 'False', 1)
  (Pdb) 

  I can't exactly tell how to build a database to reproduce this.
  I have made regular backups of this database. On 2011-11-07 I have saved a version which does process the wizard correctly. Then, the
  next time I have backed up the database is 2011-11-10, and that version raises the exception..
  There are a minimal amount of transactions recorded in the database between the two dates. So few I can't even tell apart what the differences are. The total number of transactions is extremely small as well.

  This means that if you use a regular database you won't be able to
  reproduce the bug. OTOH, I did not mess with the database in any way,
  so something must have been happened that through entries using the
  GTK user interface it is possible to induce this behaviour.

  If someone wants to look into the databases, I can post them
  somewhere.

  jlinkels

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/928458/+subscriptions


References