Ah okay, it will work via Modules. Perfect, thanks for the reads!
For those who are interested:
you can create a new Model with your functions:
from odoo import models, fields
from openerp.exceptions import Warning
class ExternalCode(models.Model):
_name = "external.code"
name = fields.Char(string="Name", required=True)
description = fields.Text("Description")
##
# test function to show how to call a function
# @name - test
# @parameters - none (self is referencing the model itself)
# @return - void
##
def test(self):
# access another model
recordset = self.env['hr.employee'].search([("name", "<>", "Peter")])
nameslist = "I have following names: "
# walk throug data and concatenate model values
for record in recordset:
name = record.name
nameslist += name
# return String in a native Warning window
raise Warning(nameslist)
##
# test function to show how to call a function with parameters. It returns
# the given Parameter in a Warning
# @name - test
# @parameters - data(String), (self is referencing the model itself)
# @return - void
##
def testWithParameters(self, data):
raise Warning(data)
.
Install your module in Odoo and now you can create a call with those 2 lines:
tool = env["external.code"]
tool.test()
# or tool.testWithParameters( "anything you need to pass" )
Any suggestions on that? It works fine for me so far