Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
3016 Visualizzazioni

Hi guys,


I would like to open a specific workspace (e.g. HR) in Odoo Documents from a button in a custom app so I am all set to upload files without first manually searching for the right workspace.


Therefore, the action in documents > views > documents_views.xml can be used although I am not able to figure out how to open a specific workspace (e.g. HR).


<record id="document_action" model="ir.actions.act_window">
      <field name="name">Documents</field>
      <field name="res_model">documents.document</field>
      <field name="view_mode">kanban,tree,form</field>
      <field name="domain">[]</field>
      <field name="view_ids" eval="[(5, 0, 0),
        (0, 0, {'view_mode': 'kanban', 'view_id': ref('documents.document_view_kanban')}),
        (0, 0, {'view_mode': 'tree', 'view_id': False}),
        (0, 0, {'view_mode': 'form', 'view_id': ref('documents.document_view_form')})]"/>
      <field name="help" type="html">
        <p class="o_view_nocontent_smiling_face">Upload <span class="font-weight-normal">a file or</span> drag <span class="font-weight-normal">it here.</span></p>
      </field>
    </record>


Does anybody have an idea to open a specific workspace from Python code?

Thanks in advance!

Best regards,


Gert Loterman

Avatar
Abbandona
Autore

Many thanks, Joren!

Risposta migliore

To open a specific workspace, you need to add the following code to the action record:

<field name="context">{ 'searchpanel_default_folder_id’: folder_id }</field>

Where "folder_id" is the id of the specific workspace.


Avatar
Abbandona