Odoo Help

Welcome!

This community 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.

0

add mulitple notes in form

By
shashank verma
on 1/7/14, 8:16 AM 839 views

At the moment i can only have single note available by using field.text('Note') but i want to add multiple notes , How to achieve this functionality?

Thanks

Shazz

0
kaynis
On 1/7/14, 9:23 AM

You need something like that in your xml that would create two Note tab.

                <page string="First Note">
                    <separator string="'Comment1'" colspan="4"/>
                    <field name="your_field" colspan="4" nolabel="1"/>
                </page>
                <page string="Second Note">
                    <separator string="'Comment2'" colspan="4"/>
                    <field name="your_field_2" colspan="4" nolabel="1"/>
                </page>

New update Something like this but you will have to create a one2many field for the notes this XML below should work.

                <page string="Notes">
                    <field colspan="4" mode="form,tree" name="notess" select="1" height="260"> 
                        <form string="User Note">

                            <field name="notes"/>
                            <field name="note_description" />
                        </form>
                        <tree string="User Note">
                            <field name="notes_id" />
                            <field name="note_description" />                         
                        </tree>
                    </field>
                </page>

and in your python add something like this

class lab_product(osv.osv):
_name = 'lab.product'
_columns = {
    'name': fields.char('Field Name',size=x'),
    'notess': fields.one2many('lab.product.notess','notes_id','User Comment'),
    'note_description': fields.related('notess','note_description',type='char', string='Short Description'),
    'notid': fields.related('notess','notes',type='text', string='Work Note'),
}
 lab_product()

class lab_product_notess(osv.osv):
_name = 'lab.product.notess'
_columns = {
    'notes_id': fields.many2one('lab.product','Product', select=True, required=True),
    'note_description': fields.char('Short Description', size=100),
    'notes': fields.text('Work Note', size=10000),
}
lab_product_notess()

Hope this is helpful. You can always improve on it but that will do what you wanted You can see I created two classes and made one one to many and the other many to one. The lab product class can have many notes and many note class can have one lab product. Relate the field and that should do it. When you run this, you will be able to make lots of notes under Notes tab (as many as you want) you can then set to readonly as you wish.

It will be depending on user how much notes he can add. suppose on same form i want to add 20 notes today and 30 new notes tomorrow so for this i need to add 50tabs!!!! If i want everything on single tab, how it can be done?

shashank verma
on 1/7/14, 10:38 AM

Interesting. That would be a nice feature actually give me some minutes. what you will need is a create note that allows you to create the notes you want. I think you will need a one to many connection.

kaynis
on 1/7/14, 10:56 AM
0
abul
On 1/7/14, 9:59 AM
            <page string="First Note">
                <separator string="'Comment1'" colspan="4"/>
                <field name="your_field" colspan="4" nolabel="1"/>
            </page>
            <page string="Second Note">
                <separator string="'Comment2'" colspan="4"/>
                <field name="your_field_2" colspan="4" nolabel="1"/>
            </page>

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 1/7/14, 8:16 AM
Seen: 839 times
Last updated: 3/16/15, 8:10 AM