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

How to customize with a custom module?

By
Assim Al-Marhuby
on 9/7/13, 5:12 PM 4,624 views

I've read that if I'd like to customize or add a field to any app/module, it's better to do that by creating my own module to do that. But I'd like to ask, how to create a module that adds a field to another module?

I've read about module creation but it didn't answer my question

OpenERP and partners propose formation to create your own module. Just one day can be a good bootstrap

Suzanne Jean-Sébastien
on 9/9/13, 8:08 AM
1
kaynis
On 9/7/13, 7:24 PM

You have to create the __init__.py file and __openerp__.py (look for samples on line). Than a simple module can be

import osv..... import date (if you need it or import any other library you think you will need)

class product_product2 (osv.osv):
    _name = 'product.product2' (this is the name of your module)
   _inherit = 'product.product' (this is the product you wish your module to behave like and you want to add your new fields to)
   columns = {tests: fields.char('Test Field', size = 128)}#this will contain all the new fields you want to add to the product module you are inheriting from it also contains the type #of content that goes into the field, eg char for character, integer for numbers float for floating numbers basically you typical database system

product_product2() states the end of a module also this closes the module so you can start another module

your _view.xml can look like

 <openerp>
      <data>
                <record id="view_order_label_form_change" model="ir.ui.view">
                     <field name="name">product.product2_form</field>
                     <field name="model">product.product</field>
                     <field name="inherit_id" ref="product.product_normal_form_view"/> <!--not sure if this is correct but looks like that-->
                     <field name="arch" type="xml">       
                               <field name="name" position="after"> <!--this is saying look for field name in product and add my field after it-->
                                        <field name = "tests" select="1"/> <!--add select if you want your field searchable -->
                               </field>
                    </field>
    </data>
</openerp>

Hope this helps you a bit

to complete Kaynis, you have here the basic information to create a module http://dipleo.fr/module-creation-bases/ I will write a tutorial about ihnerit tomorrow.

johnCogitae
on 9/8/13, 3:04 PM
0

Hi OpenERP and partners propose formation to create your own module. Just one day can be a good bootstrap

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

1 follower(s)

Stats

Asked: 9/7/13, 5:12 PM
Seen: 4624 times
Last updated: 8/7/16, 3:53 AM