Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

Widget creation error in odoo 11

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
javascriptxmlwidgetjsodoo11
1 Răspunde
6144 Vizualizări
Imagine profil
Anand Mohan

I'm trying to add room reservation summary to the backend of my project, i have the following code working in odoo 10 but getting the error Uncaught TypeError: Widget is not a constructor  in odoo11.i've tried different solutions but haven't resolved my problem .Thanks in advance.

Here is my corresponding js code
odoo.define('hotel_reservation.hotel_room_summary', function (require) {

var core = require('web.core');
var data = require('web.data');
var ActionManager = require('web.ActionManager');
var form_common = require('web.form_common');
var time = require('web.time');
var _t = core._t;
var QWeb = core.qweb;

var RoomSummary = form_common.FormWidget.extend(form_common.ReinitializeWidgetMixin, {
display_name: _t('Form'),
view_type: "form",
init: function() {
this._super.apply(this, arguments);
if(this.field_manager.model == "room.reservation.summary")
{
$(".oe_view_manager_buttons").hide();
$(".oe_view_manager_header").hide();
}
this.set({
date_to: false,
date_from: false,
summary_header: false,
room_summary: false,
});
this.summary_header = [];
this.room_summary = [];
this.field_manager.on("field_changed:date_from", this, function() {
this.set({"date_from": time.str_to_datetime(this.field_manager.get_field_value("date_from"))});
});
this.field_manager.on("field_changed:date_to", this, function() {
this.set({"date_to": time.str_to_datetime(this.field_manager.get_field_value("date_to"))});
});

this.field_manager.on("field_changed:summary_header", this, function() {
this.set({"summary_header": this.field_manager.get_field_value("summary_header")});
});
this.field_manager.on("field_changed:room_summary", this, function() {
this.set({"room_summary":this.field_manager.get_field_value("room_summary")});
});
},

initialize_field: function() {

form_common.ReinitializeWidgetMixin.initialize_field.call(this);
var self = this;
self.on("change:summary_header", self, self.initialize_content);
self.on("change:room_summary", self, self.initialize_content);
},

initialize_content: function() {
var self = this;
if (self.setting)
return;

if (!this.summary_header || !this.room_summary)
return
// don't render anything until we have summary_header and room_summary

this.destroy_content();

if (this.get("summary_header")) {
this.summary_header = py.eval(this.get("summary_header"));
}
if (this.get("room_summary")) {
this.room_summary = py.eval(this.get("room_summary"));
}

this.renderElement();
this.view_loading();
},

view_loading: function(r) {
return this.load_form(r);
},

load_form: function(data) {
self.action_manager = new ActionManager(self);
  },

renderElement: function() {
this.destroy_content();
this.$el.html(QWeb.render("summaryDetails", {widget: this}));
}
});

core.form_custom_registry.add('Room_Reservation', RoomSummary);
});
And the xml is 
<!-- Form view of room reservation summary -->
<record id="room_reservation_summary_form_view" model="ir.ui.view">
<field name="name">room.reservation.summary.form</field>
<field name="model">room.reservation.summary</field>
<field name="arch" type="xml">
<form string="Reservation Summary">
<sheet>
<group colspan="4" col="4">
<div>
<label for="date_from" string="Summary Period" />
<field name="date_from" class="oe_inline" />
to
<field name="date_to" class="oe_inline" />
</div>
</group>
<notebook>
<page string="Room Summary">
<field name="summary_header" colspan="4" invisible="1" />
<field name="room_summary" colspan="4" invisible="1" />
<widget type="Room_Reservation"></widget>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
0
Imagine profil
Abandonează
Imagine profil
Ivan Porras Lopez
Cel mai bun răspuns

Hi Anand, do you found some solution?

0
Imagine profil
Abandonează
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
Odoo 11: How to define a Form View Custom Widget in odoo 11 Rezolvat
form widget js odoo11
Imagine profil
Imagine profil
2
mai 20
21011
Displaying Latitude and Longitude using js, in odoo 11 form.
xml js python3 odoo11
Imagine profil
Imagine profil
Imagine profil
2
sept. 18
7991
Odoo9c: Creating widget not recognize (can't be used by widget="char2")
xml widget js odoo9
Imagine profil
0
oct. 16
4013
Javascript Widget: appendTo not working Rezolvat
javascript views xml widget owl
Imagine profil
Imagine profil
1
mai 23
2976
JavaScript, "External ID not found in the system: web.assets_backend" Rezolvat
javascript xml js backend external_id
Imagine profil
Imagine profil
Imagine profil
2
dec. 22
6607
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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

Odoo este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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