This question has been flagged
1 Reply
10653 Views

Greetings,

Can someone help me with this issue .

since 2days am tring to create custome module that will add custome field to the products .

i faced many problems like , the field added to the view but not visible (i can check it on manage view ) .

so any one can help me out and give me a custome module that will add field under 'quantity on hand ' which accessed throw product > invetory tab

any one can do this favor for me please .

Regards

 

 

Avatar
Discard

@MoayadRayyan, Please post back with details regarding what type of field you want to add. I have created a quick module for adding product images in a tab on product.template for Odoo 8.0 here: https://github.com/lukebranch/website_multi-image You may want to take a look at it's structure as a reference to help you achieve what you want to do.

Best Answer

Make sure that your custom module is in the addons folder if it isn't already.  Then make sure you have the __init__.py, __openerp__.py, and any other python or xml view files in your module folder.  Ex:

product_custom_module_folder:

    > __init__.py

    > __openerp__.py

    > product_custom.py

    > product_custom_view.xml

 

In the __init__.py file write the name of all the python files in your module without the .py file extenstion like this:

import product_custom

 

In the product_custom.py file you can include your custom field by inheriting from the products model like this:

class product_product(orm.Model):

    _inherit = 'product.product'

    _columns = { 

            'custom_field_1': fields.integer( 'Name of custom field'),

            'custom_field_2': fields.char('Name of other custom field'),

    }

 

In the __openerp__.py file make sure to include the following:

{
    'name': 'Custom Product Module',
    'version': '1.0',
    'summary': 'Custom Product Module. . . ',
    'description':'''
        Custom Sale module to add additional fields without modifying the original Sale module
    ''',
    'category': 'Custom Products',
    'author': 'Your Name',
    'website': 'http://www.yourwebsite.com',
    'depends': ['product'],
    'data': [
      'product_custom_view.xml',
    ],
    'installable': True,
    'auto_install': False,
}

Note:  You will only need to add the xml file if you plan on creating new or modifying other views

Once you have all of those files in place, then go to Settings > Update Modules List and click the Update button

Then click on Installed Modules, and clear the "Installed" search filter in the upper right corner and type in the name of the new module.  When you see it, you can click Install and then your custom field will be added to the products table.  Hope this helps

Avatar
Discard