I tried using context.get but it didn't work.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- إدارة علاقات العملاء
- e-Commerce
- المحاسبة
- المخزون
- PoS
- Project
- MRP
لقد تم الإبلاغ عن هذا السؤال
Option 1: Define two graph views with different fields
Create two graph views (with priority) and load one based on context:
<record id="view_graph_with_field" model="ir.ui.view">
<field name="name">model.graph.with_field</field>
<field name="model">your.model</field>
<field name="priority">20</field>
<field name="arch" type="xml">
<graph string="Report">
<field name="date" type="row"/>
<field name="amount" type="measure"/>
<field name="some_field" type="measure"/>
</graph>
</field>
</record>
<record id="view_graph_without_field" model="ir.ui.view">
<field name="name">model.graph.no_field</field>
<field name="model">your.model</field>
<field name="priority">10</field>
<field name="arch" type="xml">
<graph string="Report">
<field name="date" type="row"/>
<field name="amount" type="measure"/>
</graph>
</field>
</record>
Option 2: Use groups attribute
If visibility should depend on user group, this works:
<field name="some_field" groups="base.group_user" />
Thanks for your advice. Please let me know about the issue why get.context() is not working in graph.
<record id="stock_quant_graph_view_inherit" model="ir.ui.view">
<field name="name">stock.quant.graph.inherit</field>
<field name="model">stock.quant</field>
<field name="inherit_id" ref="stock.stock_quant_view_graph"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='location_id']" position="after">
<field name="product_id" invisible="context.get('loai') != 'Soi'" />
<field name="thanh_phan" />
<field name="chi_so_soi" />
<field name="loai_soi" />
<field name="mau" />
</xpath>
</field>
</record>
context.get() no active in graph. but i use it in view search or view list,form then it works.
هل أعجبك النقاش؟ لا تكن مستمعاً فقط. شاركنا!
أنشئ حساباً اليوم لتستمتع بالخصائص الحصرية، وتفاعل مع مجتمعنا الرائع!
تسجيلالمنشورات ذات الصلة | الردود | أدوات العرض | النشاط | |
---|---|---|---|---|
|
1
يونيو 25
|
847 | ||
|
1
يونيو 25
|
1668 | ||
|
2
مايو 24
|
1400 | ||
|
0
يوليو 21
|
1844 | ||
|
1
مايو 20
|
7715 |