我想添加selection field
如下:
class product_pricelist_item1(models.Model):
_inherit = 'product.pricelist.item'
x_type = fields.Selection(selection=[('sample', 'Sample'),('moq', 'MOQ'),('others', 'Others')],string="Choices")
product.pricelist.item
形式上。我正在编写如下 XML 代码:
<record id="product_pricelist_item_form_view_with_code" model="ir.ui.view">
<field name="name">product.pricelist.item.form</field>
<field name="model">product.pricelist.item</field>
<field name="inherit_id" ref="product.product_pricelist_item_form_view" />
<field name="arch" type="xml">
<field name="min_quantity" position="after">
<field name="x_type"/>
</field>
</field>
</record>
但是当我打开价格表时,它给了我一个这样的错误:
Odoo Server Error
Traceback (most recent call last):
File "C:\Odoo 9.0-20151122\server\.\openerp\http.py" 599, line in _handle_exception
File "C:\Odoo 9.0-20151122\server\.\openerp\http.py", line 636, in dispatch
File "C:\Odoo 9.0-20151122\server\.\openerp\http.py", line 315, in _call_function
File "C:\Odoo 9.0-20151122\server\.\openerp\service\model.py", line 118, in wrapper
File "C:\Odoo 9.0-20151122\server\.\openerp\http.py", line 308, in checked_call
File "C:\Odoo 9.0-20151122\server\.\openerp\http.py", line 887, in __call__
File "C:\Odoo 9.0-20151122\server\.\openerp\http.py", line 465, in response_wrap
File "C:\Odoo 9.0-20151122\server\openerp\addons\web\controllers\main.py", line 971, in call_kw
File "C:\Odoo 9.0-20151122\server\openerp\addons\web\controllers\main.py", line 963, in _call_kw
File "C:\Odoo 9.0-20151122\server\.\openerp\api.py", line 232, in wrapper
File "C:\Odoo 9.0-20151122\server\.\openerp\models.py", line 3173, in read
File "C:\Odoo 9.0-20151122\server\.\openerp\api.py", line 230, in wrapper
File "C:\Odoo 9.0-20151122\server\.\openerp\models.py", line 3219, in read
File "C:\Odoo 9.0-20151122\server\.\openerp\models.py", line 5684, in __getitem__
File "C:\Odoo 9.0-20151122\server\.\openerp\fields.py", line 807, in __get__
File "C:\Odoo 9.0-20151122\server\.\openerp\fields.py", line 914, in determine_value
File "C:\Odoo 9.0-20151122\server\.\openerp\fields.py", line 869, in compute_value
File "C:\Odoo 9.0-20151122\server\.\openerp\fields.py", line 859, in _compute_value
File "C:\Odoo 9.0-20151122\server\.\openerp\api.py", line 230, in wrapper
File "C:\Odoo 9.0-20151122\server\.\openerp\api.py", line 398, in new_api
File "C:\Odoo 9.0-20151122\server\openerp\addons\product\pricelist.py", line 331, in _get_pricelist_item_name_price
File "C:\Odoo 9.0-20151122\server\.\openerp\fields.py", line 807, in __get__
File "C:\Odoo 9.0-20151122\server\.\openerp\fields.py", line 905, in determine_value
File "C:\Odoo 9.0-20151122\server\.\openerp\api.py", line 230, in wrapper
File "C:\Odoo 9.0-20151122\server\.\openerp\models.py", line 3278, in _prefetch_field
File "C:\Odoo 9.0-20151122\server\.\openerp\api.py", line 230, in wrapper
File "C:\Odoo 9.0-20151122\server\.\openerp\models.py", line 3208, in read
File "C:\Odoo 9.0-20151122\server\.\openerp\api.py", line 230, in wrapper
File "C:\Odoo 9.0-20151122\server\.\openerp\models.py", line 3346, in _read_from_database
File "C:\Odoo 9.0-20151122\server\.\openerp\sql_db.py", line 139, in wrapper
File "C:\Odoo 9.0-20151122\server\.\openerp\sql_db.py", line 215, in execute
ProgrammingError: column product_pricelist_item.x_type does not exist
LINE 1: ...duct_pricelist_item"."create_uid" as "create_uid","product_p...