Summarize all the values from another entity

Hello guys!
I am new In Cuba Studio, please help me to solve the problem.
I have 2 entities:

  1. Stocks shows product name and its total quantity in a warehouse,
  2. Specification specifies the details of each product e.g. its receipt number, price, quantity of each single delivery etc.

What is the easiest and most understandable way for a newbie to make the quantity in Stocks counted based on Specification for every product? e.g. I have 2 deliveries of the same product name “door” and the quantity is 120 and 200 for each. Therefore, I want to see the “door” quantity 320 in Stocks being updated automatically. Please see my project attached.https://file.io/04mz6bqiS6Dx

Hi,
There is an API called EntityChangedEvent
https://doc.cuba-platform.com/manual-7.2/entityChangedEvent.html

It is a hook called when an entity is being created / edited / removed.
You may use it to track changes in the Specification and update related Stocks accordingly.