跳至內容
選單
此問題已被標幟
1 回覆
2540 瀏覽次數

There is a problem with multicompany and External API, I have 3 companies, if I send xmlrpc create partner mesage with :
- company_id=3
- property_account_position_id=54 (a position belonging to company 3)

A new record is stored inside ir_property table with {name = 'property_account_position_id', company_id=1,  property_account_position_id =54}


So position id is correct but company reference is not, so partner form show fiscal position empty


頭像
捨棄
最佳答案

The issue with the tax line field being empty in the invoice line when using the External API may be due to a missing required value for the "account_id" field in the account move line model. In Odoo, the "account_id" field is a required field in the account move line model, and it specifies the account that will be used for the invoice line.

To resolve the issue with the empty tax line field in the invoice line, you can try adding a value for the "account_id" field in the account move line model when creating the invoice line using the External API. You can use the "account.account" model to search for the correct account to use for the invoice line, and then pass the ID of the account as the value for the "account_id" field when creating the invoice line.

For example, you can use the following code to search for the correct account to use for the invoice line, and then create the invoice line with the "account_id" field set to the ID of the found account:

# Search for the correct account to use for the invoice line
accounts = models.execute_kw(
    DB, uid, ODOO_PWD,
    'account.account',
    'search',
    [[['name', 'ilike', 'Sales']]]
)

# Get the first account that matches the search criteria
account = accounts[0]

# Create the invoice line with the "account_id" field set to the found account
invoice_line = models.execute_kw(
    DB, uid, ODOO_PWD,
    'account.move.line',
    'create',
    [{
        'name': 'Product Name',
        'quantity': 1,
        'price_unit': 100,
        'account_id': account,
    }]
)

In this code, the "account.account" model is used to search for an account with the name "Sales", and the first account that matches the search criteria is used as the value for the "account_id" field when creating the invoice line. This should ensure that the invoice line is created with the correct "account_id" field value, and the tax line field in the invoice line

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
2
9月 24
1731
0
9月 24
973
1
9月 23
2298
1
5月 23
2709
0
1月 23
2124