Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
5024 มุมมอง

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

Related Posts ตอบกลับ มุมมอง กิจกรรม
Hide menu for existing group แก้ไขแล้ว
13
เม.ย. 23
59184
2
มี.ค. 18
8015
Unexpected menu behaviour - v8 new api แก้ไขแล้ว
1
เม.ย. 15
3964
Creating a new Menu item แก้ไขแล้ว
4
ธ.ค. 21
12225
2
พ.ค. 21
4092