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()
# 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: