2017-05-31 7 views
0

したがって、Odooの株価記録レコードのステータスに応じて、コネクタを使用してMagentoにステータスを送信しています。私はそれゆえstock.pickingレコード、デコレータon_record_write上の変更がある場合、その関数が呼び出されたいOdoo 8 - on_record_write()は、[状態]フィールドの[株価]で起動されていません

@on_record_write(model_names = 'stock.picking') 
def change_status_sale_order_sp(session, model_name, 
          record_id, vals): 
    if session.context.get('connector_no_export'): 
     return 
    record = session.env['stock.picking'].browse(record_id) 


    if "IN" in record.name: #the stock pickings might be to receive products from the supplier, but we want the one for the deliveries to customers 
     return 
    origin = record.origin  #String containing the sale order ID + the warehouse from where the order is shipped 
    so_name = origin.split(':')[0] 
    warehouse = origin.split(':')[1] 
    status = record.state 

    _logger.debug("STOCK PICKING --- Delivery order " + str(record_id) + " was modified : " + str(vals)) 

:ここ

は、私がそのために使用する機能(の始まり)です。

私の問題は、その関数は、それが状態フィールドである場合を除いて、すべての書き込みアクション(フィールドが手動またはサーバー側で変更されるたびに)によって、stock.pickingレコード上で呼び出されることです。私は 'vals'パラメータが{'state':whateverthestatusis}になることはありません。それはなぜですか、私は何かを逃していますか?

答えて

0

on_record_write()は、ストックピッキングの書き込みメソッドが呼び出されるたびに呼び出されます。

しかし、状態フィールドはfields.functionフィールドであり、株式移動に基づいて設定されるため、書き込みの値に状態フィールドを取得することはありません。