How to override create,write,unlink method in Odoo v8

As we all know, Odoo 8 has new api which is different with v7. So how to override the create,write,unlink orm method in odoo 8 way ?

Let see it.

if you want override create method you have to use the model decorator.

@api.model
def create(self,values):
    ............

if you want override write method ,you are not supposed to use write method,using multi decorator instead.

@api.multi
def write(self,values):
  ......................

the same with unlink:

@api.multi
def unlink(self):
    ..............
时间: 2024-07-31 20:58:51

How to override create,write,unlink method in Odoo v8的相关文章

Part 57 to 58 Why should you override ToString and Equal Method

Part 57 Why should you override ToString Method sometimes you can override ToString method like that: namepace Example public class MainClass { Customer C = new Customer(); C.firstName = "Lin"; C.lastName="Gester"; Console.Write(C.ToSt

Java重写父类使用@Override时出现The method destroy() of type xxx must override a superclass method的问题解决

解决方法: 1.把JDK版本改成1.6以上的. 2.把Compiler改成1.6以上的. 关于这两者的区别,参考:http://www.cnblogs.com/EasonJim/p/6741682.html

TypeError: Error when calling the metaclass bases Cannot create a consistent method resolution order (MRO) for bases A2, A1 出现原因及其解决办法

原本想测试继承,出现了这个错误: 源代码 1 class A1(object): 2 def fo1(self): 3 print "i'm A1" 4 class A2(object): 5 def fo1(self): 6 print "i'm A2" 7 class B1(A1,A2): 8 def bar(self): 9 print "i'm B1" 10 class B2(A2,A1): 11 def bar(self): 12 pr

Ext.define override和extend的区别

extend:继承组件,创建新组建. override:改写组件 Ext.define('Ext.some.DerivedClass', { method: function () { console.log('Bad'); }}); Ext.define('App.paches.DerivedClass', { override: 'Ext.some.DerivedClass', method: function () { console.log('Fixed'); this.callSupe

HttpWebRequest.Method 属性

public static void GetHead(string url) { var http = (HttpWebRequest)WebRequest.Create(url); http.Method = "HEAD";//设置Method为HEAD http.UserAgent = "Tujia-Auto-Test"; try { HttpWebResponse response = (HttpWebResponse)http.GetResponse();

[Python] Create a new Django project in Pycharm

From: http://blog.csdn.net/u013088062/article/details/50158239     创建新工程 1.主题 这部分教程主要介绍如何通过Pycharm创建.管理.运行一个Django工程. Django是一个开放源代码的Web应用框架,由Python写成.采用了MVC的软件设计模式,即模型M,视图V和控制器C. 2.准备工作 (1)Pycharm为3.0或者更高版本. (2)电脑上至少安装了一个Python解释器,2.4到3.3版本均可. 这部分教程

How can I create a dump of SQL Server?

https://blogs.msdn.microsoft.com/askjay/2009/12/29/basic-debugging-concepts-and-setup/ You can create a memory dump of the SQL Server process space in several ways.  There are many external tools that can help you accomplish this such as userdump.exe

《编程导论(Java)·2.1.3改写(override)》

<编程导论(Java)·2.1.3改写(override)>,收集override内容. 方法改写(method overriding)是指对于父类定义的一个实例方法,同意子类提供自己的实现的一种语言特性.子类的实现将改写(override)或代替(replace)父类中的实现. 改写成功必须"同一时候"满足下列条件. 两者的方法签名全然同样. 方法签名(signature)指一个方法的名字和形參列表.a method's signature is its name and

设计模式13:Template Method 模板方法模式(行为型模式)

Template Method 模板方法模式(行为型模式) 变与不变 变化——是软件永恒的主题,如何管理变化带来的复杂性?设计模式的艺术性和复杂度就在于如何分析,并发现体系中的变化点和稳定点,并使用特定的设计方法来应对这种变化. 动机(Motivation) 在软件构建过程中,对于某一项任务,它常常有稳定的整体操作结构,但各个子步骤却有很多改变的需求,或者由于固定的原因(比如框架与应用之间的关系)而无法和任务的整体结构同时实现. 如何在确定稳定操作结构的前提下,来灵活应对各个子步骤的变化或者晚期