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

Client Action using Owl Component - how do I get the control panel to show?

Abonare

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

Această întrebare a fost marcată
owlv14
9824 Vizualizări
Imagine profil
kevin lall

Hi there, I am currently using Odoo 14 to try out the Owl framework, I am able to get my component to work via the client action with the ComponentWrapper.

my question is how do I get the control panel to show (breadcrumbs, search view)

I spend a few days trying to figure this out, I went over example code in Odoo I am pretty much stuck


here is my code 


odoo.define("todo", function (require) {

  "use strict";


  const AbstractAction = require("web.AbstractAction");

  const {

    ComponentWrapper,

    WidgetAdapterMixin,

  } = require("web.OwlCompatibility");

  const core = require("web.core");


  const { Component, tags } = owl;

  const { useRef, useState } = owl.hooks;


  class Task extends Component {

    toggleTask() {

      this.trigger("toggle-task", { id: this.props.task.id }); 

    }


    deleteTask() {

      this.trigger("delete-task", { id: this.props.task.id });

    }

  }

  Task.template = tags.xml`

  <div class="task" t-att-class="props.task.isCompleted ? 'done' : ''">

    <input type="checkbox" t-att-checked="props.task.isCompleted" t-on-click="toggleTask"/>

    <span><t t-esc="props.task.title"/></span>

    <span class="delete" t-on-click="deleteTask">🗑</span>

  </div>

  `;

  Task.props = ["task"];


  class Todo extends Component {

    constructor() {


      super(...arguments);

    }


    tasks = useState([]);

    inputRef = useRef("add-input");


    mounted() {

      this.inputRef.el.focus();

    }


    async willStart() {

      const fields = ["id", "name", "completed"];

      const tasks = await this.env.services.rpc({

        model: "todo",

        method: "search_read",

        kwargs: {

          fields,

        },

      });

      tasks.map((task) =>

        this.tasks.push({

          id: task.id,

          title: task.name,

          isCompleted: task.completed,

        })

      );

    }


    async addTask(ev) {

      // 13 is keycode for ENTER

      if (ev.keyCode === 13) {

        const title = ev.target.value.trim();

        ev.target.value = "";

        if (title) {

          const newTask = await this.env.services.rpc({

            model: "todo",

            method: "create",

            args: [

              {

                name: title,

                completed: false,

              },

            ],

          });

          this.tasks.push({

            id: newTask,

            title: title,

            isCompleted: false,

          });

        }

      }

    }


    async toggleTask(ev) {

      const task = this.tasks.find((t) => t.id === ev.detail.id);

      task.isCompleted = !task.isCompleted;

      await this.env.services.rpc({

        model: "todo",

        method: "write",

        args: [

          [task.id],

          {

            completed: task.isCompleted,

          },

        ],

      });

    }


    async deleteTask(ev) {

      const index = this.tasks.findIndex((t) => t.id === ev.detail.id);

      this.tasks.splice(index, 1);

      await this.env.services.rpc({

        model: "todo",

        method: "unlink",

        args: [[ev.detail.id]],

      });

    }

  }


  Todo.components = { Task };


  Todo.template = tags.xml`

    <div>

      <div class="o_form_view">

        <div class="o_form_sheet_bg">

          <div class="o_form_sheet">

            <div class="todo-app">

              <input placeholder="Enter a new task" t-on-keyup="addTask" t-ref="add-input"/>

              <div class="task-list" t-on-toggle-task="toggleTask" t-on-delete-task="deleteTask">

                <t t-foreach="tasks" t-as="task" t-key="task.id">

                  <Task task="task"/>

                </t>

              </div>

            </div>

          </div>

        </div>

      </div>

    </div>

  `;


  const ClientAction = AbstractAction.extend(WidgetAdapterMixin, {

    start() {

      const component = new ComponentWrapper(this, Todo);

      return component.mount(this.el.querySelector(".o_content"));

    },

  });


  core.action_registry.add("todo_client_action", ClientAction);

  return ClientAction;

});


I am calling the action from a button 

def open_client_action(self):
print('open action called')
return {
'res_model': 'todo',
'type': 'ir.actions.client',
'tag': 'todo_client_action',
}




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
How can i extend constructor of a class in odoo14?
javascript owl v14
Imagine profil
0
oct. 22
571
Inherit OWL JS
js owl v14
Imagine profil
Imagine profil
1
aug. 21
5297
How to define a qweb template in owl (Odoo14)
qweb template view owl v14
Imagine profil
0
mai 21
4840
How to replace JS class in Odoo 14?
JS owl v14
Imagine profil
0
dec. 20
4601
Odoo14 alternative for Automated Translations through Gengo API module
v14
Imagine profil
Imagine profil
Imagine profil
Imagine profil
3
sept. 25
3546
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