1

I am trying to render a component in a button click. I created a template and a component. But I don't know how to link the button action and the component.

Here is the code:

*component.js

  /** @odoo-module **/

  const { Component } = owl;
  const { useSubEnv, useState } = owl.hooks;

  class BasketVerificationComponent extends Component{

  }

  BasketVerificationComponent.template = 'mobile_basket_verification.basket_verification'; 

template.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <templates id="template" xml:space="preserve">
        <div t-name="mobile_basket_verification.BasketVerificationComponent" class="o_content o_barcode_client_action" owl="1">
          <div class="o_barcode_header">
            <nav class="navbar-nav mr-auto">
                <span>Am here</span>  
                <span class="o_title navbar-text text-white" t-esc="env.model.name"/>
            </nav>
          </div>
        </div>
      </templates>

Buttonaction.js

      odoo.define('mobile_basket_verification.basket_menu', function (require) {
      "use strict";

      const MainMenu = require('stock_barcode.MainMenu').MainMenu;

      MainMenu.include({
          events: Object.assign({}, MainMenu.prototype.events, {

              'click .basket_verification_line': function () {
                this.do_action('mobile_basket_verification.BasketVerificationComponent');
              },
              
          }),
      });
      });
KbiR
  • 4,047
  • 6
  • 37
  • 103

0 Answers0