v6 rc1 context not evaled on new button on editable tree

Bug #661509 reported by Diego Abad
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo GTK Client (MOVED TO GITHUB)
Invalid
Low
OpenERP sa GTK client R&D

Bug Description

When I use a new button on a editable tree, context is not evaluated.
To fix this I change model_new on class ModelRecordGroup on bin/widget/model/group.py
 whit this code:

    def model_new(self, default=True, domain=[], context={}):
        ctx2 = self.context.copy()
        ctx2.update(context)
        self.context = ctx2
        ....
        ....

Revision history for this message
Diego Abad (dabada83) wrote :
Diego Abad (dabada83)
description: updated
Diego Abad (dabada83)
summary: - V6 client trunk, context on editable tree
+ v6 rc1 context not evaled on new button on editable tree
Revision history for this message
Ravi Gadhia (OpenERP) (rga-openerp) wrote :

Hello Diego,
             We are not able to reproduce this bug on V6 RC1 and also on latest trunk.
             Would you please provide step to reproduce this bug.

Thanks

Revision history for this message
Diego Abad (dabada83) wrote :

This bug occurs when I need to send something via context, for example if I use this code on my view:

<field name="line_product_ids" required="1 colspan="4" nolabel="1" on_change="on_change_lines(parent.raw_material_long, line_product_ids)" context="{'relations': context.get('relations')}"/>

line_product_ids is a one2many field on my form, whit this view on a editable tree, context is not evaled
when I pressed new button of one2many widget, instead context is evaled only when I press down key,
because my editable tree use editable="bottom".

I debugged the client and saw that the way to add the new line on one2many widget is different when I
press the button new, and when I press the down key.

On bin/widget/view/tree_gtk/editabletree.py the method on_create_line eval the context on, but this method
is called only from key_down or key_up. Instead when I press the new button the way to create the new
line on one2many widget is different, and the context for some reason is not send to my class, I when I want
to redefine the search method and want to read my var, context is empty.

Changed in openobject-client:
assignee: nobody → OpenERP sa GTK client R&D (openerp-dev-gtk)
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :

hello Diego,

I tested with the environment you set up in the current trunk code. and gtk client sends the context set on the field in xml to the server. here is what I tested.

set account.invoice.line list view to editable="bottom" and set context in the field ''invoice_line" of account.invoice.form view as context="{'test_my_context':'yes'}" and also wrote an on_change call , the xml code looks like this:

<field colspan="4" name="invoice_line" nolabel="1" widget="one2many_list" on_change="onchange_test_ctx()" context="{'test_my_context':'yes'}"/>

Here what I receive as rpc_call to server when I click new:

DEBUG_RPC:rpc.request:('execute', 'trunk', 1, '*', ('account.invoice.line', 'default_get', ['uos_id', 'account_id', 'price_unit', 'price_subtotal', 'discount', 'quantity', 'name'], {'lang': 'en_US', 'tz': False, 'section_id': False, 'test_my_context': 'yes', 'project_id': False}))
DEBUG_RPC:rpc.request:('execute', 'trunk', 1, '*', ('account.invoice', 'onchange_test_ctx', [42]))

Here what I receive as rpc_call to server when I press bottom arrow:

DEBUG_RPC:rpc.request:('execute', 'trunk', 1, '*', ('account.invoice.line', 'default_get', ['uos_id', 'account_id', 'price_unit', 'price_subtotal', 'discount', 'quantity', 'name'], {'lang': 'en_US', 'tz': False, 'section_id': False, 'test_my_context': 'yes', 'project_id': False}))
DEBUG_RPC:rpc.request:('execute', 'trunk', 1, '*', ('account.invoice', 'onchange_test_ctx', [42]))

Here as you can see from the rpc call the context is passed to the server.

Please correct me If I am missing something. I would like to close this bug. please reopen if you find a valid reason.

Thanks,

Changed in openobject-client:
status: Confirmed → Invalid
milestone: none → 6.0-rc2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

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