sumRelated works wrong

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ciucaadrian11
    Junior Member
    • Oct 2019
    • 25

    sumRelated works wrong

    Hello everyone,

    I have the following issue and I don't know how to proceed. For example:

    I have the entity "Stock" and inside the entity I have created the following fields: initial quantity and current quantity (I set this field to be read only).
    Then I created a new entity called "Outgoing tool" and I linked it to the "Stock" through the option many-to-many.
    Inside the entity "Outgoing tool" I have created the field named "Quantity".

    Then, I placed the following formula in entity "Stock" : currentStock=initialStock-entity\sumRelated('outgoingTools','stock');

    After I made the first entry in the "Outgoing tool", the value from currentStock has not changed. After I create the second record in "Outgoing tool", the value from currentStock has changed depending on the first record. The formula did not calculate the value from the two records based on the initial stock.

    It is there a bug? Or I missed something?

    Sorry for my english
    Thank you very much in advance!
    Best regards,
    Adrian
  • Maximus
    Senior Member
    • Nov 2018
    • 2731

    #2
    Hello,
    The formula looks good. Try to trigger the formula again, then refresh a web page and check the result.
    Is there any formula error in EspoCRM log?

    Comment

    • ciucaadrian11
      Junior Member
      • Oct 2019
      • 25

      #3
      Hello Maximus,
      Thank you for your help.
      I placed again the formula. I did point on clear Clear Cache and Rebuild and then I refreshed the browser. Same problem. Nothing has change. I found on forum same problem in the past. (https://forum.espocrm.com/forum/bug-...elated-records). I replaced the SumRelatedType.php with the fixed one as was mentioned in the forum topic, but nothing has change.

      Thank you very much again for your support!
      I hope to find a solution.

      Comment

      Working...