← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 661249] Re: [V5] one2many_list context not passed to orm

 

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

** Changed in: openobject-server
       Status: New => Fix Released

** Changed in: openobject-server
    Milestone: None => 6.0

** Summary changed:

- [V5] one2many_list context not passed to orm
+ one2many_list context not passed to orm

-- 
one2many_list context not passed to orm
https://bugs.launchpad.net/bugs/661249
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.

Status in OpenObject Server: Fix Released

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'}"/>





References