[MERGE]
authorChristophe Simonis <christophe@tinyerp.com>
Wed, 10 Dec 2008 14:41:13 +0000 (15:41 +0100)
committerChristophe Simonis <christophe@tinyerp.com>
Wed, 10 Dec 2008 14:41:13 +0000 (15:41 +0100)
bzr revid: christophe@tinyerp.com-20081210144113-6wdfu8mwpsojl4la

1  2 
bin/addons/__init__.py
bin/addons/base/module/module.py
bin/osv/expression.py
bin/osv/fields.py
bin/osv/orm.py

@@@ -487,14 -488,16 +488,16 @@@ def load_module_graph(cr, graph, status
                      else:
                          tools.convert_xml_import(cr, m, fp, idref, noupdate=True, **kwargs)
                      fp.close()
 -                cr.execute('update ir_module_module set demo=%s where id=%d', (True, mid))
 +                cr.execute('update ir_module_module set demo=%s where id=%s', (True, mid))
              package_todo.append(package.name)
              ver = release.major_version + '.' + package.data.get('version', '1.0')
 -            cr.execute("update ir_module_module set state='installed', latest_version=%s where id=%d", (ver, mid,))
 +            cr.execute("update ir_module_module set state='installed', latest_version=%s where id=%s", (ver, mid,))
              cr.commit()
  
-             # Update translations for all installed languages
+             # Set new modules and dependencies
              modobj = pool.get('ir.module.module')
+             # Update translations for all installed languages
              if modobj:
                  modobj.update_translations(cr, 1, [mid], None)
                  cr.commit()
Simple merge
Simple merge
Simple merge
diff --cc bin/osv/orm.py
@@@ -1518,16 -1525,22 +1522,22 @@@ class orm(orm_template)
                                      # We update varchar size, otherwise, we keep DB size
                                      # to avoid truncated string...
                                      if f_pg_size < f.size:
 -                                        cr.execute("ALTER TABLE \"%s\" RENAME COLUMN \"%s\" TO temp_change_size" % (self._table, k))
 -                                        cr.execute("ALTER TABLE \"%s\" ADD COLUMN \"%s\" VARCHAR(%d)" % (self._table, k, f.size))
 -                                        cr.execute("UPDATE \"%s\" SET \"%s\"=temp_change_size::VARCHAR(%d)" % (self._table, k, f.size))
 -                                        cr.execute("ALTER TABLE \"%s\" DROP COLUMN temp_change_size" % (self._table,))
 +                                        cr.execute('ALTER TABLE "%s" RENAME COLUMN "%s" TO temp_change_size' % (self._table, k))
 +                                        cr.execute('ALTER TABLE "%s" ADD COLUMN "%s" VARCHAR(%d)' % (self._table, k, f.size))
 +                                        cr.execute('UPDATE "%s" SET "%s"=temp_change_size::VARCHAR(%d)' % (self._table, k, f.size))
 +                                        cr.execute('ALTER TABLE "%s" DROP COLUMN temp_change_size' % (self._table,))
                                          cr.commit()
+                             if f_pg_type == 'varchar' and f._type == 'text':
+                                         cr.execute("ALTER TABLE \"%s\" RENAME COLUMN \"%s\" TO temp_change_type" % (self._table, k))
+                                         cr.execute("ALTER TABLE \"%s\" ADD COLUMN \"%s\" text " % (self._table, k))
+                                         cr.execute("UPDATE \"%s\" SET \"%s\"=temp_change_type" % (self._table, k))
+                                         cr.execute("ALTER TABLE \"%s\" DROP COLUMN temp_change_type" % (self._table,))
+                                         cr.commit()
                              if f_pg_type == 'date' and f._type == 'datetime':
 -                                        cr.execute("ALTER TABLE \"%s\" RENAME COLUMN \"%s\" TO temp_change_type" % (self._table, k))
 -                                        cr.execute("ALTER TABLE \"%s\" ADD COLUMN \"%s\" TIMESTAMP " % (self._table, k))
 -                                        cr.execute("UPDATE \"%s\" SET \"%s\"=temp_change_type::TIMESTAMP" % (self._table, k))
 -                                        cr.execute("ALTER TABLE \"%s\" DROP COLUMN temp_change_type" % (self._table,))
 +                                        cr.execute('ALTER TABLE "%s" RENAME COLUMN "%s" TO temp_change_type' % (self._table, k))
 +                                        cr.execute('ALTER TABLE "%s" ADD COLUMN "%s" TIMESTAMP' % (self._table, k))
 +                                        cr.execute('UPDATE "%s" SET "%s"=temp_change_type::TIMESTAMP' % (self._table, k))
 +                                        cr.execute('ALTER TABLE "%s" DROP COLUMN temp_change_type' % (self._table,))
                                          cr.commit()
                              # if the field is required and hasn't got a NOT NULL constraint
                              if f.required and f_pg_notnull == 0: