How to Dynamically Change the Name of the Field on Tree View

Asked by Prolete Atienza

Hi iam handling ERP for a month now, I have created a custom module from from a SQLView using CREATE OR REPLACE VIEW in init of the module.

I am calling this tree view in a wizard which works fine, but i want to know.

- How can I dynamically change the field name string (column header) base on the parameter of my wizard.

its been days now looking for this on please help

Question information

Language:
English Edit question
Status:
Solved
For:
Odoo Server (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Solved by:
Quentin THEURET @Amaris
Solved:
Last query:
Last reply:
Revision history for this message
Best Quentin THEURET @Amaris (qtheuret) said :
#1

Le 03/02/2012 05:30, Prolete Atienza a écrit :
> New question #186683 on OpenERP Server:
> https://answers.launchpad.net/openobject-server/+question/186683
>
> Hi iam handling ERP for a month now, I have created a custom module from from a SQLView using CREATE OR REPLACE VIEW in init of the module.
>
> I am calling this tree view in a wizard which works fine, but i want to know.
>
> - How can I dynamically change the field name string (column header) base on the parameter of my wizard.
>
> its been days now looking for this on please help
>
Hi,

What do you understand by parameter of the wizard ?

A possible solution, add parameters in the context dictionnary and get
them in the fields_view_get method of your wizard.

Regards

--
Quentin THEURET

Revision history for this message
Prolete Atienza (nickaceph) said :
#2

yes thank for the reply Quentin,

solved this, what i want to do is the following

1. create a menu that will open a wizard, this form have fields
-- fields, date, accounttype, etc
2. from this wizard form when ok is click I will call a custom tree view
-- by getting the view

result = mod_obj._get_id(cr, uid, 'module_name', 'tree_action_to_open_the_view')
id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
result = act_obj.read(cr, uid, [id], context=context)[0]

3. I add my param on context depending on the formfield (evaluated in the wizard form)

4. in my tree object I add use ff where I composed my new arch.

def fields_view_get(self, cr, uid, view_id=None, view_type='tree', context=None, toolbar=False ):

it works

Thanks Again

Revision history for this message
Prolete Atienza (nickaceph) said :
#3

Thanks Quentin THEURET, that solved my question.