Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
1 Antworten
4178 Ansichten

I'm working on my first OpenERP module.  (Woo hoo!)

All I really want to do is to add existing fields 'product_name' and 'product_code' (from product.supplierinfo) into View #233 (Product form view).  I'm talking about the Suppliers area that appears near the bottom of a product form view --> Procurements tab.  Developer mode tells me this area is the 'seller_ids' field from product.supplierinfo.

Since I'm not defining any new models or fields, do I still need to have a 'mymodule.py' file?  Or is a new .xml file for the view all I need?  If I still need a .py file, what do I put in it?

Avatar
Verwerfen
Beste Antwort

Hi,

You don't need a "mymodule.py" file, but you do need a __iniit__.py and __openerp__.py files.

The former can be empty, is just to indicate that your folder (where you are creating your .xml and so on) is in fact a module.
In the __openerp__.py file yo need to add the xml as data:


 {
    'name': 'My Module',
    'version': '0.1',
    'author': 'You',
    'website': 'http://www.example.com',
    'depends': [
        'product',
    ],
    'description' : """
                    Added fields to suppliers tree of product form view
                    """,
    'data': ['your_view.xml',]
}

That's it!
Hope it helps, and welcome to OpenERP/Odoo!

Avatar
Verwerfen
Autor

Cool, thanks. Now I just have to figure out how to modify one view that is displayed inside another!

Take a look at sale_stock/sale_stock_view.xml line88, you can do something like that. Something like: <xpath expr="//field[@name='seller_ids']/tree/field[@name='field_of_sellers_tree_view']" postion="after"> for editing the tree form for example.

Autor

Where do you find the .xml files? I'm looking in the OpenERP directory, and don't see them.

@Jeff: go to /opt/openerp/openerp-server/addons or /opt/odoo/odoo-server/addons. Inside of each Module folder you can find the xml files for each Module

Autor

Hmm... neither /opt/openerp nor /opt/odoo exist. I installed on CentOS with a pre-made install script. Not sure where it put its files. Can't find any directory references other than for startup and .conf files.

Autor

Found it! On my system, it is /usr/lib/python2.6/site-packages/openerp-7.0_20140804_231303-py2.6.egg/openerp/addons/sale_stock/sale_stock_view.xml Whew! That's a long one!

Verknüpfte Beiträge Antworten Ansichten Aktivität
1
Juli 23
3184
1
Mai 23
2824
0
Okt. 22
4434
1
Sept. 22
2290
1
Feb. 16
7284