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

Openerp 7 add custom field to Project?

By
mirko lazzarini
on 8/16/13, 11:45 AM 2,746 views

I'm trying to add a custom field to Project form and tree(after Project Manager) but i don't obtain results, could you help me?

__init___

import qms_project

__openerp__

{
    'name': 'Project Management Extension',

    'version': '0.1',
    'author': ' xxx',
    'website': '',
    'category': '',
    'sequence': 8,
    'summary': '',
    'images': [ ],
    'depends': [  ],
    'description': [ "Project Management Extension"],
    'data': [ 'qms_project_view.xml' ],
    'installable': True,
    'auto_install': False,
    'application': True,
}

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

qms_project.py

import time

import datetime

from openerp.osv import fields, osv

from openerp.tools.translate import _

class Project(osv.osv):
    '''Project'''

    _inherit = 'project.project'

    _columns = {
        'type_id': fields.one2many('Project.Type',string="Typology"),
    }

Project()

qms_project_view.xml

<openerp>
    <data>
 <!-- Project -->
    <record model="ir.ui.view" id="project_project_form_inherit">
            <field name="name">project.project.form.inherit</field>
            <field name="model">project.project</field>
            <field name="inherit_id" ref="project.form_inherit"/>
            <field name="arch" type="xml">
        <field name='user_id' position='after'>
                   <field name="type_id" />
        </field>
            </field>
       </record>

    <record model="ir.ui.view" id="project_project_tree_inherit">
         <field name="name">project.project.tree.inherit</field>
         <field name="model">project.project</field>
         <field name="type">tree</field>
         <field name="inherit_id" ref="project.project_tree"/>
         <field name="arch" type="xml">
        <field name='user_id' position='after'>
                   <field name="type_id" />
              </field>
         </field>
     </record>


    </data>
</openerp>
1

Borni DHIFI

--Borni DHIFI--
5102
| 6 8 9
Tunis, Tunisia
--Borni DHIFI--

Techno Functional Consultant Odoo(OpenERP) 

http://www.linkedin.com/in/borni

Skype : dhifi.borni

Borni DHIFI
On 8/18/13, 8:33 AM

Hi,

'type_id': fields.one2many('Project.Type',string="Typology"),
TypeError: __init__() takes at least 3 arguments (3 given)

use many2one and not one2many:

'type_id': fields.many2one('Project.Type',string="Typology"),

model : Project.Type does not exist in openerp .you must create this model.

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

2 follower(s)

Stats

Asked: 8/16/13, 11:45 AM
Seen: 2746 times
Last updated: 3/16/15, 8:10 AM