I need to get view type in Odoo 8. Whether it is form view or not. If it is form view, then i need to do some function. How to get view type in Odoo 8
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
Hi Priya,
Try something like example for stock form view, self.pool.get('ir.model.data').get_object_reference(cr, uid, 'stock', 'view_stock_return_picking_form')
"get_object_reference() returns (model, res_id) corresponding to a given module and xml_id (cached) or raise ValueError if not found"
HI Priya,
I think you have to overwrite the fields_view_get function
Here I given example:
Try this below code its may helps to you.
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): res = super(class_name, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu) if view_type == 'form': doc = etree.XML(res['arch']) for node in doc.xpath("//field[@name='user_id']"): node.set('readonly', "1") setup_modifiers(node, res['fields']['user_id']) res['arch'] = etree.tostring(doc) return res
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
0
thg 10 22
|
796 | ||
|
3
thg 8 24
|
5435 | ||
|
0
thg 5 24
|
1234 | ||
|
2
thg 4 24
|
1329 | ||
|
0
thg 1 24
|
816 |
view_obj = self.env['ir.ui.view'].search([('name','=','your_view_name')])
if view_obj.type == 'form':
#do this
else:
#do this