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

i have 2 classes in my module ;

class A:

'b_id' : fields.many2one('B'),

class B :

_rec_name = "'name'

'name' : fields.char('name'),

'counter': fields.integer('counter')

what i need is that whenever i select an object of a (from b_id) , to increment its counter.

any help please ??

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

you mean you want to know how many A objects are linked to your B object?

Ảnh đại diện
Huỷ bỏ
Tác giả

i want to know each object of A is how many times linked to B ; example: a1--->2 times, a2--->4 times,....

I don't understand. With your current classes, A can only be linked one time as the b_id is many2one.