跳至內容
選單
此問題已被標幟
4 回覆
7743 瀏覽次數

I need call the method "button_block" of model "mrp.workcenter.productivity" using XMLRPC because I want block a workorder using my raspberry pi. I need help because i don't know how I can pass the parameter "loss_id" to block the workorder. On the other hand when I call the method "button_block" there is a erro because the methon hasn´t return value.


My code is this(using python 3.7.4 ):

from xmlrpc import client as xmlrpclib 

url= 'http://localhost:8069'
db='TFG_Sergio_pruebas'
username='user'
password='pass'

common = xmlrpclib.ServerProxy('{}/xmlrpc/2/common'.format(url))
models = xmlrpclib.ServerProxy('{}/xmlrpc/2/object'.format(url))
uid = common.login(db, username, password)

bloquear_ct= models.execute_kw(db,uid,password,
'mrp.workcenter.productivity','button_block',[6],{})
print(bloquear_ct)


I know how make the call ando don´t have the problem of none return, but I don´t know how make tu pass the "loss_id" parameter to the method "button_block".

 
頭像
捨棄

Can you please post the code you tried and the error you are getting?

最佳答案

Normally XML-RPC only works for the methods that return something. Now, you have two options:

1: Create your custom module and create a method in "mrp.workcenter.productivity" object and call "button_block" method and return True.
Example:

@api.multi
def action_button_block(self):
self.button_block()
return True

2: If you can find the ID of the work order (mrp.workorder), then directly call "end_all()" method which will do the similar thing as button_block.

頭像
捨棄
作者

Yes, I thinked in this but I don't know if calling "end_all()" I can pass the parametre of loss_id, this is my problem, I can´t chose the block type.

Thanks

作者 最佳答案


頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
5月 20
2412
0
1月 25
1027
1
3月 22
5108
4
12月 19
18953
2
5月 18
5997