Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
5015 Lượt xem

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
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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 

Ảnh đại diện
Huỷ bỏ
Tác giả

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

Bài viết liên quan Trả lời Lượt xem Hoạt động
13
thg 4 23
59181
2
thg 3 18
8011
1
thg 4 15
3956
4
thg 12 21
12222
2
thg 5 21
4088