0
votes

I created a module, which has several tab/page in notebook, the problem is why when I click on the button "save", it changes direction automatically on the first tab/page <page name="description" string="Description"> And not in where it's active.
If anyone had any idea of that, I did not understand the problem, thank you in advance.

My Xml :

<notebook>
   <page name="description" string="Description">
      <field name="description_mission" />
   </page>
   <page name="information" string="Informations">
      <group>
         <group name="duration" string="Durée">
            <field name="mission_fin" />
            <field name="mission_start_date" />
            <field name="mission_end_date" attrs="{'invisible': [('mission_fin', '=', True)], 'required': [('mission_fin', '!=', True)]}" />
            <field name="mission_duration" attrs="{'invisible': [('mission_fin', '=', True)]}" />
         </group>
         <group string="Moyen de transport" name="transport">
            <field name="mission_car" />
            <field name="model_id" attrs="{'invisible': [('mission_car', '!=', 'cc')],'required': [('mission_car', '=', 'cc')]}" />
            <field name="license_plate" attrs="{'invisible': [('mission_car', '!=', 'cc')], 'required': [('mission_car', '=', 'cc')]}" />
            <field name="billet_id" attrs="{'invisible': [('mission_car', '!=', 'plane')]}" />
         </group>
      </group>
      <notebook>
         <page string="Observation">
            <field name="observation" />
         </page>
      </notebook>
   </page>
</notebook>
2
Can you please write your code over here ?Avani Somaiya

2 Answers

1
votes

You must need to remove notebook tag which is above the page Observation.

For Information:

When add any page in notebook at that time must have only single notebook tag. Means, we can't take notebook in notebook.Only give page in notebook. When we take it twice at that time it can confused and raised above problem.

I hope this helps you.Thank you.

0
votes

as @Avani Somaiya said, When we use a notebook tag inside an other notebook tag, Odoo can confused.

BUT, that doesn't mean that you cannot use notebook in a notebook as he said, you just have to tell Odoo that they are two seperate tags with adding a name attribute. So your xml should be in this way

<notebook name="main_notebook">
   <page name="description" string="Description">
      <field name="description_mission" />
   </page>
   <page name="information" string="Informations">
      <group>
         <group name="duration" string="Durée">
            <field name="mission_fin" />
            <field name="mission_start_date" />
            <field name="mission_end_date" attrs="{'invisible': [('mission_fin', '=', True)], 'required': [('mission_fin', '!=', True)]}" />
            <field name="mission_duration" attrs="{'invisible': [('mission_fin', '=', True)]}" />
         </group>
         <group string="Moyen de transport" name="transport">
            <field name="mission_car" />
            <field name="model_id" attrs="{'invisible': [('mission_car', '!=', 'cc')],'required': [('mission_car', '=', 'cc')]}" />
            <field name="license_plate" attrs="{'invisible': [('mission_car', '!=', 'cc')], 'required': [('mission_car', '=', 'cc')]}" />
            <field name="billet_id" attrs="{'invisible': [('mission_car', '!=', 'plane')]}" />
         </group>
      </group>
      <notebook name="child_notebook">
         <page string="Observation">
            <field name="observation" />
         </page>
      </notebook>
   </page>
</notebook>