OpenERP自定义模块在模块列表升级后未显示

2024-05-08 22:35:41 发布

您现在位置:Python中文网/ 问答频道 /正文

 Put module in addons-path                      [x]
 Technical Features                             [x] 
 Restart openerp-server                         [x] 
 Click the update module list button            [x] 
 Clear the "installed" filter in the search box [x]

我的自定义模块在模块列表中仍然不可见。在

但是,可以通过代码找到:

^{pr2}$

编辑

模块结构

chaouche@karabeela ~/CODE/OPENERP/addons/helloworld $ ls
total 20K
-rw-r--r-- 1 chaouche chaouche  222 Mar  7 19:27 client.py
-rw-r--r-- 1 chaouche chaouche   14 Feb 18 16:37 __init__.py
-rw-r--r-- 1 chaouche chaouche  444 Mar  7 20:02 __openerp__.py
-rw-r--r-- 1 chaouche chaouche 4.8K Mar  7 21:14 view.xml
chaouche@karabeela ~/CODE/OPENERP/addons/helloworld $

__openerp__.py

chaouche@karabeela ~/CODE/OPENERP/addons/helloworld $ cat __openerp__.py
{
        "name"        : "Hello World !",
        "author"      : "yassine chaouche",
        "version"     : '0.1',
        "email"       : "yacinechaouche@yahoo.com",
        "website"     : "http://ychaouche.wikispot.org",
        "category"    : "example",
    "description" : "a simple hello world example showing how to create a module",
    "summary"     : "Hello world !",
        "depends"     : ["base"],
        "data"        : ["view.xml"],
        "demo"        : [],
        "installable" : True,
}
chaouche@karabeela ~/CODE/OPENERP/addons/helloworld $

client.py

chaouche@karabeela ~/CODE/OPENERP/addons/helloworld $ cat client.py
from openerp.osv import osv, fields

class client(osv.osv):
    _inherit = "res.partner"
    _columns  = {
        "document" : fields.binary("document")
        }

c = client()
#yassine
print "my module : client is : ",c
chaouche@karabeela ~/CODE/OPENERP/addons/helloworld $

__init__.py

chaouche@karabeela ~/CODE/OPENERP/addons/helloworld $ cat __init__.py
import client
chaouche@karabeela ~/CODE/OPENERP/addons/helloworld $

view.xml

chaouche@karabeela ~/CODE/OPENERP/addons/helloworld $ cat view.xml 
<?xml version="1.0" encoding="utf-8"?>
<!-- we ensure that encoding is set correctly-->
<!-- all of our view must be enclosed in openerp tags -->
<openerp>
  <!-- here we are defining data -->
  <!-- other possible tags are : -->
  <!-- idk                       -->
  <!-- idk                       -->
  <!-- idk                       -->
  <!-- no specs whatsoever       -->
  <data>
   <!-- there are only two possible tags that you can put here                  -->
   <!-- <record> tags and <menuitem> tags                                       -->
   <!-- menuitems create menu items in the general menu on the left             -->
   <!-- an action must be associated with them                                  -->
   <!-- actions are created with a <record> tag with a specific model attribute -->
   <!-- <record model="ir.actions.act_window"> creates an action                -->
   <!-- records are a way of describing a row in the openerp database.          -->
   <!-- the model attribute represents the table that you want to insert to.    -->
   <!-- Records are kind of a SQL insert statement in an XML form               -->
   <!-- that's why there are <field> tags inside <record> tags, they represent  -->
   <!-- columns values.                                                         -->

   <!-- There are only two types of records : view records and action records  -->
   <!-- action records are created with the "ir.actions.act_window"            -->
   <!-- model (which maps to a table).                                         -->
   <!-- ir_act_window is a table in the openerp database, you can fire up      -->
   <!-- pgadmin to check it out. Possible fields for an action record are      -->
   <!-- columns of the ir_act_window table.                                    -->

   <!-- The same goes for the view records. A view record is created with the  -->
   <!-- "ir.ui.view" model which maps to the  ir_ui_view table in the openerp  -->
   <!-- database and fields inside a view record are also values for columns   -->
   <!--  in that table.                                                        -->


   <!-- You can take a look at the xml files in the addons directory for some  -->
   <!-- real life examples.                                                    -->

   <record id="client_form" model="ir.ui.view">
     <!-- Now say we want to change our partner form view to add in a special    -->
     <!-- ui element to upload files. We need to tell OpenERP that we are going  -->
     <!-- to inherit from the current partner form by adding an inherit_id field -->    
     <!-- that will be set to the our partner form ID. But how do we get that    -->
     <!-- ID ?                                                                   -->

     <!-- We must enable developer mode (click on your username, click about     -->
     <!-- openerp, click enable debug mode). After that we go to the sales       -->
     <!-- module and click on a partner (any partner). We should have the form   -->
     <!-- view open. In the middle top we should see a new ui element, a         -->
     <!-- selection box with Debug View #129 inside. Click on that list then     -->
     <!-- select manage views. A popup div opens with all the views that are     -->
     <!-- associated with what we are currently seeing. This gives us view id    -->
     <!-- whichi is res.partner.form. We'll use that as the inherit_id attribute -->

     <field name="name">client.form</field>
     <field name="model">res.partner</field>
     <field name="inherit_id" ref="res.partner.form" />

     <!-- Up until now we haven't written a single line of UI element, we're     -->
     <!-- filling some mandatory fields (columns) that OpenERP uses to manage    -->
     <!-- its views. The real UI code must go inside a special 'arch' field.     -->
     <field name="arch" type="XML">
       <!-- this will store our view structure                                   -->
       <!-- so we need to tell openerp that we would like to add a new page in   -->
       <!-- the notebook that's on the bottom. We simply add the notebook tag    -->
       <!-- and specify that we want to add something to it (not replace it) by  -->
       <!-- setting the position attribute to "inside", meaning all fields       -->
       <!-- following must be place inside the notebook. Other possible values   -->
       <!-- for this attribute are "after", "before" and "replace". "inside"     -->
       <!-- being the default.                                                   -->
       <notebook position="inside">
         <!-- this page will be added to the other pages of the notebook         -->
         <page string="Document">
           <field name="res.partner.document"/>
         </page>
       </notebook>
     </field>
   </record>
  </data>
</openerp>
chaouche@karabeela ~/CODE/OPENERP/addons/helloworld $

Tags: thetoinviewfieldthatcodeopenerp