Fetch Employee ID before saving the Record in One2Many

Hello Community !

I have created this relationship of Education Domain with Employee ( In the Employee Entity )

        <one-to-many name="educationListLine" title="Education"
          ref="com.edge.apps.hr.db.Education" mappedBy="employee"/>

and in Education Entity I have created this relationship :

`<many-to-one name="employee" ref="com.axelor.apps.hr.db.Employee" title="employee"/>`

Now whenever I save a record in the Education , the Employee is saved automatically due to Mapping.

Here is the List of Record that I saved in Entity Education And Employee is Fetched.

It Save the Employee in Education after it is being saved, but I want to Access this Employee when I click +New (Button)

How can I get this Employee without saving the record?

I Use Paned Related in the Form View of Employee:

<panel-related field="educationListLine" grid-view="education-grid-employee"  editable="true"/>

if both are linked why you expecting something else, what you need to achieve

I want to add a check "not to add one degree type more than once where current employee is "

domain="self.id not in (select degree.id from Education he where employee = 61)"

This domain is working for degree type in db.Education but I am unable to fetch current employee before saving the record

action validate is the right choice, unless you save existing record how you are going to know it ?

<action-record name="action-add-employee-in-education" model="com.edge.apps.hr.db.Education">
  <field name="employee" expr="eval: __parent__"/>

It is Fetched by creating this action and used it "onNew=« action-add-employee-in-education » in Education Grid.
Thank you @siddique Sir

2 « J'aime »

Ce sujet a été automatiquement fermé après 30 jours. Aucune réponse n’est permise dorénavant.