2017-03-02 7 views
1

XMLRCP API経由でOdooにいくつかのコマンドを送信するRubyアプリケーションを開発しています。 私はOdoo 8/9/10 API、XMLRPC経由で販売注文から請求書を作成する方法

def execute_odoo_command(odoo_model, odoo_command, values) 
    @models.execute_kw(ODOO_DB, @uid, ODOO_PASSWORD, odoo_model, odoo_command, values) 
end 

def create_order_sale 
    order_reference = "SO #{@reference_code}_#{@customer_odoo_id}" 
    values = { 
    currency_id: 1, 
    date_order: Date.today.to_s, 
    name: order_reference, 
    payment_term: 1, 
    partner_id: @customer_odoo_id 
    } 
    order_id = execute_odoo_command('sale.order', 'create', [values]) 
    create_sale_order_lines(order_id) 
    execute_odoo_command('sale.order', 'action_confirm', [order_id]) 
end 

は今、私は請求書の作成を開始しますwhayこの中に販売注文を作成することができました。私は請求書が作成されている場合でも、この

execute_odoo_command('account.invoice', 'create', [invoice_values(order_reference)]) 

しかし、同じようにそれを行うための方法を発見した、販売注文はSTIL「オープン」であると私は、「請求書の作成」のOdooインターフェイスのクリックから別の請求書を作成することができますボタン(明らかに間違っています)。 API経由でそのアクションをシミュレートする方法はありますか?

デバッグモードでは、ツールチップにどのメソッドも表示されません。

ご意見ありがとうございます。

答えて

1

今後のGoogle社員のために。解決策は、古いAPIバージョンを使用していることです。正しいコマンドコールはこれです

def create_invoice_from_sale_order(sale_order_id) 
    sale_order_to_invoice_data = [sale_order_id, {context: {active_ids: sale_order_id}}] 
    @odoo_rpc_client.execute_odoo_command('sale.order', 'action_invoice_create', sale_order_to_invoice_data) 
    end 
関連する問題