title: The great OpenERP 7 directory structure mystery
body: <p>I am currently deploying OpenERP 7 on a CentOS 6.4 machine.
  I'm virtualizing the whole thing so that I can backup the whole system if I mess up.</p>
  
  <p>Everything seems to be fine, I changed my models, my views, but it's been 2 days I've been banging my head against a seemingly impossible problem.</p>
  
  <p>My deployment is for a book factory, so the product needed to be customized (number of pages, binding type , and so forth...)</p>
  
  <p>In the new product view, I need something that can sum to fields x_colorpages and x_bwpages to populate a third field: x_totalpages. Easy huh?</p>
  
  <p>I've got my XML , product.normal.form view based on the product.poduct object</p>
  
  <p> 
   
   
   </p>
  
  <p>When I change the value in "x_paginecolori" or "xpagineBN" it should automatically trigger the onchange function.</p>
  
  <p>So I went in the product module code and coded my cal_change_event</p>
  
  <p>In the python file product.py located in: 
  /usr/lib/python2.6/site-packages/openerp-7.0_20130524_231019-py2.6.egg/openerp/addons/account/product.py</p>
  
  <pre><code>def cal_change_event(self, cr, uid, ids, x_PagineColori, x_PagineBN):
        res = {}
        sum = 0
  if not  x_PagineColori: 
      return {}
  else if not x_PagineBN:
      return {}
  else:
      sum = x_PagineColori + x_PagineBN
      res={'x_pagine':sum }
      return {'value':res} 
  </code></pre>
  
  <p>NO matter what i do , the onchange event will allways trigger a warning popup:</p>
  
  <p><strong>File "/usr/lib/python2.6/site-packages/openerp-7.0_20130524_231019-py2.6.egg/openerp/osv/osv.py", line 185, in execute_cr
      return getattr(object, method)(cr, uid, *args, **kw)
  AttributeError: 'product.product' object has no attribute 'cal_change_event'</strong></p>
  
  <p>It seems to me that the function is not seen, where should I put it?
  How can Product.Product not have this attribute if I placed it in the class inside  product.py?</p>
  
  <p>I grep'd the whole CENTOS installation in search for multiple instances of openerp , or to see if I missed something about product.py</p>
  
  <p>It seems that the product.py is not the right file, even if I erase other On_change functions, nothing bad really happens.
  But the directory must be right, because the error log gives me that same location in the debug popup window.</p>
  
  <p>Should I be building a custom module fron scratch to make this work? Is it forbidden somehow to modify the standard product module?</p>
  
  <p>Thanks in advance for any insight, my brain is defaulting on this one.</p>
  
  <p>here is my Xml:</p>
  
  <pre><code>            &lt;?xml version="1.0"?&gt;
                  &lt;form string="Product" version="7.0"&gt;
                                          &lt;sheet&gt;    
              &lt;div&gt;
                               &lt;label for="x_partner2" string="Cliente Referente del prodotto"/&gt;
                                   &lt;field name="x_partner2" /&gt;
                                      &lt;/div&gt;
                                          &lt;field name="image_medium" widget="image" class="oe_avatar oe_left"/&gt;
                                          &lt;div class="oe_title"&gt;
                                              &lt;div class="oe_edit_only"&gt;
                                                  &lt;label for="name" string="Product Name"/&gt;
                                              &lt;/div&gt;
                                              &lt;h1&gt;
                                                  &lt;field name="name"/&gt;
                                              &lt;/h1&gt;
                                              &lt;label for="categ_id" class="oe_edit_only"/&gt;
                                              &lt;h2&gt;&lt;field name="categ_id"/&gt;&lt;/h2&gt;
                                              &lt;div name="options" groups="base.group_user"&gt;
                                                  &lt;field name="sale_ok"/&gt;
                                                  &lt;label for="sale_ok"/&gt;
                                              &lt;/div&gt;
                                          &lt;/div&gt;
                                          &lt;div class="oe_right oe_button_box" name="buttons"&gt;
                                          &lt;/div&gt;
                                          &lt;notebook&gt;
                    &lt;page string="Information"&gt;
                                                  &lt;group&gt;
                                                      &lt;group&gt;
                                                          &lt;field name="type"/&gt;
                                                          &lt;field name="uom_id" on_change="onchange_uom(uom_id,uom_po_id)" groups="product.group_uom"/&gt;
                                                          &lt;field name="list_price"/&gt;
                                                      &lt;/group&gt;
                                                      &lt;group&gt;
                                                          &lt;field name="default_code"/&gt;
                                                          &lt;label for="ean13"/&gt;
                                                          &lt;div name="ean"&gt;
                                                              &lt;field name="ean13" placeholder="e.g. 5901234123457"/&gt;
                                                          &lt;/div&gt;
                                                      &lt;/group&gt;
                                                      &lt;group&gt;
                                                          &lt;field groups="product.group_product_variant" name="variants"/&gt;
                                                          &lt;field name="price_margin" groups="product.group_product_variant"/&gt;
                                                          &lt;field name="price_extra" groups="product.group_product_variant"/&gt;
                                                      &lt;/group&gt;
                                                  &lt;/group&gt;
                                                  &lt;field name="description" placeholder="describe the product characteristics..."/&gt;
                              &lt;/page&gt;
                    &lt;page string="Dati del volume Universal Book"&gt;
                  &lt;group&gt;
                  &lt;group&gt;
                                              &lt;field name="x_DataCreazione" /&gt;
                                                          &lt;field name="x_DataUltimaModifica" /&gt;
                                          &lt;field name="x_Autore" /&gt;
                                                          &lt;field name="x_Larghezza"/&gt;
                                           &lt;field name="x_Altezza" /&gt;
                                           &lt;field name="x_Dorso"/&gt;
                                                   &lt;field name="x_Rilegatura" /&gt;
                   &lt;field name="x_volumiformati" /&gt;
  
                  &lt;/group&gt;
                  &lt;/group&gt;
                  &lt;group&gt;
                                                   &lt;field name="x_PagineColori"  on_change="cal_change_event(x_PagineColori,x_PagineBN)" /&gt;
                                                   &lt;field name="x_PagineBN"  on_change="cal_change_event(x_PagineColori,x_PagineBN)" /&gt;
                                                   &lt;field name="x_pagine" /&gt;
                  &lt;/group&gt;
                  &lt;group&gt;
                                                   &lt;field name="x_prezzo" /&gt;
                  &lt;/group&gt;
                  &lt;/page&gt;
  
                   &lt;page string="Copertina"&gt;
                  &lt;group&gt;
                  &lt;group&gt;
                  &lt;field name="x_TipoCartaCopertina"/&gt;
                  &lt;field name="x_TipoStampaCopertina"/&gt;
                                        &lt;field name="x_TipoFFR"/&gt;
                                                   &lt;field name="x_PlastificazioneCopertina" /&gt;
                                                   &lt;field name="x_NumeroCopertinePerPagina" /&gt;
                  &lt;/group&gt;
                  &lt;group&gt;
                  &lt;field name="x_TipoCartaSovracopertina"/&gt;
                  &lt;field name="x_TipoStampaScopertina"/&gt;
                   &lt;field name="x_TipoFFRSovracopertina"/&gt;
                   &lt;field name="x_PlastificazioneSovracopertina"/&gt;
                  &lt;/group&gt;
                  &lt;/group&gt;
                  &lt;label for="x_aletta" string="Libro con alette?"/&gt;
                   &lt;field name="x_aletta" /&gt;
                  &lt;label for="x_Note" string="Note"/&gt;
                                                   &lt;field name="x_Note" /&gt;
                                              &lt;/page&gt;
                  &lt;page string="Margini"&gt;
                  &lt;group&gt;
                   &lt;field name="x_pagriferimento"/&gt;
                   &lt;field name="x_MargineDestro"/&gt;
                   &lt;field name="x_MargineDestro"/&gt;
                  &lt;field name="x_MargineInferiore" /&gt;
                  &lt;field name="x_MargSinistro" /&gt;
                  &lt;field name="x_MargineSuperiore"/&gt;
                  &lt;field name="x_RiferimentoLIFRE" /&gt;
                  &lt;field name="x_MergineSuperioreLIFRE" /&gt;
                  &lt;field name="x_MargineInferioreLIFRE" /&gt;
                  &lt;/group&gt;
                  &lt;/page&gt;
                                              &lt;page string="Procurements" groups="base.group_user"&gt;
                                                  &lt;group name="procurement"&gt;
                                                      &lt;group name="general"&gt;
                                                          &lt;field name="cost_method" groups="product.group_costing_method"/&gt;
                                                          &lt;field name="standard_price" attrs="{'readonly':[('cost_method','=','average')]}"/&gt;
                                                      &lt;/group&gt;
                                                      &lt;group name="procurement_uom" groups="product.group_uom" string="Purchase"&gt;
                                                          &lt;field name="uom_po_id"/&gt;
                                                      &lt;/group&gt;
                                                  &lt;/group&gt;
                                                  &lt;separator string="Description for Suppliers"/&gt;
                                                  &lt;field name="description_purchase" placeholder="This note will be displayed on requests for quotation..."/&gt;
                                              &lt;/page&gt;
                                              &lt;page string="Inventory" groups="base.group_user"&gt;
                                                  &lt;group name="inventory"&gt;
                                                      &lt;group name="status" string="Status"&gt;
                                                          &lt;field name="state"/&gt;
                                                          &lt;field name="product_manager"/&gt;
                                                      &lt;/group&gt;
                                                      &lt;group name="Weights" groups="product.group_stock_packaging" string="Weights"&gt;
                                                          &lt;field digits="(14, 3)" name="volume" attrs="{'readonly':[('type','=','service')]}"/&gt;
                                                          &lt;field name="weight" attrs="{'readonly':[('type','=','service')]}"/&gt;
                                                          &lt;field name="weight_net" attrs="{'readonly':[('type','=','service')]}"/&gt;
                                                      &lt;/group&gt;
                                                  &lt;/group&gt;
                                              &lt;/page&gt;
                                              &lt;page string="Sales" attrs="{'invisible':[('sale_ok','=',False)]}"&gt;
                                                  &lt;group name="sale"&gt;
                                                      &lt;group string="Sale Conditions"&gt;
                                                          &lt;label for="warranty"/&gt;
                                                          &lt;div&gt;
                                                              &lt;field name="warranty" class="oe_inline"/&gt; months
                                                          &lt;/div&gt;
                                                      &lt;/group&gt;
                                                      &lt;group groups="product.group_uos" string="Unit of Measure"&gt;
                                                          &lt;field name="uos_id"/&gt;
                                                          &lt;field name="uos_coeff"/&gt;
                                                          &lt;field name="mes_type"/&gt;
                                                      &lt;/group&gt;
                                                  &lt;/group&gt;
                                                  &lt;field name="packaging" groups="product.group_stock_packaging"&gt;
                                                      &lt;form string="Packaging" version="7.0"&gt;
                                                          &lt;group col="4"&gt;
                                                              &lt;field name="ean"/&gt;
                                                              &lt;field name="sequence" invisible="1"/&gt;
                                                              &lt;newline/&gt;
                                                              &lt;field name="qty"/&gt;
                                                              &lt;field name="ul"/&gt;
                                                              &lt;field name="weight_ul"/&gt;
                                                              &lt;separator colspan="4" string="Palletization"/&gt;
                                                              &lt;field name="ul_qty"/&gt;
                                                              &lt;field name="rows"/&gt;
                                                              &lt;field name="weight"/&gt;
                                                              &lt;separator colspan="4" string="Pallet Dimension"/&gt;
                                                              &lt;field name="height"/&gt;
                                                              &lt;field name="width"/&gt;
                                                              &lt;field name="length"/&gt;
                                                          &lt;/group&gt;
                                                          &lt;separator colspan="4" string="Description"/&gt;
                                                          &lt;field name="name"/&gt;
                                                      &lt;/form&gt;
                                                  &lt;/field&gt;
                                                  &lt;separator string="Description for Quotations"/&gt;
                                                  &lt;field name="description_sale" placeholder="note to be displayed on quotations..."/&gt;
                                              &lt;/page&gt;
                                          &lt;/notebook&gt;
                                      &lt;/sheet&gt;
                                      &lt;div class="oe_chatter"&gt;
                                          &lt;field name="message_follower_ids" widget="mail_followers"/&gt;
                                          &lt;field name="message_ids" widget="mail_thread"/&gt;
                                      &lt;/div&gt;
                                  &lt;/form&gt;
  </code></pre>