hello odoo developers,
when i code like this line
fields.Many2one('stock.warehouse', string='My ware houses', store=True)
i got just my company warehouses and i want all warehouses even warehouses of other branches
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
hello odoo developers,
when i code like this line
fields.Many2one('stock.warehouse', string='My ware houses', store=True)
i got just my company warehouses and i want all warehouses even warehouses of other branches
Hi,
your code is correct except for the check_company=False option.
you can try in another way:
from odoo import api, models, fieldsdef _get_all_company(self):
import logging
_logger = logging.getLogger(__name__)company_search_id = self.env['stock.warehouse'].search([], order = 'id desc')
for lines in company_search_id:
if lines.id:
_logger.info('lines: ' + str(lines.name))
the lines. name is the company name.
When you can get all the company names, you can use it as a var to process your logic.
Hope it helps.
Hi,
I have tried your code and, I am getting the warehouses of all companies.
If you have company_id in the form, try this:
warehouse_id = fields.Many2one('stock.warehouse', string='My ware houses', check_company=False, store=True)If you don't have the company_id in the model and form, just add it.
company_id = fields.Many2one('res.company', 'Company', required=True, default=lambda self: self.env.company.id)XML:
< field name="warehouse_id" /> < field name="company_id" invisible="1"/>*Ignore the space(' ') after <
Hope it helps
Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!
Zarejestruj sięPowiązane posty | Odpowiedzi | Widoki | Czynność | |
---|---|---|---|---|
|
2
sty 23
|
3435 | ||
Hierarchical warehouse management with Odoo
Rozwiązane
|
|
1
mar 21
|
3752 | |
|
1
gru 20
|
2241 | ||
|
6
maj 19
|
7137 | ||
|
1
mar 15
|
7502 |