如何在odoo7中调用方法?

2024-04-25 02:09:07 发布

您现在位置:Python中文网/ 问答频道 /正文

我创建了一个方法,并使用field函数调用该方法。但是,该方法从不执行。
这是我的密码:

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

Tags: 方法infromselfidsfieldfordata
1条回答
网友
1楼 · 发布于 2024-04-25 02:09:07

这个帮助

ids:对象的id列表

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'),
    }

相关问题 更多 >