Odoo Help

0

Trigger Odoo Google Spreadsheet by Schedule, not onOpen

By
Moises Garcia Marquez
on 11/24/16, 11:02 PM 425 views

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'); }}

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 11/24/16, 11:02 PM
Seen: 425 times
Last updated: 11/25/16, 12:36 AM