Reputation: 1473
I am a newbie on Odoo 13.0 (and any Odoo version). I just built my first module, and successfully installed it. The problem is that I can't see my installed module on the menu. I have tried restarting the server and also I have researched these sources but anything seems to work for me:
Sources:
Here are my files, so hopefully, someone could point me out in the right direction.
__manifest__.py
# -*- coding: utf-8 -*-
{
'name': "sample_app",
'summary': """
Short (1 phrase/line) summary of the module's purpose, used as
subtitle on modules listing or apps.openerp.com""",
'description': """
Long description of module's purpose
""",
'author': "My Company",
'website': "http://www.yourcompany.com",
# Categories can be used to filter modules in modules listing
# Check https://github.com/odoo/odoo/blob/13.0/odoo/addons/base/data/ir_module_category_data.xml
# for the full list
'category': 'Uncategorized',
'version': '0.1',
# any module necessary for this one to work correctly
'depends': ['base'],
# always loaded
'data': [
# 'security/ir.model.access.csv',
'views/views.xml',
'views/templates.xml',
],
# only loaded in demonstration mode
'demo': [
'demo/demo.xml',
],
'installable':True,
'auto_install':False,
'application':True
}
__init__.py
# -*- coding: utf-8 -*-
from . import controllers
from . import models
models/models.py
# -*- coding: utf-8 -*-
from odoo import models, fields, api
class StudentRecord(models.Model):
_name = "student.student"
name = fields.Char(string="Name", required=True)
middle_name = fields.Char(string="Middle Name", required=True)
last_name = fields.Char(srtring="Last Name", required=True)
photo = fields.Binary(string="Photo")
student_age = fields.Integer(string="Age")
student_dob = fields.Date(string="Date of Birth")
student_gender = fields.Selection([("m","Male"),("f","Female"),("o","Other")], string="Gender")
student_blood_group = fields.Selection(
[
("A+","A+ve"),
("B+","B+ve"),
("O+","O+ve"),
("AB+","AB+ve"),
("A-","A-ve"),
("B+","B-ve"),
("O-","O-ve"),
("AB-","AB-ve"),
], string = "Blood Group")
views/views.xml
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="view_student_form" model="ir.ui.view">
<field name="name">student.student.form</field>
<field name="model">student.student</field>
<field name="priority" eval="8" />
<field name="arch" type="xml">
<form string="Student">
<sheet>
<field name="photo" widget="image" class="oe_left oe_avatar" />
<div class="oe_title">
<h1>
<table>
<tr>
<td style="padding-right:10px;"><field name="name" required="1" placeholder="First Name" /></td>
<td style="padding-right:10px;"><field name="middle_name" placeholder="Middle Name" /></td>
<td style="padding-right:10px;"><field name="last_name" placeholder="Last Name" /></td>
</tr>
</table>
</h1>
</div>
<notebook colspan="4">
<page name="personal_information"
string="Personal Information">
<group col="4" colspan="4"
name="personal_detail">
<field name="student_gender" />
<field name="student_age" />
<field name="student_dob" />
<field name="student_gender" />
<field name="student_blood_group" />
</group>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="action_view_students">
<field name="name">Students</field>
<field name="res_model">student.student</field>
<field name="view_mode">tree,form</field>
<field name="domain">[]</field>
</record>
<menuitem id="menu_school" name="School"/>
<menuitem id="school_student" name="Students" parent="menu_school" action="action_view_students"/>
</odoo>
Edit: Here is the image of the menu, I was expecting to see my sample_test application in there after installation.
Also, Odoo shows my installed app here:
I appreciate your time and help in the matter. Thanks!!
Upvotes: 0
Views: 3106
Reputation: 246
Another hint, set your user to the proper group:
Settings / Manage Users / Your User (Edit) / Other /
Tick [ ] the proper group - e.g. Your module: Admin
Upvotes: 0
Reputation: 1999
This is happening because of security file
. Because you didn't set security to that model.
Let me explain it with more details: You're creating your custom model and views with menus and all that stuff but you didn't assign anyone who can read these things, who can write, who can delete and etc that is why you're facing this issue your view is created and your model with your custom fields have been created successfully in back end but not visible
For that we will use our security file to grant access to our required group/users
security/ir.model.access.csv
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink access_student_student,access.student.student,model_student_student,base.group_user,1,1,1,1
Here you can see I'm giving access to base.group_user and what of access I'm giving? Here you can see 1s which means YES and I'm giving permission of reading(prem_read), permission of write(prem_write), permission of create(prem_create) and last one permission of deletion(prem_unlink).
Permission of read will able you to read(view) your model in graphical form.
Note: Dont forget to add security file in your manifest file in data list
Upvotes: 3
Reputation: 1
Mostly it happens when we haven't added our security file in manifest, I see in the code that its been commented out
Upvotes: 0
Reputation: 1473
I just found how to do it. These are the steps I followed to solve my problem:
And, that is the end for the story (for now) I still need to figure out how to deploy this changes into production, but that my friends is another story!
Thanks!
Upvotes: 1