Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
1717 Widoki

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"/>









Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
sty 25
697
1
mar 25
652
2
sie 22
7164
8
cze 20
20810
1
kwi 20
53