Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
2252 มุมมอง

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









อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ม.ค. 25
1159
1
มี.ค. 25
652
Favorite filter Odoo 10 แก้ไขแล้ว
2
ส.ค. 22
7558
[Odoo 8]How to use ref on domain xml แก้ไขแล้ว
8
มิ.ย. 20
21380
1
เม.ย. 20
53