跳至内容
菜单
此问题已终结
1 回复
2945 查看

Hello, I'm on Odoo v8,

I've done a module, it inherit from stock.move, I try to overload action_assign.

Here I've put a breakpoint (pdb) to see my values. When I try to get the product of a move, i got this error :

AttributeError: 'stock.move' object has no attribute '_ids'

My code :

# -*- coding: utf-8 -*-
from openerp.osv import osv, fields, expression

class stock_move(osv.osv):
_inherit = "stock.move"

def action_assign(self, cr, uid, ids, context):
import pdb
pdb.set_trace()

#récupérer le produit
product_id = self.product_id

What's wrong ?

形象
丢弃
编写者 最佳答案

This is the old API, so you have to access to the recordset with 

move = self.browse(cr, uid, ids, context)

Or access directly to the attribute 

default_location = self.browse(cr, uid, ids, context).product_id.default_location
形象
丢弃
相关帖文 回复 查看 活动
0
5月 17
7350
0
12月 15
3263
0
3月 15
4004
0
3月 25
1347
0
1月 25
3434