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

Odoo9c: Creating widget not recognize (can't be used by widget="char2")

Odoberať

Get notified when there's activity on this post

This question has been flagged
xmlwidgetjsodoo9
4007 Zobrazenia
Avatar
Prihadi Ramadhany

Hi Community,

I'am creating a widget (using Odoo 9c) which modified from Odoo 9c documentation (section: "Creating a New Type of Field"), and give name 'char2' widget.  I put in use on my form with <field name="...." widget="char2"/> but it not working/no effect.  The field type that I'm gonna use the widget with is Char.

On the form, I went developer mode and manage view, then look at the field properties, I can't find 'char2'  (for that field) on the widget dropdown list.


Is anything I missed here?  Any help will be very appreciated.


Below is the widget's JS

openerp.energy_survey = function(instance, local)
{
var QWeb = instance.web.qweb;

local.FieldChar2 = instance.web.form.AbstractField.extend(
{
init: function()
{
this._super.apply(this, arguments); this.set("value", ""); },
start: function()
 {
this.on("change:effective_readonly", this, function()
{
 this.display_field(); this.render_value(); }); this.display_field(); return this._super(); },
 display_field: function()
{
 var self = this; this.$el.html(QWeb.render("FieldChar2", {widget: this})); if (! this.get("effective_readonly"))
  {
  this.$("input").change(function()
{
 self.internal_set_value(self.$("input").val()); }); }
 },
render_value: function()
{
if (this.get("effective_readonly"))
 {
 this.$el.text(this.get("value")); } else {
 this.$("input").val(this.get("value")); }
 },
  }); instance.web.form.widgets.add('char2', 'instance.energy_survey.FieldChar2'); }

here is __openerp__.py

'data': [	    
'energy_survey_view.xml',
'energy_survey_menu.xml',
],
 'js': [
'static/src/js/energy_survey.js',
 ],
 'demo': [
 ],
 'qweb': [
 'static/src/xml/*.xml',
],
'css': [
 'static/src/css/energy_survey.css',

CSS

@charset "UTF-8";


.oe_field_char2
{
 margin: 5px;
padding: 5px;
border-radius: 3px;
background-color: #F0EEEE;
}

here is the template XML  

<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-name="FieldChar2">
 <div class="oe_field_char2">
 <t t-if="! widget.get('effective_readonly')">
 <input type="file" accept="image/*" capture="camera"></input>
 </t>
 </div>
 </t>
</templates>
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 9] Graph Widget: How to customise the BAR Graph? Solved
widget graph js odoo9
Avatar
Avatar
Avatar
5
mar 17
12505
Extending/Overriding public widgets.
widget js
Avatar
Avatar
1
máj 23
8405
How to create and register a simple custom widget?
widget odoo9
Avatar
0
dec 19
10493
Why do I get "Uncaught ReferenceError: openerp is not defined" error in the theme tutorial in odoo 9? Solved
js odoo9
Avatar
Avatar
2
júl 19
15421
Widget creation error in odoo 11
javascript xml widget js odoo11
Avatar
Avatar
1
jan 19
6140
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