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

By
aci aisha
on 2/4/15, 3:34 AM 442 views

Friends i created a new module project_password with the following files,

project_password.py

# -*- coding: utf-8 -*-


from openerp.osv import fields, osv
#from datetime import datetime
#from gdata.data import Visibility
#from docutils.nodes import Invisible


class project_password(osv.osv):
    
    _name = 'project.password'
    
    _inherit = ['project.project','res.partner','res.users']
    
    _description = 'Password'
    
    _columns = {
        'name': fields.many2one('res.partner','Customer Name', domain=[('customer', '=', True)], required=True),
        'password1': fields.char('Password 1', required=True),
        'password2': fields.char('Password 2'),
        'password3': fields.char('Password 3'),
        'viewed_by1': fields.many2many('res.users','name'),
    }
project_password()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

project_password_view.xml

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>


        <menuitem id="menu_project_password_sub" name="Password" parent="base.menu_main_pm"/>
        
        
         <record id="view_password" model="ir.ui.view">
            <field name="name">project.password.tree</field>
            <field name="model">project.password</field>
            <field name="arch" type="xml">
                <tree string="Password">
                      <field name="name"/>
                      <field name="password1"/>
                      <field name="password2"/>
                      <field name="password3"/>  
                </tree>
            </field>
       </record>
    
        <record id="view_password_form" model="ir.ui.view">
            <field name="name">project.password.form</field>
            <field name="model">project.password</field>
            <field name="arch" type="xml">
                <form string="Password">
                   <group>
                      <field name="name"/> 
                      <field name="password1"/>
                      <field name="password2"/>
                      <field name="password3"/>                
                  </group>                              
           <notebook>
              <page string="Viewers">
                  <kanban quick_create="false" create="true" delete="true">
                                    <templates>
                                        <t t-name="kanban-box">
                                            <div style="position: relative">
                                                <a t-if="! read_only_mode" type="delete" style="position: absolute; right: 0; padding: 4px; diplay: inline-block">X</a>
                                                <div class="oe_module_vignette">
                                                    <img t-att-src="kanban_image('res.users', 'image_small', record.id.value)" class="oe_avatar oe_kanban_avatar_smallbox"/>
                                                    <div class="oe_module_desc">
                                                        <field name="viewed_by1">
                                                         <tree>
                                                           <field name="name"/>
                                                         </tree>
                                                        </field>
                                                    </div>
                                                </div>
                                            </div>
                                        </t>
                                    </templates>
                  </kanban>
              </page>
           </notebook>
                  
                </form>
            </field>     
       </record>

        <record id="project_password_action" model="ir.actions.act_window">
            <field name="name">Password</field>
            <field name="res_model">project.password</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>           
        </record>
        
        <menuitem action="project_password_action" id="menu_passwords" name="Password" parent="menu_project_password_sub"/>
    </data>
</openerp>

I install it when trying to create a user & save from this view the following error occure,

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: name - name]

 

 

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: 2/4/15, 3:34 AM
Seen: 442 times
Last updated: 3/16/15, 8:10 AM