Technical Mailing lijst archieven

technical@mail.odoo.com

Avatar

Re: [odoo12] How to hide menu action report Customer but show in Vendor

door
sudhir
- 27-05-2019 05:24:32
I think you can do it using fields_view_get method.

You can take reference from the following code:

    @api.model
    def fields_view_get(self, view_id=None, view_type='form', toolbar=False, submenu=False):
        context = dict(self._context)
        res = super(Purchase, self).fields_view_get(view_id=view_id, view_type=view_type,
                                                    toolbar=toolbar, submenu=submenu)
        if res and view_type in ['tree', 'form'] and context.get('default_type') != 'purchase':
            # Remove reports if its not Purchase Order
            for report in ['module_name.report_1', 'module_name.report_2']:
                reports = self.env.ref(report, raise_if_not_found=False)
                for rec in res.get('toolbar', {}).get('print', []):
                    if rec.get('id', False) in reports.ids:
                        del res['toolbar']['print'][res.get('toolbar', {}).get('print').index(rec)]
        return res


This is the code I used on v10 to remove the report from one menu and show it in another menu for a similar object. I am not sure about v12 but you can give it a try.

On Mon, May 27, 2019 at 2:48 PM Saran Limpajitkutaporn <saranl@ecosoft.co.th> wrote:
Hello all,

We are trying to create action report in account.payment that Customer and Vendor using same account.payment but I want to hide menu action in Customer and show menu action in Vendor only. In odoo12 has any method to do that?

<report string="Payment Voucher"
            id="payment_voucher_report"
            model="account.payment"
            name="account_form.payment_voucher_pdf"
            file="account_form.payment_voucher_pdf"
            report_type="qweb-pdf"
            print_report_name="'PV - [%s]' % object.display_name"/>


Sincerely,
Saran Limpajitkutaporn

_______________________________________________
Mailing-List: https://www.odoo.com/groups/technical-62
Post to: mailto:technical@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe



--


Sudhir Arya
Director
ERP Harbor Consulting Services
In the Top 5 Position in Odoo Community Forum
Skype:sudhir@erpharbor.com
Website: http://www.erpharbor.com

The company accepts no liability for the content of this email, or for the consequences of any actions taken on the basis of the information provided unless that information is subsequently confirmed in writing. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.