This question has been flagged
3 Replies
5444 Views

Hi All,

My question is on finding code within all of the master code and addons. I'll use a simple example.

I was working on a simple module to change a label on the product.product_normal_form_view.

On the product.product_normal_form_view as shown on the screen there is a label that says "EAN13 Barcode" In looking at the Debug View of product.product_normal_form_view there is nowhere that the label "EAN13 Barcode" shows up. So I figure that there must be a module that has inherited this view and changed/added this label, or some other code that has made this modification.

But when I do a full file search of all of the code and addons I don't see where "EAN13 Barcode" is used, other than in some point of sale module javascript. I am using windows file search and have it set to search file contents.

So the question is what is the correct way to find existing code, and is there any code in the entire system that would not be exposed/found using a simple in depth file search?

Maybe if someone can tell me where the label "EAN13 Barcode" comes from that would point me in the right direction.

Thanks!

Avatar
Discard
Best Answer

Here Product View you will find ean13 field in product_normal_form_view.

Avatar
Discard
Author

Yes I see that, but where is the label "EAN13 Barcode" set as the label?

Best Answer

Enable the "developer mode" on the About menu, then hover the object you want to modify. That will give you the information about the model (class name) you want to work with. Then you have to go to Settings > Customization > Database Structure and locate the model. In the model form you will find the information about the modules that create and maintain the model you wish to modify

Avatar
Discard
Author Best Answer

Thank you for the information on where to find the applicable model.

I did as you suggested and used Settings > Customization > Database Structure > Models to locate the model, in this case the Field Name "ean13" is in the product.product model/module.

I do see under Settings > Customization > Database Structure > Models / Product that the field named "ean13" has a Field Label of "EAN13 Barcode", but when I look through the code @ OPENERP/ADDONS/PRODUCTS/ I cannot find the XML file that sets this Field Label.

I would expect to see something like:

<field name="ean13"/>
<label for="EAN13 Barcode"/>

But I can not find the applicable code.

Any assistance is appreciated.

UPDATE: I now see where the "EAN13 Barcode" is set...

In the product.py code the _columns include: 'ean13': fields.char('EAN13 Barcode', size=13, help="International Article Number used for product identification."),

UPDATE 2: WINDOWS does not normally search the contents of .py files. To make windows search the contents of a .py file do the following (From AgentPete answers.mircosoft.com)

a. Hit the start button and type "search" in the search box. b. Select "Change How Windows Searches" c. Hit "Advanced" d. Select the "File Types" tab. e. Make sure the file extension for the files you want to search in is on the list and is set to "Index Properties and File Contents"

Hope this helps someone

Avatar
Discard
Author

I have updated with my answer