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

TypeError in Calendar view when opening page, in Odoo version 9

By
Trevor Nemanic
on 12/30/15, 4:40 PM 603 views

I am using Odoo v9 and receive the following TypeError when I open the page to look at the calendar and also when I click on the calendar to create an event. I believe the problem is either date_start references a String and not a DateTime, or I need to specify additional fields in the Calendar view. How do I fix this issue?

My class in Python:

class Appointments(models.Model):

   apt_date_start = fields.Datetime()

   apt_date_stop = fields.Datetime()

   notes = fields.Char()


Calendar view

 <record id="fix_tribe_appointments_calendar" model="ir.ui.view">

    <field name="name">FixTribe Appointments Calendar</field>

    <field name="model">fix_tribe.appointments</field>

    <field name="arch" type="xml">

        <calendar string="Appointments"

            mode="day"   date_stop="apt_date_stop"

            date_start="apt_date_start" quick_add="False" >

            <field name="notes"/>

        </calendar>

    </field>

</record>



The error:

Uncaught TypeError: Cannot read property 'type' of undefined

http://localhost:8069/web/content/714-5d121d4/web.assets_backend.js:4746
Traceback:
TypeError: Cannot read property 'type' of undefined
    at http://localhost:8069/web/content/714-5d121d4/web.assets_backend.js:4746:165
    at Function._.each._.forEach (http://localhost:8069/web/content/703-114de7a/web.assets_common.js:12:558)
    at Object.<anonymous> (http://localhost:8069/web/content/714-5d121d4/web.assets_backend.js:4746:110)
    at fire (http://localhost:8069/web/content/703-114de7a/web.assets_common.js:644:299)
    at Object.self.fireWith [as resolveWith] (http://localhost:8069/web/content/703-114de7a/web.assets_common.js:649:198)
    at Object.<anonymous> (http://localhost:8069/web/content/703-114de7a/web.assets_common.js:650:874)
    at fire (http://localhost:8069/web/content/703-114de7a/web.assets_common.js:644:299)
    at Object.self.fireWith [as resolveWith] (http://localhost:8069/web/content/703-114de7a/web.assets_common.js:649:198)
    at Object.deferred.(anonymous function) (http://localhost:8069/web/content/703-114de7a/web.assets_common.js:651:56)
    at fire (http://localhost:8069/web/content/703-114de7a/web.assets_common.js:644:299)
0

Jignesh Mehta

--Jignesh Mehta--
2087
| 6 4 8
Surat, India
--Jignesh Mehta--


Jignesh Mehta
On 1/5/16, 4:44 AM

Hello Trevor,


You give date_start field as a Char which is wrong for the Calendar view.


Change type of apt_date_start  Char to Datetime.

apt_date_start = fields.Datetime()

and also import datetime through

from datetime import datetime


Thanks,

I've put out a new version (now shown in the post) that changed Char to Datetime, but the error persists. I even cascaded dropped the Appointments table, and added on an end time to see if that would work. Still doesn't

Trevor Nemanic
on 1/5/16, 10:44 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: 12/30/15, 4:40 PM
Seen: 603 times
Last updated: 1/5/16, 10:42 PM