Creating an Updating trigger
In PostgreSQL you have to create a trigger function that will perform the calculations and the use it in a trigger.

Example:

Create or replace function CalculQStockProduit() returns trigger as $$
begin;
 update QuantiteEnStock set NEW.QuantiteEnStock = NEW.QuantiteEnStock-NEW.Quantite;
return NEW;
end;
$$ language 'plpgsql';


Create trigger trgCalculQStockProduit after update on Produit
for each row execute procedure calc();


I would refer to trigger function in postgresql manual for better understanding

This is just a sample so you will have to work out the calculations needed.

PG Trigger functions

Choose according to your postgres version.

I have used plpgsql as language but there are various options. plpgsql, sql, plv8 etc etc