تخطي للذهاب إلى المحتوى
أودو القائمة
  • تسجيل الدخول
  • جرب مجاناً
  • التطبيقات
    المالية
    • المحاسبة
    • فوترة
    • النفقات
    • جدول البيانات (BI)
    • المستندات
    • توقيع إلكتروني
    المبيعات
    • إدارة علاقات العملاء
    • المبيعات
    • نقطة البيع للمتاجر
    • نقطة البيع للمطاعم
    • الاشتراكات
    • تأجير
    المواقع الإلكترونية
    • أداة بناء المواقع الإلكترونية
    • متاجر إلكترونية
    • مدونة
    • المنتدى
    • دردشة مباشرة
    • التعليم الإلكتروني
    سلسلة التوريد
    • المستودعات
    • التصنيع
    • إدارة دورة حياة المنتج
    • المشتريات
    • الصيانة
    • الجودة
    الموارد البشرية
    • موظفون
    • التوظيف
    • إجازة عمل
    • التقييمات
    • الإحالات
    • تطبيق الأسطول
    التسويق
    • التسويق الإجتماعي
    • التسويق عبر البريد الإلكتروني
    • التسويق عبر الرسائل النصية
    • فعاليات
    • أتمتة التسويق
    • الاستطلاعات
    الخدمات
    • المشاريع
    • الجداول الزمنية
    • الخدمة الميدانية
    • مكتب المساعدة
    • التخطيط
    • مواعيد
    اﻹنتاجية
    • مناقشة
    • الموافقات
    • إنترنت الأشياء "IoT"
    • بروتوكول ربط المحادثات الصوتية عبر الإنترنت
    • المعرفة
    • WhatsApp
    التطبيقات الخارجية ستوديو أودو منصة أودو السحابية
  • قطاعات الأعمال
    البيع بالتجزئة
    • متجر كتب
    • متجر ملابس
    • متجر أثاث
    • متجر بقالة
    • متجر معدات
    • متجر ألعاب
    الطعام والضيافة
    • بار وحانة
    • المطعم
    • مطعم للوجبات السريعة
    • نزل للضيوف
    • موزّع مشروبات
    • فندق
    العقارات
    • وكالة عقارات
    • شركة هندسة معمارية
    • البناء
    • إدارة العقارات
    • العناية بالحدائق
    • اتحاد مُلاّك العقارات
    استشارة
    • مؤسسة محاسبية
    • شريك أودو
    • وكالة تسويقية
    • منشأة قانونية
    • استقطاب المواهب
    • التدقيق والتوثيق
    التصنيع
    • الأقمشة
    • معدني
    • الأثاث
    • الطعام
    • مصنع خمور
    • هدايا الشركات
    الصحة واللياقة البدنية
    • نادي رياضي
    • متجر نظارات
    • مركز لياقة بدنية
    • الممارسون الصحيون
    • صيدلية
    • صالون تصفيف الشعر
    التجارة
    • عامل صيانة
    • الأجهزة والمعدات التقنية ودعمها
    • أنظمة الطاقة الشمسية
    • صانع أحذية
    • خدمات التنظيف
    • خدمات التكييف (HVAC)
    غير ذلك
    • منظمة غير ربحية
    • وكالة بيئية
    • تأجير لوحات إعلانية
    • تصوير
    • تأجير دراجات
    • بائع وسيط للبرمجيات
    تصفح كافة قطاعات الأعمال
  • مجتمع أودو
    تعلم
    • دروس
    • التوثيق
    • شهادات
    • التدريب
    • مدونة
    • بودكاست
    قم بتعزيز التعليم
    • برنامج تعليم
    • Scale UP! لعبة الأعمال
    • قم بزيارة أودو
    احصل على البرنامج
    • تحميل
    • قارنْ الإصدارات
    • إطلاق
    تعاون
    • جيت هاب "Github"
    • المنتدى
    • فعاليات
    • الترجمات
    • كنْ شريكاً
    • خدمات الشركاء
    • سجل مكتب المحاسبة الخاص بك
    احصل على الخدمات
    • اعثر على شريك
    • اعثر على محاسب
    • قابل أحد مرشدي الأعمال
    • خدمات التنفيذ
    • مراجع العملاء
    • الدعم
    • الترقيات
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    الحصول على عرض توضيحي
  • الأسعار
  • المساعدة

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • إدارة علاقات العملاء
  • e-Commerce
  • المحاسبة
  • المخزون
  • PoS
  • المشروع
  • MRP
All apps
يجب أن تكون مسجلاً حتى تتفاعل مع المجتمع.
كافة المنشورات الأفراد الشارات
علامات التصنيف (عرض الكل)
odoo accounting v14 pos v15
حول هذا المنتدى
يجب أن تكون مسجلاً حتى تتفاعل مع المجتمع.
كافة المنشورات الأفراد الشارات
علامات التصنيف (عرض الكل)
odoo accounting v14 pos v15
حول هذا المنتدى
المساعدة

How to fix TypeError: Cannot convert undefined or null to object

اشتراك

تسلم الإشعارات عندما يكون هناك نشاط في هذا المنشور

لقد تم الإبلاغ عن هذا السؤال
javascript18.0
1 الرد
6212 أدوات العرض
الصورة الرمزية
Omar El Zaatari

Hello, I'm trying to integrate an open source odoo 16 module that I found online in Odoo 18 but I'm receiving the following error in the developer console of chrome.

web.assets_web.min.js:17 Uncaught Error: Error while loading "@datetime_calendar/components/datetime_calendar":
TypeError: Cannot convert undefined or null to object
    at ModuleLoader.startModule (web.assets_web.min.js:17:225)
    at ModuleLoader.startModules (web.assets_web.min.js:16:57)
    at ModuleLoader.addJob (web.assets_web.min.js:13:39)
    at ModuleLoader.define (web.assets_web.min.js:12:127)
    at web.assets_web.min.js:20259:6

And here's the code:

/* @odoo-module */

import { dateField, DateTimeField } from "@web/views/fields/datetime/datetime_field";import { patch } from "@web/core/utils/patch";const { DateTime } = luxon;const { useState } = owl;

console.log(DateTimeField);

function setCalendar(date, calendar, format = DateTime.DATE_FULL) { console.log("setCalendar called with:", date, calendar); if (!date) return ''; const luxonDate = DateTime.fromISO(date); if (!luxonDate.isValid) return ''; return luxonDate.reconfigure({ outputCalendar: calendar }).toLocaleString(format);}

patch(dateField.prototype, { setup() { this._super?.(); console.log("setup: Value of this.props.value:", this.props.value);

this.calendar = useState({ 'hebrew': setCalendar(this.props.value || DateTime.now().toISO(), "hebrew"), 'islamic': setCalendar(this.props.value || DateTime.now().toISO(), "islamic"), }); },

onDateTimeChanged(date) { this._super?.(date); this.calendar.islamic = setCalendar(date, "islamic"); },

get formattedValue() { return this.isDateTime ? setCalendar(this.props.value, "islamic", DateTime.DATETIME_MED) : setCalendar(this.props.value, "islamic"); },});

patch(DateTimeField.prototype, { setup() { this._super?.(); console.log("setup: Value of this.props.value:", this.props.value);

this.calendar = useState({ 'hebrew': setCalendar(this.props.value || DateTime.now().toISO(), "hebrew"), 'islamic': setCalendar(this.props.value || DateTime.now().toISO(), "islamic"), }); },

onDateTimeChanged(date) { this._super?.(date); this.calendar.islamic = setCalendar(date, "islamic"); },

get formattedValue() { return setCalendar(this.props.value, "islamic"); },});

Why is this error showing, and how can I fix it?
Thank you!

0
الصورة الرمزية
إهمال
الصورة الرمزية
Gracious Joseph
أفضل إجابة

The error TypeError: Cannot convert undefined or null to object typically occurs because an object or property you're trying to use in your code is either undefined or null. Based on the provided code and error message, here's a detailed analysis and fix for the issue:

Root Cause

The error arises when the patch function tries to apply a patch to dateField.prototype or DateTimeField.prototype, but one or both of these are undefined or improperly imported in your module.

The problem seems to stem from this line:

javascriptCopy codeimport { dateField, DateTimeField } from "@web/views/fields/datetime/datetime_field";
  • Odoo 18 (or 16) may not define dateField or DateTimeField as exported members in the module @web/views/fields/datetime/datetime_field. This means you're importing something that does not exist or has changed in the newer version.

Steps to Fix

1. Check the Imports

Ensure the imports match the actual exported objects in @web/views/fields/datetime/datetime_field. Check the source code of this module to confirm whether dateField and DateTimeField are available.

  • You can inspect Odoo’s source code for this module or log the imported objects:
    javascriptCopy codeimport * as datetimeField from "@web/views/fields/datetime/datetime_field";
    console.log(datetimeField);
    
  • If dateField or DateTimeField is undefined, it means these are not part of the module's exports.

2. Update the Module Path or Import Statement

In newer Odoo versions, there might be changes in the structure of the module. Check if dateField or DateTimeField is located in another module. For instance:

javascriptCopy codeimport { DateTimeField } from "@web/views/fields/fields";

If dateField does not exist, you can drop it from your imports.

3. Ensure Luxon Is Properly Imported

Ensure that the luxon library is available in your environment and properly imported:

javascriptCopy codeimport { DateTime } from "luxon";

Odoo typically includes Luxon in its dependencies, but verify this by logging DateTime:

javascriptCopy codeconsole.log(DateTime);

If DateTime is undefined, install Luxon in your development environment:

bashCopy codenpm install luxon

4. Update the patch Function Calls

The patch function attempts to extend the prototypes of dateField and DateTimeField. If either is undefined, it will throw an error.

To prevent this error, add defensive checks before applying patches:

javascriptCopy codeif (dateField) {
    patch(dateField.prototype, {
        setup() {
            this._super?.();
            console.log("setup: Value of this.props.value:", this.props.value);

            this.calendar = useState({
                'hebrew': setCalendar(this.props.value || DateTime.now().toISO(), "hebrew"),
                'islamic': setCalendar(this.props.value || DateTime.now().toISO(), "islamic"),
            });
        },

        onDateTimeChanged(date) {
            this._super?.(date);
            this.calendar.islamic = setCalendar(date, "islamic");
        },

        get formattedValue() {
            return this.isDateTime
                ? setCalendar(this.props.value, "islamic", DateTime.DATETIME_MED)
                : setCalendar(this.props.value, "islamic");
        },
    });
}

if (DateTimeField) {
    patch(DateTimeField.prototype, {
        setup() {
            this._super?.();
            console.log("setup: Value of this.props.value:", this.props.value);

            this.calendar = useState({
                'hebrew': setCalendar(this.props.value || DateTime.now().toISO(), "hebrew"),
                'islamic': setCalendar(this.props.value || DateTime.now().toISO(), "islamic"),
            });
        },

        onDateTimeChanged(date) {
            this._super?.(date);
            this.calendar.islamic = setCalendar(date, "islamic");
        },

        get formattedValue() {
            return setCalendar(this.props.value, "islamic");
        },
    });
}

This ensures the patch is only applied when the target object exists.


5. Debugging Missing Objects

If dateField or DateTimeField is completely missing from Odoo 18, it may have been deprecated or replaced. In this case:

  1. Search the Odoo source code for similar objects.
  2. Update your module to patch the replacement objects or write a custom implementation.

Conclusion

Here’s the key takeaway:

  • Ensure dateField and DateTimeField exist in your version of Odoo.
  • Use defensive programming (e.g., checks for undefined) when applying patches.
  • Verify dependencies like luxon are correctly installed and accessible.

0
الصورة الرمزية
إهمال
هل أعجبك النقاش؟ لا تكن مستمعاً فقط. شاركنا!

أنشئ حساباً اليوم لتستمتع بالخصائص الحصرية، وتفاعل مع مجتمعنا الرائع!

تسجيل
المنشورات ذات الصلة الردود أدوات العرض النشاط
[@$%$AviancaTeResponde$%$@]¿Cómo se llama Avianca en Colombia?
javascript
الصورة الرمزية
0
نوفمبر 25
3
Cannot import @website_sale/js/utils
javascript
الصورة الرمزية
الصورة الرمزية
2
نوفمبر 25
502
How To Hide Action Report By Picking Type Code ?
18.0
الصورة الرمزية
الصورة الرمزية
الصورة الرمزية
3
نوفمبر 25
514
How do I set up budget management / planning تم الحل
18.0
الصورة الرمزية
الصورة الرمزية
2
أغسطس 25
1051
Cómo cerrar una transferencia interna al recibirla desde la vista de código de barras stock.picking
javascript
الصورة الرمزية
0
يوليو 25
1107
المجتمع
  • دروس
  • التوثيق
  • المنتدى
مصدر مفتوح
  • تحميل
  • جيت هاب "Github"
  • المشغل الآلي رنبوت
  • الترجمات
خدماتنا
  • استضافة أودو إس إتش
  • الدعم
  • الترقية
  • التطويرات المخصصة
  • التعليم
  • اعثر على محاسب
  • اعثر على شريك
  • كنْ شريكاً
معلومات عنا
  • شركتنا
  • أصول العلامة التجارية
  • اتصلْ بنا
  • الوظائف
  • فعاليات
  • بودكاست
  • مدونة
  • عملاء
  • قانوني • الخصوصية
  • الحماية
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

أودو هو عبارة عن مجموعة من تطبيقات الأعمال مفتوحة المصدر التي تغطي جميع احتياجات شركتك، مثل: إدارة علاقات العملاء والتجارة الإلكترونية والمحاسبة والمخزون ونقاط البيع وإدارة المشاريع وما إلى ذلك.

ما يجعل من أودو مميزاً هو هدفه بأن يكون سهل الاستخدام للغاية ومتكاملاً تمامًا في الوقت ذاته.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now