Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
4870 Представления

Hi,


My aim: create invoices for companies from my app.


Context:

- Odoo version : 13

- User : administrator with granted accesses to all companies

- Request from External API


I created an API user allowed for all my companies. I can create an invoice for my default company but how could I create an invoice for another company ? When I tried, it seems the invoice is still linked to my default company. I supposed the property "company_id" indicates the owner but it's not.


Could you help me ? Which properties I have to use to create invoices to a specific company?


Regards.

Аватар
Отменить
Лучший ответ

Hi,

If you try to create an invoice from Controller (if you create your own route) or from any python / odoo method then you should look at 'with_company' method.
It's similar to the 'with_context' method, you can see an exemple here: Multi-company Guidelines

If you try to create them through standard xmlrpc api, then you can pass 'force_company' with required company's id in the context's parameter

You can have an exemple of passing specific context here: Check move validity (with context)

Hope it'll help !

Аватар
Отменить
Related Posts Ответы Просмотры Активность
2
мар. 24
1624
0
июл. 16
3756
1
апр. 15
5255
2
янв. 24
13695
2
мая 25
825