Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Managament
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Help

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

Required fields problem in a model with different stages

Odoberať

Get notified when there's activity on this post

This question has been flagged
fieldsrequired
1 Odpoveď
8143 Zobrazenia
Avatar
rosey

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>

0
Avatar
Zrušiť
Avatar
Ayyappan
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.

0
Avatar
Zrušiť
Remya

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

Ayyappan

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

Remya

i updated my question, please check it.

Remya

Any solution?

Ayyappan

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

Remya

Ok its working.

rosey
Autor

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

Ayyappan

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.

rosey
Autor

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

Ayyappan

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?

rosey
Autor

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?

Ayyappan

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?

rosey
Autor

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.

rosey
Autor

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

Ayyappan

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?

rosey
Autor

On status bar in the hr.applicant

Ayyappan

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

rosey
Autor

Just like that.

Ayyappan

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

rosey
Autor

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?

Remya

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?

Ayyappan

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

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registrácia
Related Posts Replies Zobrazenia Aktivita
Required Fields in view Kanban Odoo13
fields required kanban_state
Avatar
0
jún 22
2370
Skipping required fields
fields one2many required
Avatar
Avatar
1
okt 19
5701
how to make a field compulsory only at a certain stage odoo Solved
fields help required
Avatar
Avatar
Avatar
3
apr 18
5886
How to display a red * for required fields
fields
Avatar
Avatar
Avatar
Avatar
3
máj 25
3174
How to display a red * for required fields
fields
Avatar
Avatar
1
apr 25
2287
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo je sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now