Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
4384 Lượt xem

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?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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!

Ảnh đại diện
Huỷ bỏ
Tác giả

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.

Tác giả

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

Tác giả

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.

Tác giả

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!

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 7 23
3458
1
thg 5 23
3254
0
thg 10 22
4891
1
thg 9 22
2568
1
thg 2 16
7585