【问题标题】:How add rows to list view in odoo?如何在odoo中添加行到列表视图?
【发布时间】:2015-05-26 15:23:21
【问题描述】:

我有一个来自 wsdl 文件的结果数据,我想把这些数据放在我的 odoo 模块的树视图中:

这是我的模块架构: init.py(我在其中导入 module.py) openerp.py(依赖项:基础) _module.py(我有主代码,一切正常)templates.xml(主视图与主代码一起,没问题)

有.xml文件:

    <?xml version="1.0" encoding="utf-8"?>

<openerp>
    <data>

    <menuitem name="Document_Binov" id="Doc_Bin" sequence="30" />
    <menuitem name="Documents" id="menu_list_doc" parent="Doc_Bin" sequence="10" />

<!-- Form example --> 
 <record model="ir.ui.view" id="document_form">
  <field name="name">document.form</field>
  <field name="model">document_binov.document_binov</field>
  <field name="type">form</field>
  <field name="arch" type="xml">
   <form string="Documents">
 <sheet>
 <group>
    <label string="Titre"/>
     <field name="titre"/> 
     <label string="Description"/> 
    <field name="description"/>  
    <label string="Type"/>
    <field name="type"/>
    </group> 
     </sheet>
    </form>
  </field>
</record>

<!--Tree view example -->
<record model="ir.ui.view" id="document_tree_view">
 <field name="name">document.tree.view</field>
 <field name="model">document_binov.document_binov</field>
 <field name="type">tree</field>
 <field name="arch" type="xml">
  <tree string="Documents">

      <field name="titre"/> 
      <field name="description"/>
      <field name="type" /> 
  </tree>
 </field>
</record>


 <!-- déclaration d'action -->

 <record model="ir.actions.act_window" id="action_document_work"> 
  <field name="name">Liste des documents</field>
  <field name="res_model">document_binov.document_binov</field>
  <field name="view_type">form</field>
  <field name="view_mode">tree,form</field>
  <!-- <field name="help" type="html"/> --> 
  <field name="document_tree_view" ref="document_form"></field>

</record>    

 <!--déclaration menu -->
<!-- <menuitem id="document" name="Documents" /> -->

<!-- déclaration de menu principale niveau 1-->
<!-- déclaration de menu niveai 1.1(sans action=non cliquable) -->
<menuitem id="document_menu" name="Liste des documents" parent="menu_list_doc" action="action_document_work" sequence="10"/> 

    </data>
</openerp>

还有.py文件:

class document_binov(models.Model):
     _name = 'document_binov.document_binov'
     _description = 'visualise les documents'

     titre = fields.Char(default='a')
     description = fields.Char('Description')
     type = fields.Char('Type')

请帮我把我的结果数据放到树视图中。 提前致谢

【问题讨论】:

  • 问题是什么?
  • 感谢您的回复,我再次编辑我的问题并提供更多解释

标签: python xml treeview odoo


【解决方案1】:

在 document_binov 类的构造函数中,您应该打开文件,对其进行解析并一一填写记录。 Odoo 将管理其余部分。

【讨论】:

  • 感谢您的回复。我是odoo开发的初学者,所以接受我的请求。你能详细说明你的解决方案吗?我真的需要你的帮助。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-12-06
  • 2013-05-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多