Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
2999 Lượt xem

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 ?

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

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
Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 5 17
7376
0
thg 12 15
3290
0
thg 3 15
4038
0
thg 3 25
1430
0
thg 1 25
3524