Skip to Content
Odoo Menu
  • Log ind
  • Prøv gratis
  • Apps
    Økonomi
    • Bogføring
    • Fakturering
    • Udgifter
    • Regneark (BI)
    • Dokumenter
    • e-Signatur
    Salg
    • CRM
    • Salg
    • POS Butik
    • POS Restaurant
    • Abonnementer
    • Udlejning
    Hjemmeside
    • Hjemmesidebygger
    • e-Handel
    • Blog
    • Forum
    • LiveChat
    • e-Læring
    Forsyningskæde
    • Lagerbeholdning
    • Produktion
    • PLM
    • Indkøb
    • Vedligeholdelse
    • Kvalitet
    HR
    • Medarbejdere
    • Rekruttering
    • Fravær
    • Medarbejdersamtaler
    • Anbefalinger
    • Flåde
    Marketing
    • Markedsføring på sociale medier
    • E-mailmarketing
    • SMS-marketing
    • Arrangementer
    • Automatiseret marketing
    • Spørgeundersøgelser
    Tjenester
    • Projekt
    • Timesedler
    • Udkørende Service
    • Kundeservice
    • Planlægning
    • Aftaler
    Produktivitet
    • Dialog
    • Godkendelser
    • IoT
    • VoIP
    • Vidensdeling
    • WhatsApp
    Tredjepartsapps Odoo Studio Odoo Cloud-platform
  • Brancher
    Detailhandel
    • Boghandel
    • Tøjforretning
    • Møbelforretning
    • Dagligvarebutik
    • Byggemarked
    • Legetøjsforretning
    Mad og værtsskab
    • Bar og pub
    • Restaurant
    • Fastfood
    • Gæstehus
    • Drikkevareforhandler
    • Hotel
    Ejendom
    • Ejendomsmægler
    • Arkitektfirma
    • Byggeri
    • Ejendomsadministration
    • Havearbejde
    • Boligejerforening
    Rådgivning
    • Regnskabsfirma
    • Odoo-partner
    • Marketingbureau
    • Advokatfirma
    • Rekruttering
    • Audit & certificering
    Produktion
    • Tekstil
    • Metal
    • Møbler
    • Fødevareproduktion
    • Bryggeri
    • Firmagave
    Heldbred & Fitness
    • Sportsklub
    • Optiker
    • Fitnesscenter
    • Kosmetolog
    • Apotek
    • Frisør
    Håndværk
    • Handyman
    • IT-hardware og support
    • Solenergisystemer
    • Skomager
    • Rengøringsservicer
    • VVS- og ventilationsservice
    Andet
    • Nonprofitorganisation
    • Miljøagentur
    • Udlejning af billboards
    • Fotografi
    • Cykeludlejning
    • Softwareforhandler
    Gennemse alle brancher
  • Community
    Få mere at vide
    • Tutorials
    • Dokumentation
    • Certificeringer
    • Oplæring
    • Blog
    • Podcast
    Bliv klogere
    • Udannelselsesprogram
    • Scale Up!-virksomhedsspillet
    • Besøg Odoo
    Få softwaren
    • Download
    • Sammenlign versioner
    • Udgaver
    Samarbejde
    • Github
    • Forum
    • Arrangementer
    • Oversættelser
    • Bliv partner
    • Tjenester til partnere
    • Registrér dit regnskabsfirma
    Modtag tjenester
    • Find en partner
    • Find en bogholder
    • Kontakt en rådgiver
    • Implementeringstjenester
    • Kundereferencer
    • Support
    • Opgraderinger
    Github Youtube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Få en demo
  • Prissætning
  • Hjælp

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Bogføring
  • Lager
  • PoS
  • Projekt
  • MRP
All apps
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Hjælp

How to hide reports from print menu?

Tilmeld

Få besked, når der er aktivitet på dette indlæg

Dette spørgsmål er blevet anmeldt
actionreport
4 Besvarelser
27943 Visninger
Avatar
Gleb
I'm trying hide two reports, but when i run the code only one (first report) is not displayed. Can you tell me what the problem is?     
@api.model
def fields_view_get(self, view_id=None, view_type='form', toolbar=False, submenu=False):
res = super(AccountInvoice, self).fields_view_get(view_id=view_id, view_type=view_type, toolbar=toolbar,
submenu=submenu)
report_account_invoice_bill = self.env.ref('l10n_ru_doc.report_account_invoice_bill')
report_account_invoice_act = self.env.ref('l10n_ru_doc.report_account_invoice_act')
for print_submenu in res.get('toolbar', {}).get('print', []):
if print_submenu['id'] == report_account_invoice_bill.id:
res['toolbar']['print'].remove(print_submenu)
if print_submenu['id'] == report_account_invoice_act.id:
res['toolbar']['print'].remove(print_submenu)
return res
Thanks!
1
Avatar
Kassér
Gleb
Forfatter

Solution:

Use two methods

@api.multi

def create_action(self):

""" Create a contextual action for each report. """

for report in self:

model = self.env['ir.model']._get(report.model)

report.write({'binding_model_id': model.id, 'binding_type': 'report'})

return True

@api.multi

def unlink_action(self):

""" Remove the contextual actions created for the reports. """

self.check_access_rights('write', raise_exception=True)

self.filtered('binding_model_id').write({'binding_model_id': False})

return True

Avatar
Belal Salah
Bedste svar

add menu=False to report action

      id="account_invoices"

      model="account.invoice"

      string="Invoices"

      report_type="qweb-pdf"

      name="account.report_invoice_with_payments"

      file="account.report_invoice_with_payments"

      attachment="(object.state in ('open','in_payment','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"

      print_report_name="(object._get_report_base_filename())"

      groups="account.group_account_invoice"

    menu =False

  />

Video: https://www.youtube.com/watch?v=lVMDXpqasic&t=1s

5
Avatar
Kassér
Jose David Moreno Hernandez

It works perfectly, thank you!

LaoThai

Great Answer, thank you

M.halim

just Add

menu="False"

Sakthi Priya

how to set menu false based on state

Avatar
Pradip Yenpure (prye)
Bedste svar

If you want to hide the particulate report from the print menu then you can hide using the fields_view_get() function.I  added the below snippet code. This code may help you.

@api.model
def fields_view_get(self, view_id=None, view_type='form', toolbar=False, submenu=False):
    ##Sample Code of Hide print ,action menu and particular report
    res = super().fields_view_get(view_id, view_type, toolbar, submenu)
    remove_report_id = self.env.ref('purchase.report_purchase_quotation').id
    if view_type == 'form' and remove_report_id and \
        toolbar and res['toolbar'] and res['toolbar'].get('print'):
        remove_report_record = [rec for rec in res['toolbar'].get('print') if rec.get('id')==                                 remove_report_id]
        if remove_report_record and remove_report_record[0]:
             res['toolbar'].get('print').remove(remove_report_record[0])
    return res
0
Avatar
Kassér
Avatar
Asad Asif
Bedste svar

Hello,
There is an inexpensive app which can allow you to do that:

\https://www.odoo.com/apps/modules/12.0/hide_any_report/​

0
Avatar
Kassér
Avatar
Haresh Kansara
Bedste svar

Hi Gleb,

i think you need to first find the report external id defined in XML file and then inherit that XML code and add parameter invisible="1" to that code using xpath.

e.g. i have one report in account module and i want to hide then

<report

      id="account_invoices"

      model="account.invoice"

      string="Invoices"

      report_type="qweb-pdf"

      name="account.report_invoice_with_payments"

      file="account.report_invoice_with_payments"

      attachment="(object.state in ('open','in_payment','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"

      print_report_name="(object._get_report_base_filename())"

      groups="account.group_account_invoice"

  />


Then add invisible parameter like:


<report

      id="account.account_invoices"

      invisible="1"

      model="account.invoice"

      string="Invoices"

      report_type="qweb-pdf"

      name="account.report_invoice_with_payments"

      file="account.report_invoice_with_payments"

      attachment="(object.state in ('open','in_payment','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"

      print_report_name="(object._get_report_base_filename())"

      groups="account.group_account_invoice"

  />

There is one module available to hide print button: https://goo.gl/nuvnmw

Accept and upvote answer if helpful

Thanks and regards

Haresh Kansara

0
Avatar
Kassér
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Tilmeld dig
Related Posts Besvarelser Visninger Aktivitet
Preview or show a specific report Løst
action report preview
Avatar
Avatar
Avatar
3
okt. 25
1771
Guia Basica ¿Cómo puedo hablar con un asesor de Volaris?
action
Avatar
0
nov. 25
2
Need Advice For Migrate Thousands of Messy SKUs
action
Avatar
0
nov. 25
8
Pickup Date for E-Commerce Løst
action
Avatar
Avatar
Avatar
2
nov. 25
206
[FAQ's]~Can you book a cruise over the phone?
action
Avatar
0
nov. 25
2
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Oversættelser
Tjenester
  • Odoo.sh-hosting
  • Support
  • Opgradere
  • Individuelt tilpasset udvikling
  • Uddannelse
  • Find en bogholder
  • Find en partner
  • Bliv partner
Om os
  • Vores virksomhed
  • Brandaktiver
  • Kontakt os
  • Stillinger
  • Arrangementer
  • Podcast
  • Blog
  • Kunder
  • Juridiske dokumenter • Privatlivspolitik
  • Sikkerhedspolitik
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo er en samling open source-forretningsapps, der dækker alle dine virksomhedsbehov – lige fra CRM, e-handel og bogføring til lagerstyring, POS, projektledelse og meget mere.

Det unikke ved Odoo er, at systemet både er brugervenligt og fuldt integreret.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now