콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다

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
1755
0
9월 24
1001
1
9월 23
2302
1
5월 23
2722
0
1월 23
2130