Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Priemyselné odvetvia
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Reštaurácia
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Reality
    • Real Estate Agency
    • Architecture Firm
    • Konštrukcia
    • Estate Managament
    • Gardening
    • Property Owner Association
    Poradenstvo
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Jedlo
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Iní
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

Widget creation error in odoo 11

Odoberať

Get notified when there's activity on this post

This question has been flagged
javascriptxmlwidgetjsodoo11
1 Odpoveď
6228 Zobrazenia
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
Zrušiť
Avatar
Ivan Porras Lopez
Best Answer

Hi Anand, do you found some solution?

0
Avatar
Zrušiť
Enjoying the discussion? Don't just read, join in!

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

Registrácia
Related Posts Replies Zobrazenia Aktivita
Odoo 11: How to define a Form View Custom Widget in odoo 11 Solved
form widget js odoo11
Avatar
Avatar
2
máj 20
21093
Displaying Latitude and Longitude using js, in odoo 11 form.
xml js python3 odoo11
Avatar
Avatar
Avatar
2
sep 18
8155
Odoo9c: Creating widget not recognize (can't be used by widget="char2")
xml widget js odoo9
Avatar
0
okt 16
4122
Javascript Widget: appendTo not working Solved
javascript views xml widget owl
Avatar
Avatar
1
máj 23
3053
JavaScript, "External ID not found in the system: web.assets_backend" Solved
javascript xml js backend external_id
Avatar
Avatar
Avatar
2
dec 22
6811
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة 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 je sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

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