Skip to Content
Menu
This question has been flagged
1 Reply
6588 Views

I have five stages in hr.recruitment.

In each have many required fields.

I added required="true" in each field.

I added datas in the first stage & save. But it shows error that remaining stages required fields are empty.

I want the same procedure, But how can i solve the issue?

ie, Datas in the first stage added there, then save. Only when i click the second stage, required fileds of second stage give that time only.

After initial qualification, next first stage then second stage. In initial qualification both tab are invisible, when i click first stage the offer letter field should be required, when i click second stage the passport field should be required.

<page string="First Stage" attrs="{'invisible':[('state','=','draft')]}"> <group> <field name="offer_letter" required="1"/> </group> </page>

<page string="Second Stage" attrs="{'invisible':[('state','in',('draft','pending'))]}"> <group> <field name="passport" required="1"/> </group> </page>

Avatar
Discard
Best Answer

Try below one:

<field name="field_2" attrs="{'required':[('stage','=','two')]}"/>

If stage is in second, field_2(second field) must be in required. Otherwise should be in un-required state.


I have done the below code depends on state:

<page string="First Stage" attrs="{'invisible':[('state','=','draft')]}"> 
    <group> 
        <field name="offer_letter" attrs="{'required':[('state','=','draft')]}"/> 
    </group> 
</page>
<page string="Second Stage" attrs="{'invisible':[('state','in',('draft','pending'))]}"> 
    <group> 
        <field name="passport" attrs="{'required':[('state','=','pending')]}"/> 
    </group> 
</page>

In draft state: "offer_letter" field is required In pending state: "passport" field is required


In pyhton:

_columns = { 
'stage': fields.selection([
            ('stage_1', 'Start Qualification'),
            ('stage_2', 'First Qualification'),
            ('stage_3', 'Second qualification'),
            ('stage_4', 'Before finalisation'),
            ('stage_5', 'Finalised'),            
            ], 'Stage'
            ),
'field_1': fields.char('Field_1', size=64),
'field_2': fields.char('Field_2', size=64),
'field_3': fields.char('Field_3', size=64),
'field_4': fields.char('Field_4', size=64),
'field_5': fields.char('Field_5', size=64),
}
_defaults = {
        'stage': 'stage_1',     
        }

In xml:

<page string="First Stage"> 
    <group> 
        <field name="field_1" attrs="{'required':[('stage','=','stage_1')]}"/> 
    </group> 
</page>
<page string="Second Stage"> 
    <group> 
        <field name="field_2" attrs="{'required':[('stage','=','stage_2')]}"/> 
    </group> 
</page>  
<page string="Third Stage"> 
    <group> 
        <field name="field_3" attrs="{'required':[('stage','=','stage_3')]}"/> 
    </group> 
</page>  
<page string="Fourth Stage"> 
    <group> 
        <field name="field_4" attrs="{'required':[('stage','=','stage_4')]}"/> 
    </group> 
</page>  
<page string="Fifth Stage"> 
    <group> 
        <field name="field_5" attrs="{'required':[('stage','=','stage_5')]}"/> 
    </group> 
</page>

If you use like this, in your status bar consists 5 stages. Beginning of the flow stage is stage_1(Start Qualification) in this stage Field_1 is required, then when you click the stage_2(First Qualification) - Field_2 is required..., and the flow goes likewise.

Avatar
Discard

Uncaught Error: Unknown field stage in domain [["stage","=","two"]]. Its shows the error

Above i just gave example code. If you need full functionality code, give me your files or fields details.

i updated my question, please check it.

Any solution?

Can you please explain the stage? I think state field is stage. Here i explain with state.

Ok its working.

Author

Still have a doubt. I have three stage with same status type. ie, third stage, fourth stage, fifth stage. each three is status=hired. But each three stage has different fields. What will do? Please reply

In same state it is not possible. You just add another two states. Otherwise in hired state all remaining fields will be in required state.

Author

But my requirement is that. What will do? Any way to solve this?

After second stage what you want to do? Give a summary of your work. Otherwise how can i help you. In the beginning of the third stage you want one field should be required. right? and you will save the form another field should be required. is it correct?

Author

I'll explain you. I have 5 stages. In each stage i have some required field. First stage status=draft, 2nd,3rd are pending, 4th,5th are hired. In 2nd stage i have three required fields and in 3rd stage 5 required fields. same as in 4th&5th. How can i update my code? <field name="passport" attrs="{'required':[('state','=','pending')]}"/> if i give like this, it will affect 2nd & 3rd, right?

What is the difference between 2nd & 3rd stage, and 4th & 5th stage? How do you mention it is 2nd and 3nd stage? Is there any process between 2nd and 3rd?

Author

Yes. Stage names are different. 2nd=First Qualification---here we check some details and add it. if he qualified. then goes to 3rd=Second qualification---here we add some other details of the candidate. 4th=Before finalisation---here we add salary details. 5th=Finalised---here add bank details &some datas.

Author

Both the 2nd&3rd 4th&5th different. Only status is same. 2nd&3rd-pending. 4th&5th-hired.

Ok. Here you have mentioned "First Qualification", "Second qualification", "Before finalisation", "Finalised". right? Is there any field to get this value? How the process goes to "Second qualification" from "First Qualification"? Do you click any button to change the stage?

Author

On status bar in the hr.applicant

In status bar look like this? First Qualification>Second qualification>Before finalisation>Finalised. Is it selection field?

Author

Just like that.

Give me the status bar field name and what are the fields you want to hide in the particular state.

Author

it is a large portion, and is with my senior. i just want to find out a solution for this. Can you just image some fields,please?

It is fine. Another help. How can i hide a <page> string like this? I have five page tab in the same <notebook>. 1st page is seen in stage_1=draft. 2nd page is seen i stage_2=pending. 3nd page is seen i stage_3=pending. 4th page is seen in stage_4=hired. 5nd page is seen i stage_5=hired. Stage names are same as above. Can you please suggest any code?

Hi Remya, I want to know about stage and state. is it same field? or different field? Do you mention a state is stage?

Related Posts Replies Views Activity
0
Jun 22
1361
1
Oct 19
4397
3
Apr 18
4579
3
May 25
678
1
Apr 25
514