Odoo Help

0
3 Answers
0
Avatar

subbarao

--subbarao--

873
| 4 1 4
Chennai, India
--subbarao--


subbarao
2/10/19, 10:40 PM

Hello

In your one2many tree view add editable='bottom', so you can able to edit here it self(instead of pop-up) 

0
Paulo Matos
2/11/19, 12:07 PM

I am writing a new "answer" because I need to refer both @subbarao and @sehrish.

Thank you guys.

I have tried as you said but unfortunately I could not get the complete workflow as desired.

Using the "<tree editable ="bottom"> (or top), now I am able to edit the record on the same form without the "pop-up" window... but...

I am still unable to "choose the record from a list of existing records" and cannot see the (Create and Edit option).

@subbarao says that I should add this "editable = "bottom" to the tree view of my "one2many" field.

Do you mean add it to the "model" where I have the relation to the Many2one field?  

These are my classes:

class mymodule_director(models.Model):   
    _name = 'mymodule.director'   
    name = fields.Char('Name', size=50, required=True)   
    phone = fields.Char('Phone', size=17, default="00244 ")   
    email = fields.Char('Email')   
    location_id = fields.Many2one('mymodule.locations','Location', required=True)   
    customer_ids = fields.Many2one('mymodule.customers','director_ids')


class mymodule.customers(models.Model):   
     _name='mymodule.customers'   
     name=fields.Char('Name', required=True)   
    address = fields.Char('Address')   
    city = fields.Char('City')   
    province=fields.Char('Province')   
    email=fields.Char('Email')   
    director_ids = fields.One2many('mymodule.director','customer_ids', string="Director")


Tree view:

- mymodule.director model

<record id="mymodule_director_tree_view" model="ir.ui.view">
    <field name="name">Director List View</field>
    <field name="model">mymodule.director</field>
    <field name="arch" type="xml">
      <tree editable="bottom">    ------->>>>> ADDED AS PER INSTRUCTIONS
         <field name="name"/>
         <field name="phone"/>
         <field name="email"/>
         <field name="location_id"/>
         <field name="customer_ids" string="Customer"/>
      </tree>
    </field>
  </record>


- mymodule.customers model FORM view (where the relation should appear on form view)

  <record id="mymodule_customers_form_view" model="ir.ui.view">
    <field name="name">mymodule.customers.form.view</field>
    <field name="model">mymodule.customers</field>
    <field name="type">form</field>
    <field name="arch" type="xml">
      <sheet>
        <form>
          <group>
            <field name="name"/>
            <field name="address"/>
            <field name="city"/>
            <field name="province"/>
            <field name="email"/>
          </group>
            <notebook>                        ----------------->>>>>> TRIED TO ADD "editable = "bottom" FROM THIS POINT WITH NO SUCESS
              <page string="Directors">
                  <field name="director_ids"/>
              </page>
            </notebook>
      </form>
      </sheet>
    </field>
  </record> 


Adding it to the "tree view" above, I can get "almost" what I want. The problem is that existing records are not shown on the form...


 Thank you once again


0
Sehrish
2/11/19, 2:29 AM

Try this one

<notebook>
<page string="Detail">
<field name="one2many_field">
<tree editable="top">
<field name="field1" />
<field name="field2"/>
<field name="field3">
</field>
</tree>
</field>
</page>
</notebook>



Ask a Question
Writer
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now