我確實需要在我的銷售訂單對象上添加額外的「狀態」值。從版本7.0開始,'sale_stock'模塊就已經完成了。當你嘗試從你自己的模塊做同樣的事情時,你的鍵,值只會被忽略。有沒有其他的選擇來實現這一目標?
正如我發現的,這似乎是兩年前的舊時間問題,如thread中所述。建議解決有做這樣的事情:OpenERP:通過繼承銷售訂單在'狀態'字段上添加新選擇
_inherit = 'sale.order'
def __init__(self, pool, cr):
super(sale_order, self)._columns['state'].selection.append(('keyx', 'valuex'))
我發現這種方法的邏輯,但它導致了以下錯誤:
`File "/home/nicolas/Eclipse/OpenERP/7.0/src/openerp/osv/orm.py", line 2958, in _auto_init
self._field_create(cr, context=context)
File "/home/nicolas/Eclipse/OpenERP/7.0/src/openerp/osv/orm.py", line 764, in _field_create
ir_model_fields_obj = self.pool.get('ir.model.fields')
AttributeError: 'sale.order' object has no attribute 'pool'`
如果這個bug在啓動板中報或這是一個意外的用途?你能提出什麼其他可能的解決方案?提前致謝。