Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
1708 Weergaven

Like i want to show a single summary on all form view do not want to add multiple of time but i cant use t-call because it does not work in odoo form:

xml version="1.0" encoding="UTF-8"?>
id="template" xml:space="preserve">

t-name="EcSummaryBoardCustom">
class="p-3">

Hello World





id="ec_medical_first_consultation_form_view" model="ir.ui.view">
name="name">ec.first.consultation.form
name="model">ec.first.consultation
name="arch" type="xml">
string="First Consultation">
t-call="EcSummaryBoardCustom"/>









Avatar
Annuleer
Beste antwoord

Hi,

You can try the following

js>>

import { registry } from '@web/core/registry';

import { formView } from '@web/views/form/form_view';

import { FormController } from '@web/views/form/form_controller';


export class FormClassController extends FormController {

    setup() {

        super.setup();

        console.log(this,'FormClassController',this.template)

        owl.onMounted(() => {

            let textField = this.__owl__.bdom.el.querySelector('.text-field')

            textField.innerHTML = 'Hello World';

        })

    }

}

registry.category('views').add('form_class', {

    ...formView,

    Controller: FormClassController,

});


xml>>

<field name="model">project.task.details</field>

        <field name="arch" type="xml">

            <form js_class="form_class">

                <div class="text-field"/>

    </div>

    </form>

    </field>


 Js_class allows you to access the backend view and customize it according to your needs. Now every time you create a form view just add the js_class of 'form_class' and add a div of class 'text-field' or you can find an alternative way to show your view using the `js_class`

Hope it helps

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
0
jan. 25
692
1
mrt. 25
652
2
aug. 22
7161
8
jun. 20
20802
1
apr. 20
53