← Back to team overview

openerp-community team mailing list archive

Re: how to access context in my own method/function?

 

The res should also contain a key 'arch', you will need to alter that one.
I recon the easiest way is to "from lxml import etree" and parse the arch
"myarch = etree.fromstring(res['arch'])" so it becomes an xml tree, then
alter it and then "res['arch'] = etree.tostring(myarch)"

2011/12/20 Martin Herweg <m.herweg@xxxxxx>

>
> Thanks for your answer, Niels.
> I now have my own  fields_view_get and it is beeing executed (I see the
> output
> of my print on cosole) and the return-dict "res" looks o.k. but the tree
> view
> did not change.
>
>    def fields_view_get(self, cr, uid, view_id=None, view_type='tree',
> context=None, toolbar=False, submenu=False):
>        res = super(pricelist_screen,self).fields_view_get(cr, uid, view_id,
> view_type, context, toolbar=toolbar, submenu=submenu)
>
>        form = context['form']
>        qty1 = form['qty1']
>        res['fields']['qty1_test']['string']=`qty1`
>        print 'hallo'
>        print res
>        return res
>
>  _columns = {
>      'qty1_test' : fields.function(_calc_price, arg=1 , type = 'float',
> method = True, string = 'placeholder'),
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openerp-community
> Post to     : openerp-community@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openerp-community
> More help   : https://help.launchpad.net/ListHelp
>



-- 
Niels Huylebroeck
Lead Architect   --   Agaplan
Tel. : +32 (0) 93 95 98 90
Web : http://www.agaplan.eu

References