-
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)