In my student management system when I am saving my subject name it is stored as record numbers 1,2,3,----instead of subjectname getting saved in Odoo12 Community Version
My Model is:-
from odoo import models,fields,api
class StudentSubject(models.Model):
_name = 'student.subject'
name= fields.Char(string='Subject Name', required=True)
class StudentBranch(models.Model):
_name = 'student.branch'
_rec_name = 'subname'
name= fields.Char(string='BranchName', required=True)
branchcode= fields.Integer(string='Branch Code')
subname= fields.One2many('student.subject','name',string='Subject Name')
My View :-
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<!--Branch Generic View -->
<record id="studentbranch_menu_action" model="ir.actions.act_window">
<field name="name">Branch</field>
<field name="res_model">student.branch</field>
<field name="view_type">form</field>
<field name="view_mode">kanban,tree,form</field>
<field name="domain">[]</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">Create The First Branch
</p>
</field>
</record>
<!-- Tree View of branch -->
<record id="view_tree_studentbranch" model="ir.ui.view">
<field name="name">Branch</field>
<field name="model">student.branch</field>
<field name="arch" type="xml">
<tree>
<field name="branchcode"/>
<field name="name"/>
<field name="subname" mode='tree'/>
</tree>
</field>
</record>
<!-- Subjects Generic View -->
<record id="studentsubject_menu_action" model="ir.actions.act_window">
<field name="name">Subjects</field>
<field name="res_model">student.subject</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[]</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">Create The First Subject
</p>
</field>
</record>
<!-- Tree View of Subject -->
<record id="view_tree_studentsubject" model="ir.ui.view">
<field name="name">SubjectsSubject</field>
<field name="model">student.subject</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
</tree>
</field>
</record>
<!-- Kanban View of Branch -->
<record id="studentbranch_kanban_view" model="ir.ui.view">
<field name="name">StudentBranch Kanban</field>
<field name="model">student.branch</field>
<field name="arch" type="xml">
<kanban>
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_global_click">
<div class="oe_kanban_details">
<ul>
<li><field name="name"/></li>
</ul>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<menuitem id="school_studentsubject_menu"
parent="school_menu"
name="Branch" sequence="3"/>
<menuitem id="school_studentbranch_details_menu"
parent="school_studentsubject_menu"
name="Branchs"
action="studentbranch_menu_action"/>
<menuitem id="school_studentsubject_details_menu"
parent="school_studentsubject_menu"
name="Subjects"
action="studentsubject_menu_action"/>
</data>
</odoo>
Please Help....
Thanks in Advance...
Please use concise and meaningful titles. It will also help you to really identify your problems.
Okay...Thanks...