one2many_list context not passed to orm

Bug #661249 reported by Ferdinand
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Fix Released
Wishlist
Unassigned

Bug Description

tried to define

<field
            attrs="{ 'readonly':'0', 'readonly': [('state','!=','in_production')]} "
            colspan="4"
            name="move_created_ids"
            nolabel="1"
            widget="one2many_list"
            editable="bottom"
 context="{'form_view_ref':'chricar_stock_weighing.chricar_weighing_form_view','tree_view_ref':'chricar_stock_weighing.chricar_weighing_tree_view'}"
              />

looking into ./osv/orm.py
def fields_view_get(self, cr, user, view_id=None, view_type='form', context=None, toolbar=False):
...
        result = {'type': view_type, 'model': self._name}

        ok = True
        model = True
        sql_res = False
        while ok:
            view_ref = context.get(view_type + '_view_ref', False)
            # FIXME view_ref always False
            print >> sys.stderr , 'view_ref ',view_type, view_ref
            if view_ref:
                if '.' in view_ref:
                    module, view_ref = view_ref.split('.', 1)
                    cr.execute("SELECT res_id FROM ir_model_data WHERE model='ir.ui.view' AND module=%s AND name=%s", (module, view_ref))
                    view_ref_res = cr.fetchone()
                    if view_ref_res:
                        view_id = view_ref_res[0]

it seems that context.get(view_type + '_view_ref', False) never returns the values passed from xml o2m widget context
I get in the log
view_ref form False
view_ref tree False

my be I missunderstood the example in
./addons/sale/sale_view.xml:
 <field colspan="4" name="invoice_ids" nolabel="1" context="{'form_view_ref':'account.invoice_form'}"/>

Revision history for this message
Ferdinand (office-chricar) wrote :

i know - the string editable="bottom" shouldn't be in the o2m definition

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

This feature has been introduced in 6.0, so you can try with the latest trunk if you need it.
For stable releases we don't introduce new features, so this cannot be considered for v5.
Thanks!

Changed in openobject-server:
importance: Undecided → Wishlist
milestone: none → 6.0
status: New → Fix Released
summary: - [V5] one2many_list context not passed to orm
+ one2many_list context not passed to orm
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.