如何在odoo 7中调用方法? [英] How to call a method in odoo 7?

查看:90
本文介绍了如何在odoo 7中调用方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个方法,并且正在使用字段函数来调用该方法.但是,该方法永远不会执行.
这是我的代码:

I've created a method and I was using field function to call the method. But, the method never executes.
here is my code :

def _get_data_from_puchase_order(self, cr, ids, field, arg, context=None):
    print "SUCCESS"
    print ":::::::::::::::::"
    result = {}
    for row in self.browse(cr, uid, ids):
        print row
        print "::::::::::::"

_columns = {
        "data_purchase_product" : fields.function(_get_data_from_puchase_order, method=True, string='origin', type='char', strore=False)
    }

我被添加了:

for data in self.pool.get('purchase.order').browse(cr, uid, ids):
    print data.name
    print "++++++++++++++++++"

我收到错误消息:

MissingError: ('MissingError', u'One of the documents you are trying to access has been deleted, please try again after refreshing.')

推荐答案

此帮助

ids:您对象的ID列表,

ids : list of id of your object,

def _get_data_from_puchase_order(self,cr,uid,ids,name, args, context=None) :
        print "SUCCESS"
        print ":::::::::::::::::"
        result = {}
        for row in ids:
            result[row] = "test"
        return result 

_columns = {
        'data_purchase_product': fields.function(_get_data_from_puchase_order, string='origin', method = True, type='integer'),
    }

这篇关于如何在odoo 7中调用方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆