Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
10955 Lượt xem

Hi everyone,

I want to hide only invoice section from the "Your Document" from the <odooURL:port>/my/home page in odoo 12, but I am not sure how can I achieve that using custom module.


I tried to lookup at the odoo source code and here is how the template defined.

My home main template:

    <template id="portal_my_home" name="My Portal">
        <t t-call="portal.portal_layout">
<t t-set="my_details" t-value="True"/>
<div class="o_portal_my_home">
<div class="oe_structure" id="oe_structure_portal_my_home_1"/>
<h3>Your Documents</h3>
<div class="o_portal_docs list-group">
</div>
</div>
<div class="oe_structure" id="oe_structure_portal_my_home_2"/>
</t>
</template>

and the templete to add the document:

    <template id="portal_docs_entry" name="My Portal Docs Entry">
        <a t-att-href="url" t-att-title="title" class="list-group-item list-group-item-action d-flex align-items-center justify-content-between">
<t t-esc="title"/>
<span class="badge badge-secondary badge-pill" t-esc="count"/>
</a>
</template>

And this will substitute the value to the template for invoice,

    <template id="portal_my_home_invoice" name="Portal My Home : invoice entries" inherit_id="portal.portal_my_home" priority="30">
        <xpath expr="//div[hasclass('o_portal_docs')]" position="inside">
            <t t-if="invoice_count" t-call="portal.portal_docs_entry">
                <t t-set="title">Invoices</t>
                <t t-set="url" t-value="'/my/invoices'"/>
                <t t-set="count" t-value="invoice_count"/>
            </t>
        </xpath>
    </template>

I used to do this by using xpath by selecting element in odoo 10 but I am not sure how to do this in odoo 12.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

in Odoo 16 :

1) Setting>>Technical>>UserInterface>>Views

2) filter "inerithed view" column to "my portal"

3) filter "view type" column  to "Qweb"

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Activate Developer mode (with asset) and then go to  Setting>>Technical>>UserInterface>>Views

Search for "Portal My Home : invoice entries"
The update below line in architecture

<t t-if="invoice_count" t-call="portal.portal_docs_entry"">

to 

<t t-if="invoice_count" t-call="portal.portal_docs_entry" groups="base.group_user">

Your portal visitor will not see invoices

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 12 18
3916
5
thg 11 18
7454
1
thg 8 21
5517
0
thg 2 21
2249
1
thg 9 20
5197