[FIX] base_contact: enable PL/pgSQL before using it

lp bug: https://launchpad.net/bugs/701985 fixed

bzr revid: odo@openerp.com-20110113142904-zl7gb9cywkhd8687
This commit is contained in:
Olivier Dony 2011-01-13 15:29:04 +01:00
parent 8634d6057a
commit 9d3113fa43
1 changed files with 13 additions and 8 deletions

View File

@ -37,6 +37,11 @@ class base_contact_installer(osv.osv_memory):
"""
obj = self.pool.get("base.contact.installer").browse(cr, uid, uid, context=context)
if obj.migrate:
# Enable PL/pgSQL if not enabled yet in the database
cr.execute("SELECT 1 FROM pg_language WHERE lanname = 'plpgsql'")
if not cr.fetchone():
cr.execute("CREATE LANGUAGE plpgsql;")
cr.execute("""DROP TRIGGER IF EXISTS contactjob on res_partner_contact;
CREATE OR REPLACE FUNCTION add_to_job() RETURNS TRIGGER AS $contactjob$
DECLARE