跳至內容
選單
此問題已被標幟
1 回覆
5038 瀏覽次數

i have a Model have 3 fields 


class CreateViewSql(models.Model):
    _name = "create.view.sql"

    email = fields.Char(string='Email')
    name = fields.Char(string='Name')
    phone = fields.Char(string='Phone')

and xml file
<odoo>
  <!-- Form View Car -->
  <record id="car_form" model="ir.ui.view">
    <field name="name">view.sql.form</field>
    <field name="model">create.view.sql</field>
    <field name="arch" type="xml">
      <form>
        <group>
          <field name="name"/>
          <field name="phone"/>
          <field name="email"/>
          <!-- <field name="type_of"/> -->
        </group>
      </form>
    </field>
  </record>
  <!--  -->

  <!-- Tree View Car -->
  <record id="car_tree" model="ir.ui.view">
    <field name="name">view.sql.tree</field>
    <field name="model">create.view.sql</field>
    <field name="arch" type="xml">
      <tree>
        <field name="name"/>
        <field name="phone"/>
        <field name="email"/>
        <!-- <field name="type_of"/> -->
      </tree>
    </field>
  </record>
  <!--  -->
  <!-- Action For Car -->
  <record id="action_view_sql" model="ir.actions.act_window">
    <field name="name">ViewSql</field>
    <field name="type">ir.actions.act_window</field>
    <field name="res_model">create.view.sql</field>
    <field name="view_mode">tree,form</field>
  </record>
  <!--  -->

  <!-- Menu Car -->
  <menuitem id="view_sql" name="ViewSql" sequence="2" action="action_view_sql"/>
</odoo>

i try add _auto: False in model to not create table in DB then i cant access menu and treeview
Have any solution to store TEMP data in model and can access menu and treeview
頭像
捨棄
最佳答案

Hi,

The reason why you are not seeing the menu is that you may not given Security / Access Rights

If You are a Super User  you can see the menu even without adding the security , The Super User has unrestricted access to all models

Activate Developer Mode > Debug Button (Near Login user name on top right) > Became a Super User


You can use TransientModel for storing temporary data ,TransientModel stores data in the database temporary and is automatically cleaned up on a defined period of time 

頭像
捨棄
作者

i used TransientModel but this data i need to store from my custom search module and TransientModel store data to long. Can i delete that data after f5 treeview page.

There is scheduled action to clean up the data , You can find it in Settings >> Technical >> Automation >> Schedule Actions >> Auto-vacuum internal data , you can adjust action intervel there

相關帖文 回覆 瀏覽次數 活動
13
4月 23
59185
2
3月 18
8022
1
4月 15
3975
4
12月 21
12231
2
5月 21
4093