Announcement

Collapse
No announcement yet.

client side : pass value from parent one2many to child

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Originally posted by telecastg View Post
    I understand better thanks.

    So do you want to be able to set the "Periode" value at "PayrollItem" even if its different from the "Periode" value in "Payroll" ? Wouldn't that make it inconsistent ?

    => No .. PayrollItem->periode must be same as Payroll->periode. (inherit)

    For example is it acceptable that "Payroll" which is parent of "PayrollItem" has a "Periode" value of "202101" but "PayrollItem" which is child of "Payroll" have a "Periode" value of "202102" ?

    => No.. it's related.. so same periode in Payroll and PayrollItem. This is why it's bug actually,
    sample :
    Payroll->get('periodeId') give id "1234cfvregecck"
    Payroll->get('periode') give "202101"

    PayrollItem->get('periodeId') => give "202101". => here must give "1234cfvregecck"
    PayrollItem->get('periode') => give "202101"


    Hello telecastg
    PayrollItem->periode <= Payroll->periode <= periode.

    all is one2many relation.
    one periode have many payroll
    one payroll have many payrollItem
    one periode have many payrollItem. <= here payrollItem have same periode from Payroll ..have same from Periode

    i need periode in payrollItem for business calculate (more easy for me)

    ​​​​​​​Regards



    Comment


    • #17
      Hello item

      i need periode in payrollItem for business calculate (more easy for me)
      Do you want:

      1)Just to see "periode" when you are creating a "PayrollItem" ?

      2) Store "periode" in the "payroll_item" table as "periode_id"

      3) Use "periode" only in front end when working with "PayrollItem" (nonStorable field) ?

      For business calculate do you mean front end or back end ?

      Best Regards

      Comment


      • item
        item commented
        Editing a comment
        Hello @telecastg

        100% Periode, 100% Payroll and 99% of PayrollItem are automaticly created by "a custom jobs". No human intervention !
        User never touch/edit/create Payroll or Periode or automaticly created PayrollItem

        important : User only add/create 1% of PayrollItem

        so the problem is only here in front-end get good value of Payroll->periode and set the good value in PayrollItem->periode

        self.model.set('periodeName',payrollObject.attribu tes.periodeName);
        self.model.set('periodeId',payrollId); // i have add this but not result

        as payrollItem->periode is a "auto-complete field" who fetch data onLive.. i think we need just one more fech.. something so maybe :

        self.model.set('periodeName',payrollObject.attribu tes.periodeName);
        self.model.fech('periodeId') .. ?

        PS : all other int-varchar-enum is good passed to modal, just for "auto-complete field"
        Last edited by item; 01-24-2021, 07:11 PM.

    • #18
      My suggestion would be first to eliminate the link between "Periode" and "PayrollItem" because it is redundant and could cause inconsistencies.

      "Periode" is already linked to "Payroll" and "Payroll" is linked to "PayrollItem", so only one link should be necessary.

      "PayrollItem" will never have a "Periode" that is different than the parent "Payroll" Periode" value.

      Click image for larger version  Name:	screen shot.png Views:	0 Size:	24.5 KB ID:	66675

      The next step would be to eliminate the "Periode" attribute from "PayrollItem" layouts (detail and detailSmall)

      This will eliminate the redundant "Periode" select element display.

      When the user is creating a "PayrollItem" manually, the user doesn't need to specify a "Periode", it is already set in "Payroll" and you don't want the user to be able to manually modify the value of "Periode"

      Click image for larger version  Name:	screen shot 2.PNG Views:	0 Size:	122.0 KB ID:	66676

      Is there a reason why you would want to have an "extra" link between "Periode" and "PayrollItem" ?

      Also another suggestion: If the "PayrollItem" entity is created from the "Payroll", eliminate the "Payroll" select element from the "PayrollItem" layout. It is not necessary either. By creating a "PayrollItem" from the "Payroll" detail display, Espo will automatically link "PayrollItem" with its parent "Payroll" entity.
      Last edited by telecastg; 01-24-2021, 09:08 PM.

      Comment


      • #19
        Hello telecastg
        first : as you can read mail.. solution is good.

        you are absolutly reason when you say "PayrollItem->periode" is redundant, but in this case, i think it's the best solution.
        and now in understand i don't need set the value .. because is in modal

        the reason for what i have a link between Periode and PayrollItem is for simplify custom hook/service
        sample, if you add new payrollItem, this new payrollItem modify from 1 to 3 other payrollItem (from same periode) and Payroll for other related PayrollItem with must be recalculate

        sample : payrollA .. add new payrollItemA .. this begin "business" and modify
        payrollItemB is modified => then payrollB is modified
        payrollItemC is modified => then payrollC is modified
        payrollItemD is modified => then payrollD is modified

        Regards

        Comment

        Working...
        X