Untitled
unknown
python
2 years ago
776 B
9
Indexable
# my_module.py
from odoo import api, SUPERUSER_ID
def post_install_hook(cr, registry):
env = api.Environment(cr, SUPERUSER_ID, {})
# Enable uuid-ossp extension
env.cr.execute("CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";")
# Create trigger on account_move
env.cr.execute("""
-- Example trigger for account_move table
CREATE OR REPLACE FUNCTION account_move_trigger_function()
RETURNS TRIGGER AS $$
BEGIN
-- Trigger logic here
RETURN NEW;
END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER account_move_trigger
BEFORE INSERT OR UPDATE ON account_move
FOR EACH ROW
EXECUTE FUNCTION account_move_trigger_function();
""")
Editor is loading...
Leave a Comment