Skip to Content
Menu
This question has been flagged

Dear Friends,

               I would like to change field label(string) while onchange many2one field. I have configured few items in that object. I could not use fields_view_get. While i onchange i am able to update field string but is not reflected in the view.


def onchange_ini_temp_id(self, cr, uid, ids, initiative_category_id, context=None):

val = {}

view_id=None

view_type='form'

toolbar=False

submenu=False

res = super(project_project, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)

fields = res.get('fields', {})

doc = etree.XML(res['arch'])

for node in doc.xpath("//field[@name='release']"):

node.set('invisible', "0")

node.set('string', 'Test Data')

setup_modifiers(node, res['fields']['release'])

res['arch'] = etree.tostring(doc)

self.fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False)

return res


Thank you

Avatar
Discard

Somewhere odoo had limits too. but you can create two view with each unique label and then pass right view on action, but with on_change to fix, forget odoo people support on this. After odoo 7, they left odoo community and users. Now odoo is buggy stable.

Related Posts Replies Views Activity
1
Oct 23
364
2
Oct 23
678
2
Aug 23
1965
4
Aug 23
18249
3
Oct 22
8908