Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Aplikacije
    Finance
    • Knjigovodstvo
    • Obračun
    • Stroški
    • Spreadsheet (BI)
    • Dokumenti
    • Podpisovanje
    Prodaja
    • CRM
    • Prodaja
    • POS Shop
    • POS Restaurant
    • Naročnine
    • Najem
    Spletne strani
    • Website Builder
    • Spletna trgovina
    • Blog
    • Forum
    • Pogovor v živo
    • eUčenje
    Dobavna veriga
    • Zaloga
    • Proizvodnja
    • PLM
    • Nabava
    • Vzdrževanje
    • Kakovost
    Kadri
    • Kadri
    • Kadrovanje
    • Odsotnost
    • Ocenjevanja
    • Priporočila
    • Vozni park
    Marketing
    • Družbeno Trženje
    • Email Marketing
    • SMS Marketing
    • Dogodki
    • Avtomatizacija trženja
    • Ankete
    Storitve
    • Projekt
    • Časovnice
    • Storitve na terenu
    • Služba za pomoč
    • Načrtovanje
    • Termini
    Produktivnost
    • Razprave
    • Odobritve
    • IoT
    • Voip
    • Znanje
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industrije
    Trgovina na drobno
    • Book Store
    • Trgovina z oblačili
    • Trgovina s pohištvom
    • Grocery Store
    • Trgovina s strojno opremo računalnikov
    • Trgovina z igračami
    Food & Hospitality
    • Bar and Pub
    • Restavracija
    • Hitra hrana
    • Guest House
    • Beverage Distributor
    • Hotel
    Nepremičnine
    • Real Estate Agency
    • Arhitekturno podjetje
    • Gradbeništvo
    • Estate Management
    • Vrtnarjenje
    • Združenje lastnikov nepremičnin
    Svetovanje
    • Računovodsko podjetje
    • Odoo Partner
    • Marketinška agencija
    • Law firm
    • Pridobivanje talentov
    • Audit & Certification
    Proizvodnja
    • Tekstil
    • Metal
    • Pohištvo
    • Hrana
    • Brewery
    • Poslovna darila
    Health & Fitness
    • Športni klub
    • Trgovina z očali
    • Fitnes center
    • Wellness Practitioners
    • Lekarna
    • Frizerski salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Sistemi sončne energije
    • Izdelovalec čevljev
    • Čistilne storitve
    • HVAC Services
    Ostali
    • Neprofitna organizacija
    • Agencija za okolje
    • Najem oglasnih panojev
    • Fotografija
    • Najem koles
    • Prodajalec programske opreme
    Browse all Industries
  • Skupnost
    Learn
    • Tutorials
    • Dokumentacija
    • Certifikati
    • Šolanje
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Prenesi
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Dogodki
    • Prevodi
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Sklici kupca
    • Podpora
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Določanje cen
  • Pomoč

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

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

Widget creation error in odoo 11

Naroči se

Get notified when there's activity on this post

This question has been flagged
javascriptxmlwidgetjsodoo11
1 Odgovori
6155 Prikazi
Avatar
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
Avatar
Opusti
Avatar
Ivan Porras Lopez
Best Answer

Hi Anand, do you found some solution?

0
Avatar
Opusti
Enjoying the discussion? Don't just read, join in!

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

Prijavi
Related Posts Odgovori Prikazi Aktivnost
Odoo 11: How to define a Form View Custom Widget in odoo 11 Solved
form widget js odoo11
Avatar
Avatar
2
maj 20
21015
Displaying Latitude and Longitude using js, in odoo 11 form.
xml js python3 odoo11
Avatar
Avatar
Avatar
2
sep. 18
8025
Odoo9c: Creating widget not recognize (can't be used by widget="char2")
xml widget js odoo9
Avatar
0
okt. 16
4033
Javascript Widget: appendTo not working Solved
javascript views xml widget owl
Avatar
Avatar
1
maj 23
2981
JavaScript, "External ID not found in the system: web.assets_backend" Solved
javascript xml js backend external_id
Avatar
Avatar
Avatar
2
dec. 22
6618
Community
  • Tutorials
  • Dokumentacija
  • Forum
Open Source
  • Prenesi
  • Github
  • Runbot
  • Prevodi
Services
  • Odoo.sh Hosting
  • Podpora
  • Nadgradnja
  • Custom Developments
  • Izobraževanje
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Sredstva blagovne znamke
  • Kontakt
  • Zaposlitve
  • Dogodki
  • Podcast
  • Blog
  • Stranke
  • Pravno • Zasebnost
  • Varnost
الْعَرَبيّة 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 is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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