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

Programming Error There is no reference field 'Rdv' found for 'rdv'

By
sanaa tayb
on 5/15/13, 6:27 PM 4,102 views

Please i have a problem with the folowing code:it gives me the following error :

Programming Error There is no reference field 'Rdv' found for 'rdv'

patient.py

from openerp import addons 
from osv import fields, osv
import time

class patient(osv.osv):


    _name='patient'
    _description='dossier administratif du patient'

    _columns={
                'name' : fields.char('numero d`adhesion', size=30, required=True),
                'cin_patient' : fields.char('CIN', size=30),
                'date_dinscription' : fields.date('Date d`inscription'),
                'num_dossier' : fields.char('numero de dossier', size=30, required=True),
                'rdv_ids': fields.one2many('rdv','Rdv'),

    }

patient()

rdv.py

from osv import fields,osv

import time

from datetime import datetime
from tools.translate import _


class rdv(osv.osv):

    _name = 'rdv'
    _columns = {
      'name': fields.char('Objet',size=32, required=True),
      'date_debut': fields.date('Date Début'),
      'date_fin': fields.date('Date fin'),
      'patient_id': fields.many2one('patient','Patient', required=True),
      'doctor_id': fields.char('Docteur',size=32, required=True),
    }
rdv()

patient_secretaire.xml

    <?xml version="1.0" encoding="utf-8"?>
    <openerp>
    <data>
    <menuitem name="Secretaire" id="menu_patients_parent"/>
    <menuitem name="Patient" id="menu_patients_parent1" parent="menu_patients_parent"/>


<record model="ir.ui.view" id="patient_tree_view">
    <field name="name">patient.tree</field>
    <field name="model">patient</field>
    <field name="type">tree</field>
    <field name="arch" type="xml">
        <tree string="Patient" version="7.0">

                                        <field name="name"/>
                                        <field name="cin_patient"/>
                                        <field name="date_dinscription"/>
                                        <field name="num_dossier"/>

        </tree>
    </field>
</record>
<record model="ir.ui.view" id="patient_form_view">
        <field name="name">patient.form</field>
        <field name="model">patient</field>
        <field name="type">form</field>
        <field name="arch" type="xml">
            <form string="Patient" version="7.0">
            <field name="rdv_ids" colspan="4" nolabel="1" >
                    <tree string="Rendez vous"  >
                            <field name="name" />
                            <field name="date_debut" />
                            <field name="date_fin" />
                            <field name="doctor_id" />

                   </tree>
                   <form string="Rendez vous"  >
                           <field name="name" />
                            <field name="date_debut" />
                            <field name="date_fin" />
                            <field name="doctor_id" />
                    </form>
                </field>
                <sheet>

                        <notebook>

                            <page string=" Information Publique">

                                    <group>

                                            <group colspan="4" col="4" string=" Information General">
                                            <field name="name"/>
                                            <field name="cin_patient"/>
                                            <field name="date_dinscription"/>
                                            <field name="num_dossier"/>
                                            </group>
                                    </group>
                        </notebook>
                </sheet>    
            </form>
        </field>
</record>
<record model="ir.actions.act_window" id="list_form">
    <field name="name">patient</field>
    <field name="res_model">patient</field>
    <field name="view_type">form</field>
    <field name="view_mode">tree</field>
</record>
<record model="ir.actions.act_window" id="nouv_form">
    <field name="name">patient</field>
    <field name="res_model">patient</field>
    <field name="view_type">form</field>
    <field name="view_mode">form</field>
</record>


<menuitem name="Liste des dossiers admin" parent="menu_patients_parent1" id="notebook_menu_mainform" action="list_form" sequence="1"/>
<menuitem id="new_patient" name="Nouveau patient"  parent="menu_patients_parent1" action="nouv_form" sequence="2"/>

</data>
</openerp>

rdv_sec.xml

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


    <record model="ir.ui.view" id="rdv_tree_view">
    <field name="name">rdv.tree</field>
    <field name="model">rdv</field>
    <field name="type">tree</field>
    <field name="arch" type="xml">
        <tree string="Rendez-vous" version="7.0">


                                                <field name="patient_id" />
                                                <field name="name" />
                                                <field name="date_debut" />
                                                <field name="date_fin" />
                                                <field name="doctor_id" />                      




        </tree>
    </field>
</record>
<record model="ir.ui.view" id="rdv_form_view">
        <field name="name">rdv.form</field>
        <field name="model">rdv</field>
        <field name="type">form</field>
        <field name="arch" type="xml">
            <form string="Rendez-vous" version="7.0">



                                            <group colspan="4" col="4" string=" Information General">
                                                <field name="patient_id" />
                                                <field name="name" />
                                                <field name="date_debut" />
                                                <field name="date_fin" />
                                                <field name="doctor_id" />
                                        </group>


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

<record id="view_emploi_calendar" model="ir.ui.view">
        <field name="name">rdv.calendar</field>
        <field name="model">rdv.temps</field>
        <field name="arch" type="xml">
            <calendar color="patient_id" date_start="date_debut" date_stop="date_fin" string="rendez-vous" >
                <field name="name"/>
            </calendar>
        </field>
    </record>

<record model="ir.actions.act_window" id="rendez_vous_form">
    <field name="name">rdv</field>
    <field name="res_model">rdv</field>
    <field name="view_type">form</field>
    <field name="view_mode">form,tree,calendar</field>
</record>
<menuitem id="rendez_vous" name="Rdv"  parent="menu_patients_parent1" action="rendez_vous_form" sequence="3"/>



</data>
</openerp>
1

Borni DHIFI

--Borni DHIFI--
5102
| 6 8 9
Tunis, Tunisia
--Borni DHIFI--

Techno Functional Consultant Odoo(OpenERP) 

http://www.linkedin.com/in/borni

Skype : dhifi.borni

Borni DHIFI
On 5/15/13, 6:54 PM

Hi,

Syntax fields.one2many:

fields.one2many(
        'other.object.name',
        'Field relation id',
        'Fieldname',
        optional parameter)

so in patient change :

'rdv_ids': fields.one2many('rdv','Rdv'),

to

'rdv_ids': fields.one2many('rdv','patient_id','Rdv'),

Thanks.

thank you for your answer , it was that the problem , thank you a looot :)

sanaa tayb
on 5/15/13, 7:40 PM

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: 5/15/13, 6:27 PM
Seen: 4102 times
Last updated: 3/16/15, 8:10 AM