It is currently Sat Feb 11, 2012 8:54 pm

All times are UTC + 2 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: [SOLVED]How to get current sales order line id in wizard
PostPosted: Mon Sep 22, 2008 7:56 am 
Offline

Joined: Fri May 23, 2008 1:53 am
Posts: 121
Hi,

I have A custom wizard in Sales order
Code:
import wizard
import netsvc
import pooler
import os

customapp_form = """<?xml version="1.0"?>
<form string="Sales Order CustomApp">
   <separator colspan="4" string="Do you really want to Run the Application ?" />
</form>
"""

customapp_fields = {}

def _runCustomApp(self, cr, uid, data, context):
        solines_obj = pooler.get_pool(cr.dbname)
        res = False
        for so_line in solines_obj.get('sale.order.line').browse(cr,uid,data['ids']):
                os.system("notepad.exe "+str(data['ids'])+"-"+str(so_line.name))
       
        return {}

class run_customapp(wizard.interface):
   states = {
      'init' : {
         'actions' : [],
         'result' : {'type' : 'form',
                'arch' : customapp_form,
                'fields' : customapp_fields,
                'state' : [('end', 'Cancel'),('run_app', 'CustomApp') ]}
      },
      'run_app' : {
         'actions' : [],
         'result' : {'type' : 'action',
                'action' : _runCustomApp,
                'state' : 'end'}
      },
   }
run_customapp("sale.order.customapp")


How can I get the "CURRENT" Sales order LINE id for my current sale order ? At the moment I do not get the record I want.
Appreciate any help. Thanks.


Last edited by kalmenchia on Sat Dec 13, 2008 6:45 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 22, 2008 12:41 pm 
Offline

Joined: Fri May 23, 2008 1:53 am
Posts: 121
Hi ,

I continue testing . However at this moment , I think
it is not possible to get the current selected sale order line
details , when we call the wizard , it is in the Sale order
object , we can define another sale order lines object
in the wizard but I do not think we can get the CURRENT SELECTED
SALE ORDER LINE on the grid of the Sale order form.

The best that I can get is to get the sale order object information,
is that correct ?

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 23, 2008 3:48 pm 
Offline

Joined: Fri Apr 21, 2006 7:28 pm
Posts: 1332
Location: Cambridge, UK
kalmenchia wrote:
... I do not think we can get the CURRENT SELECTED
SALE ORDER LINE on the grid of the Sale order form. [...] The best that I can get is to get the sale order object information,
is that correct ? ...

I think you're right that you can get the selected Order Line if your wizard is on the Sales Order Lines, but not on the Sales Order.

I'm not sure how you can detect which Order Line is selected when you're in the Order, partly because I don't really know what would be 'selected' in this context.

_________________
Regards, Geoff

Seath Solutions Ltd, Cambridge, UK


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 24, 2008 1:06 pm 
Offline

Joined: Fri May 23, 2008 1:53 am
Posts: 121
Hi ,

selected in my context is when user scroll the line items
let say the sale order lines and when I have 2 lines where
my current record/cursor is on the second line , then the
second sale order line is my selected item.
Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 11, 2008 1:17 pm 
Offline

Joined: Fri May 23, 2008 1:53 am
Posts: 121
Hi ,


I have tested to modify the gtkclient's code and able to use the field widget to call LOCAL custom application , but how can I do this using the Wizard ,

i.e. How to by Clicking the Wizard button , it send a signal back to pyGtk Client and allow the pyGTK client to capture the signal and run the custom application ?

Any help or idea is much appreciated , thanks.

Regards,
kalmen


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 13, 2008 6:44 am 
Offline

Joined: Fri May 23, 2008 1:53 am
Posts: 121
Hi,

I solved it my way ... is not the best solutions but at this moment with limited python knowledge , this is the way I have done it ...
1. change the wizard.py of the gtkclient , in the def init and def execute , add code to detect the data send back from server and
import subprocess and use subprocess function.

2. change the module's wizard action code at the module.

This should do the trick. HTH

However I must say , python is a great langauge and OpenERP is a very
good piece of work. Stable and flexible.

_________________
Kalmen,

http://www.instant-erp.com/
E-global scm solutions sdn bhd


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 19, 2009 5:50 pm 
Offline

Joined: Thu Feb 19, 2009 3:42 pm
Posts: 57
Location: Bordeaux France
Hi,

It's late but it seems I have the same situation as in this post (getting ids of selected lines in a tree view included in a form view). (see :
http://www.openerp.com/forum/topic13114.html?highlight=wizard&sid=2bc4325d0856f8168faf3989244233a5)

Can I get more information about this solution (codes ?)

Thx a lot


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC + 2 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:

Protected by Anti-Spam ACP