In odoo, I needed an update trigger, which would not let any user to update inserted data. I used following trigger function for rejecting update. The functio and trigger did work but it gives error TypeError: unsupported operand type(s) for /: 'NoneType' and 'float'. How can I resolve this ?
Function:
create function check_id_change() returns trigger language plpgsql as $account_invoice$
begin
if (TG_OP='UPDATE') THEN
RAISE NOTICE 'CANNOT EDIT RECORDS';
RETURN OLD;
END IF;
RETURN NULL;
END;
$account_invoice$;
Trigger:
create trigger check_update_trigger
before update on account_invoice
for each row
execute procedure check_id_change();