跳至內容
選單
此問題已被標幟
3865 瀏覽次數

Hi, Odoo community. I'm trying to schedule a trigger to run the formula entered in the Odoo-Google spreadsheet model. The problem is that the "onOpen" trigger is needed in the google script to generate the menu from which, as far as I know, is pulled the login data to interact with our Odoo database.

I'm trying to "extract" the logic, such as variables, out of the "onOpen" function so that it only generates the menu which is needed to interact with Odoo, and having another function triggered by schedule to run the formula.

This is the "onOpen" trigger for reference:

function onOpen() {

var ss = SpreadsheetApp.getActiveSpreadsheet();

var menuEntries = [{name: "Insert Selection Field", functionName: "menu_insertSelection"}, {name: "Settings", functionName: "menu_settings"} ]; ss.addMenu("Odoo", menuEntries);

var a1 = ss.getRange("O60"); if ((a1.getFormula().indexOf('oe_settings') > -1 && ScriptProperties.getProperty('url')) || a1.getFormula().indexOf('oe_call_signin') > -1){ a1.setFormula(""); }

if (ScriptProperties.getProperty('oe_call_settings')){ menu_settings(); ScriptProperties.deleteProperty('oe_call_settings'); }

if (ScriptProperties.getProperty('oe_call_signin')){ menu_settings([["username", "Username"], ["password", "Password"]]); ScriptProperties.deleteProperty('oe_call_signin'); }}

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
3月 15
9921
1
1月 23
2704
3
5月 22
14762
0
7月 21
2430
0
7月 18
5015