In the Documents Odoo 18 entreprise module, the 'My Drive' and 'Company' sections are of interest in this post. Only one company is present in the system.
The goal is our custom Odoo module to create a folder named 'Lovelace' in the 'Company' section.
To be able to be created and visible in the 'Company' section, the specific values shall be set to the specific fields below:
- 'folder_id': False
- 'company_id': False
- 'owner_id': 1
- 'access_internal':'edit|view'
Thus the request would be
project_folder = self.env['documents.document'].sudo().search([
('name', '=', 'Lovelace'),
('folder_id', '=', False),
('type', '=', 'folder'),
('company_id', '=', False),
('owner_id', '=', 1),
], limit=1)
if not project_folder:
project_folder = self.env['documents.document'].sudo().create({
'name': 'Lovelace',
'folder_id': False,
'type':'folder',
'company_id': False,
'owner_id': 1,
'access_internal': 'edit',
})