-
StackOverflow 文档
-
odoo-8 教程
-
RPC 使用 Odoo v8 API(从 JavaScript 调用 Python 函数)
-
从中调用方法的示例 Odoo 模型
class my_model(models.Model):
_name = "my.model"
name = fields.Char('Name')
@api.multi
def foo_manipulate_records_1(self):
""" function returns list of tuples (id,name) """
return [(i.id,i.name) for i in self]
@api.multi
def foo_manipulate_records_2(self, arg1, arg2)
#here you can take advantage of "self" recordset and same time use aditional arguments "arg1", "arg2"
pass
@api.model
def bar_no_deal_with_ids(self, arg1, arg2):
""" concatenate arg1 and arg2 """
return unicode(arg1) + unicode(arg2)