Skip to Content
Menu
This question has been flagged

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


Avatar
Discard
Best Answer

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

Avatar
Discard
Related Posts Replies Views Activity
2
Sep 24
170
0
Sep 24
103
1
Sep 23
1120
1
May 23
1223
0
Jan 23
996