تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
1078 أدوات العرض

I make 3 form view that using the same model. Some of the element is different but most of them is using the same element. In this case, I think inherit is not the solution for this problem. Since inherit only modify one view

My goal is to put the same element and put it in different view xml (This is still with the same model). So when I want to use that element so many times, I just need to call the id. 


Can odoo do this?

الصورة الرمزية
إهمال
أفضل إجابة

Yes, Odoo allows you to reuse elements across different views using the concept of XPATH. You can define a common element in one XML file and then use XPATH expressions in other XML files to reference that element. Here’s a basic example:

https://pastebin.com/vaYJGJHj

In this example, your.model is the name of your model, your_field is the name of the common field, and module_name is the name of your module. You can replace these with your actual values.


الصورة الرمزية
إهمال
الكاتب

but isn't inherit only modify one form view? How can I use view1 in common_template 2 and common_template3

المنشورات ذات الصلة الردود أدوات العرض النشاط
1
أبريل 24
1271
2
أبريل 24
3798
0
أبريل 24
1810
0
ديسمبر 23
1734
0
نوفمبر 23
1389