我正在使用SoapPY從第三方服務中恢復數據,並將其保存在字典結構中。所收集的數據具有二維結構,與銷售訂單結構(標題行)類似。 我在填寫一些關鍵值後點擊自定義按鈕時會這樣做。我禁用了創建和保存按鈕,因爲我想要一個不同的表單行爲。我只需要獲取數據並手動將其保存在相應的表格(標題和行)中。我不希望自定義按鈕自動執行創建方法,因爲默認情況下,任何按鈕都會執行該方法。 任何消氣,請?Odoo 8及以上。自動創建並保存,無需創建和保存按鈕
def custom_button(self): # Get the info from third party using SOAPPy WSDLFile = "http://www.expedientes.poderjudicial.gub.uy/wsConsultaIUE.php?wsdl" proxy = WSDL.Proxy(WSDLFile) UIE = str(self.int_sede) + '-' + str(self.int_nro_registro) + '/' + str(self.int_ano) soap_exp = proxy.consultaIUE(UIE) # Set variables str_origen = soap_exp[1] str_caratula = soap_exp[3] str_abogado_actor = soap_exp[4] str_abogado_demandado = soap_exp[5] movimientos = soap_exp[6] mov_exp = [] for mov in movimientos: mov_exp.append ((0, 0, {'str_sede': mov['sede'], 'date_venc': mov['vencimiento'], 'str_decreto': mov['decreto'], 'date_mov': mov['fecha'], 'str_movimiento': mov['tipo']})) expediente = {'int_sede': self.int_sede, 'int_nro_registro': self.int_nro_registro, 'int_ano': self.int_ano, 'str_origen': str_origen, 'str_caratula': str_caratula, 'str_abogado_actor': str_abogado_actor, 'str_abogado_demandado': str_abogado_demandado, 'movimiento_ids': mov_exp } return write(expediente)
每個Odoo/openerp模型都有一個'create'方法你嘗試過嗎?事實上,你正在避免的按鈕實際上調用了相同的'create'方法 – danidee
我從表格中取下了按鈕,但我沒有想要自定義按鈕自己創建。我想用手做。 – jack10bells
是的,我明白,也許如果你顯示一些代碼,我們可以更好地理解你,並幫助你 – danidee