Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Integrity Error with calendar.event module

By
oumaima
on 6/6/13, 1:35 PM 629 views

Hi everyone,i wanna add a calendar for each professor: but i have this error: Integrity Error

The operation cannot be completed, probably due to the following: - deletion: you may be trying to delete a record while other records still reference it - creation/update: a mandatory field is not correctly set

[object with reference: date - date]

mufile.py

from osv import fields,osv

import time from datetime import datetime from tools.translate import _

class professeur_entity(osv.osv): #il faut hériter de l'objet calendar.event pour qu'on puisse hériter la vue calendar _inherit='calendar.event' _name = 'professeur.entity' _columns = { 'name': fields.char('Nom', required=True, size=32), 'prenom': fields.char('Prenom', required=True, size=32), 'le':fields.many2one('calendar.event', 'Emploi du temps',help="emploi du temps"),

}

professeur_entity()

myfile.xml

enter code here
<menuitem name="Gestion professeur" id="menu_prof"/>    

   <menuitem name="Enseignant" id="menu_prof1" parent="menu_prof"/>

<record model="ir.ui.view" id="view_school_prof_form">
    <field name="name">prof.form</field>
    <field name="model">professeur.entity</field>
    <field name="type">form</field>
    <field name="arch" type="xml">
       <form string="Enseignant"  version="7.0">
           <group col="4" colspan="6">       
               <field name="name"/>
               <field name="prenom"/>
               <field name="emp_ids"/>  


    </group>

       </form>
    </field>
</record>   

    <record model="ir.ui.view" id="view_school_prof_tree">
    <field name="name">prof.tree</field>
    <field name="model">professeur.entity</field>
    <field name="type">tree</field>
    <field name="arch" type="xml">
        <tree string="Enseignants"  version="7.0">
               <field name="name"/>
               <field name="prenom"/>       
            <field name="emp_ids"/>                
       </tree>
    </field>
</record>



<record model="ir.actions.act_window" id="action_school_prof_form">
    <field name="name">enseignants</field>
    <field name="res_model">professeur.entity</field>
    <field name="view_type">form</field>
    <field name="view_id" ref="base_calendar.event_calendar_view"/><!--Il faut ajouter id de vue calendar de cette façon -->
    <field name="view_mode">tree,form</field>
</record>

    <!--  Et finalement il y a le menu qui contient l'action pour ouvrir la vue tree de ton module -->

<menuitem action="action_school_prof_form" id="menu_prof2" parent="menu_prof1" />

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 6/6/13, 1:35 PM
Seen: 629 times
Last updated: 3/16/15, 8:10 AM