Odoo Help

0

add mulitple notes in form

By
shashank verma
on 1/7/14, 8:16 AM 1,181 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>

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

Question tools

0 follower(s)

Stats

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