events - Odoo12 类型错误
问题描述
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)
我的错误是:在“销售/产品/产品”中填写汽车信息之前,我在“产品类型”字段中选择了“可存储产品”值。现在我正在填写汽车信息,“保存”成功。我想编辑“产品类型”的值,从“可存储产品”到“消费品”或“服务”,我收到了这个错误:
文件“/odoo/odoo12/odoo/models.py”,第 5384 行,在值 [名称] 中的 cmd 的 onchange 中:TypeError:'int' 对象不可迭代”
请帮忙。
解决方案
car_id = fields.Many2one('car.car', string='Car name', ... )
推荐阅读
- windows - D3D11_USAGE_STAGING,使用什么样的 GPU/CPU 内存?
- windows - usebackq 没有延迟扩展
- angular - Angular:从组件中获取 nativeElement
- c++ - 如何在函数内调用命名空间?
- java - Shapes doesn't appear (until JFrame is minimized and restored)
- javascript - 使用 Magnific Popup 打开 HTML 页面
- java - 从 Java 中的 XML 标记解析值
- xpages - 动态视图面板中日期的简单自定义 bean
- sql - 简单案例语句中的语法错误
- wpf - WPF拼写检查未在选项卡中加载自定义字典