Related action missing current record context

Bug #407786 reported by Ferdinand
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KDE OpenObject Client
Fix Released
Undecided
Unassigned

Bug Description

Related actions (links) do not pass the current record fields values as context for the domain calculation.

-----

koo r908

modified stock_move
        'partner_id': fields.related('address_id', 'partner_id', type="many2one", relation="res.partner", string="Partner",store=True),

works with gtk

            <act_window domain="[('product_id','=', product_id),
                                 ('partner_id', '=', partner_id),
                                 ('state' , '!=' ,'cancel' ),
                                 ('picking_id.type','=', type )]"
            id="act_partner_stock_moves_detail"
            name="Move Details"
            res_model="stock.move"
            src_model="chricar.stock.product.partner"
            view_mode="tree,form"
            view_type="form"/>

kdesvn@cc-gf2:/hd/sdb1/daten/downloads/bzr/kde/openobject-client-kde> koo.py

Traceback (most recent call last):
  File "/usr/lib64/python2.6/site-packages/Koo/Screen/Screen.py", line 216, in triggerAction
    action.execute( id, ids )
  File "/usr/lib64/python2.6/site-packages/Koo/Screen/Action.py", line 72, in execute
    self.executeRelate( currentId )
  File "/usr/lib64/python2.6/site-packages/Koo/Screen/Action.py", line 82, in executeRelate
    Api.instance.executeAction(self._data, {'id': currentId})
  File "./koo.py", line 164, in executeAction
    Koo.Actions.executeAction( action, data, context )
  File "/usr/lib64/python2.6/site-packages/Koo/Actions/Actions.py", line 160, in executeAction
    domain = Rpc.session.evaluateExpression(action['domain'], a)
  File "/usr/lib64/python2.6/site-packages/Koo/Rpc/Rpc.py", line 526, in evaluateExpression
    return eval(expression, context)
  File "<string>", line 1, in <module>
NameError: name 'product_id' is not defined

do not understand - product_id is a normal m2o field ins stock_move

the source is a view.

Revision history for this message
Albert Cervera i Areny - http://www.NaN-tic.com (albert-nan) wrote :

Can you retry this, please? Does it work now? Can you show the view definition?

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

pls see/install the 2 modules (as zip)
view id creates unique ids for views
the error occurs
Partner -> Browse Stock Move out -> Browse Details
thank you

Revision history for this message
Albert Cervera i Areny - http://www.NaN-tic.com (albert-nan) wrote :

Sorry, those modules do not install corretly in my machine:

res = self._obj.execute(query, params)
ProgrammingError: column "move_value" does not exist
LINE 10: sum(move_value) as move_value,

Changed in openobject-client-kde:
status: New → Incomplete
Revision history for this message
Borja López Soilán (NeoPolus) (borjals) wrote :

I also run into this problem, but found it's cause & solution :)

I was trying to use a 'link' between two openobjects (developed by us) using something like this:

        <act_window id="action_something_to_something_link"
                name="Something"
                src_model="some.model"
                res_model="other.model"
                domain="[('partner_id','=',partner_id)]"/>

This link does work on GTK and Web clients without problem. But on Koo it does print this stack trace:

------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/Koo/Screen/Screen.py", line 250, in triggerAction
    action.execute( id, ids )
  File "/usr/local/lib/python2.6/dist-packages/Koo/Screen/Action.py", line 72, in execute
    self.executeRelate( currentId )
  File "/usr/local/lib/python2.6/dist-packages/Koo/Screen/Action.py", line 85, in executeRelate
    Api.instance.executeAction(self._data, {'id': currentId }, ctx)
  File "./Koo/koo.py", line 143, in executeAction
    Koo.Actions.executeAction( action, data, context )
  File "/usr/local/lib/python2.6/dist-packages/Koo/Actions/Actions.py", line 171, in executeAction
    domain = Rpc.session.evaluateExpression(action['domain'], a)
  File "/usr/local/lib/python2.6/dist-packages/Koo/Rpc/Rpc.py", line 503, in evaluateExpression
    return eval(expression, context)
  File "<string>", line 1, in <module>
NameError: name 'partner_id' is not defined
------------

On GTK and Web clients, the current record field values are available in the context used to parse the link (act_window) domain, so we can use domains like "[('partner_id','=',partner_id)]"; but on Koo this context isn't passed, so the domain evaluation fails!

I'm including a patch that solves this (it just adds the current record values to the context of the domain expression evaluation).

summary: - error related fields in action
+ Related action missing current record context
description: updated
Revision history for this message
Borja López Soilán (NeoPolus) (borjals) wrote :
Revision history for this message
Albert Cervera i Areny - http://www.NaN-tic.com (albert-nan) wrote :

Fixed in r1350. Thanks for reporting and investigating.

Changed in openobject-client-kde:
status: Incomplete → Fix Released
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.