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

from odoo import models,fields

# car/models/car.py

class Car(models.Model):

   _name = 'car.car'

   name  = fields.Char('Car name', size=25)

   brand = fields.Char('Car brand',default='Citroën DS',size=25)

   country = fields.Char('Country name ',default='France',size=30)

   

   def __init__(self):

        return 'The car name is : %s,\nIts brand is : %s,\nIts manufactured country is : %s.\n' %    (self.name,self.brand,self.country)

   

# car/models/product_template.py   

class ProductTemplate(models.Model):

   _inherits = 'product.template'

   _name     = 'product.template'

   

   car       = fields.Many2one('car.car', string='Car name', ondelete='SET NULL', auto_join=True)

   

My error is : Before to fill the car informations, in Sales/Products/Products, into tab 'General Information' i selected 'Storable Product' value in 'Product Type' field. Right now i am filling the car informations, 'save' successfully. I wanna edit the value of 'Product Type', from 'Storable Product' to 'Consumable' or 'Service', i got 

this error :


File "/odoo/odoo12/odoo/models.py", line 5384, in onchange

for cmd in values[name]:

TypeError: 'int' object is not iterable"


Please helps.

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

For each handler event(onchange), we get the same error.

Câu trả lời hay nhất

This error is not regarding above code segment. check your custom onchange functions. 

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
4
thg 5 24
7048
1
thg 7 23
2276
3
thg 6 23
3124
4
thg 6 22
4801
3
thg 4 22
5421