我加入purchase.py
它的purchase.order
類selection
類型字段,這個字段稱爲功能場 - OpenERP的 - 問題
sel_cert
:'sel_cert' : fields.selection([('si', 'Si'),('no','No')], 'Origen Certificado'),
所以,如果si
選擇,還有就是我做了一個功能在product
填補一個新的領域在product_product
上課的時候purchase_order
是state 'done'
順便說一句已經有一個函數,它接受product_qty
狀態done, draft
或任何在product
我嘗試「稱之爲」在我的自定義功能:val = _get_product_available_func(('done'))
,所以它返回val
如果purchase.order
在sel_cert
字段中選擇si
,但IDK的怎麼辦呢,這是我的功能,而這個功能有我得到錯誤的回溯下(不關心縮進,它不是像這在我的文件):
def desc_cert(self, cr, uid, ids, field_name, field_args, context=None):
obj = self.pool.get('purchase.order')
val = _get_product_available_func(('done'))
if obj.sel_cert == 'si':
return val
而且回溯:
Server Traceback (most recent call last):
File "C:\Program Files\OpenERP 7.0-20130726-231403\Server\server\openerp\addons\web\session.py", line 89, in send
File "C:\Program Files\OpenERP 7.0-20130726-231403\Server\server\.\openerp\netsvc.py", line 292, in dispatch_rpc
File "C:\Program Files\OpenERP 7.0-20130726-231403\Server\server\.\openerp\service\web_services.py", line 626, in dispatch
File "C:\Program Files\OpenERP 7.0-20130726-231403\Server\server\.\openerp\osv\osv.py", line 188, in execute_kw
File "C:\Program Files\OpenERP 7.0-20130726-231403\Server\server\.\openerp\osv\osv.py", line 131, in wrapper
File "C:\Program Files\OpenERP 7.0-20130726-231403\Server\server\.\openerp\osv\osv.py", line 197, in execute
File "C:\Program Files\OpenERP 7.0-20130726-231403\Server\server\.\openerp\osv\osv.py", line 185, in execute_cr
File "C:\Program Files\OpenERP 7.0-20130726-231403\Server\server\.\openerp\osv\orm.py", line 3604, in read
File "C:\Program Files\OpenERP 7.0-20130726-231403\Server\server\.\openerp\osv\orm.py", line 3724, in _read_flat
File "C:\Program Files\OpenERP 7.0-20130726-231403\Server\server\.\openerp\osv\fields.py", line 1133, in get
File "C:\Program Files\OpenERP 7.0-20130726-231403\Server\server\openerp\addons\product\product.py", line 456, in desc_cert
NameError: global name '_get_product_available_func' is not defined
所以_get_product_available_func
是模塊product.py
在來之前的函數:
def _get_product_available_func(states, what):
def _product_available(self, cr, uid, ids, name, arg, context=None):
return {}.fromkeys(ids, 0.0)
return _product_available
_product_qty_available = _get_product_available_func(('done',), ('in', 'out'))
_product_certificado_qty = _get_product_available_func(('done',), ('in', 'out'))
_product_virtual_available = _get_product_available_func(('confirmed','waiting','assigned','done'), ('in', 'out'))
_product_outgoing_qty = _get_product_available_func(('confirmed','waiting','assigned'), ('out',))
_product_incoming_qty = _get_product_available_func(('confirmed','waiting','assigned'), ('in',))
我需要在product
如果該字段sel_cert
在purchase_order
返回product_qty_available
是'si'
但不知道如何打電話給我,我應該使用self.browse
嗎?或者可能是product_available
?
對此的任何想法?
我希望我已經提前
Yess,非常感謝你=),但現在我在'obj = self.pool.get('purchase.order')'中有另一個問題''它說'購買'。 order'沒有屬性'sel_ce rt' :(你找出原因嗎?我的意思是'sel_cert'是對象中的一個字段(列)'purchase.order' – NeoVe
我需要的是從類'purchase.order'中檢索'sel_cert'字段,有關如何執行此操作的任何想法?在此先感謝 – NeoVe
也許類似於:'purchase_obj.browse(cr,uid,sel_cert,context = context)'? – NeoVe