Skip to content

Instantly share code, notes, and snippets.

@rorymckinley
Created September 14, 2015 20:28
Show Gist options
  • Save rorymckinley/24aed6c36c2c7fdc53ea to your computer and use it in GitHub Desktop.
Save rorymckinley/24aed6c36c2c7fdc53ea to your computer and use it in GitHub Desktop.
Odoo Prototype Model
from openerp import models, fields, api
class alpha(models.Model):
_name = 'lfah.alpha'
name = fields.Char()
description = fields.Text()
def write_to_tmp(self, cr, uid, context=None):
f = open("/tmp/alpha_stuff", "w")
f.write("Hello from the Alpha model")
f.close()
def read_from_tmp(self):
f = open("/tmp/alpha_in.txt", "r")
for line in f:
parts = line.split()
self.create({'name': parts[0], 'description': parts[1]})
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment