Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Aplikacije
    Finance
    • Knjigovodstvo
    • Obračun
    • Stroški
    • Spreadsheet (BI)
    • Dokumenti
    • Podpisovanje
    Prodaja
    • CRM
    • Prodaja
    • POS Shop
    • POS Restaurant
    • Naročnine
    • Najem
    Spletne strani
    • Website Builder
    • Spletna trgovina
    • Blog
    • Forum
    • Pogovor v živo
    • eUčenje
    Dobavna veriga
    • Zaloga
    • Proizvodnja
    • PLM
    • Nabava
    • Vzdrževanje
    • Kakovost
    Kadri
    • Kadri
    • Kadrovanje
    • Odsotnost
    • Ocenjevanja
    • Priporočila
    • Vozni park
    Marketing
    • Družbeno Trženje
    • Email Marketing
    • SMS Marketing
    • Dogodki
    • Avtomatizacija trženja
    • Ankete
    Storitve
    • Projekt
    • Časovnice
    • Storitve na terenu
    • Služba za pomoč
    • Načrtovanje
    • Termini
    Produktivnost
    • Razprave
    • Odobritve
    • IoT
    • Voip
    • Znanje
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industrije
    Trgovina na drobno
    • Book Store
    • Trgovina z oblačili
    • Trgovina s pohištvom
    • Grocery Store
    • Trgovina s strojno opremo računalnikov
    • Trgovina z igračami
    Food & Hospitality
    • Bar and Pub
    • Restavracija
    • Hitra hrana
    • Guest House
    • Beverage Distributor
    • Hotel
    Nepremičnine
    • Real Estate Agency
    • Arhitekturno podjetje
    • Gradbeništvo
    • Estate Management
    • Vrtnarjenje
    • Združenje lastnikov nepremičnin
    Svetovanje
    • Računovodsko podjetje
    • Odoo Partner
    • Marketinška agencija
    • Law firm
    • Pridobivanje talentov
    • Audit & Certification
    Proizvodnja
    • Tekstil
    • Metal
    • Pohištvo
    • Hrana
    • Brewery
    • Poslovna darila
    Health & Fitness
    • Športni klub
    • Trgovina z očali
    • Fitnes center
    • Wellness Practitioners
    • Lekarna
    • Frizerski salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Sistemi sončne energije
    • Izdelovalec čevljev
    • Čistilne storitve
    • HVAC Services
    Ostali
    • Neprofitna organizacija
    • Agencija za okolje
    • Najem oglasnih panojev
    • Fotografija
    • Najem koles
    • Prodajalec programske opreme
    Browse all Industries
  • Skupnost
    Learn
    • Tutorials
    • Dokumentacija
    • Certifikati
    • Šolanje
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Prenesi
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Dogodki
    • Prevodi
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Sklici kupca
    • Podpora
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Določanje cen
  • Pomoč

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

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

How i can Hide/Restrict Print menu Report base on condition Odoo12 cc?

Naroči se

Get notified when there's activity on this post

This question has been flagged
salespdfprintodoo12qoutation
3 Odgovori
16713 Prikazi
Avatar
Usman Farzand

i want to restrict user to print report Quotation / Order of sale until/unless state == 'sale'

if state not in sale need to show message to user "you can not Print report until sale confirmation.

my question is base on two way .

1) Report hide from print menu (if it's not possible ) see option 2

2) report show in print menu but restrict user until state =='sale'

1
Avatar
Opusti
Avatar
Sudhir Arya (ERP Harbor Consulting Services)
Best Answer

Hi Usman,

I am not sure about 1st point but you can do the 2nd point. For that you need to override the controller class (ReportController) of the web module and override report download method (​report_download​) in which you can write your code to restrict the user.

In the controller method, pass exception message like this.

2
Avatar
Opusti
Avatar
Dipak Shah
Best Answer

Hello Usman,

Answer for option 2).

See ref. code already existed in v12:

you can raise warning in below method based on condition as you want.because this method is calling before printing the report file.and after clicking on report menu.

class SaleOrderReportProforma(models.AbstractModel):
_name = 'report.sale.report_saleproforma'
_description = 'Proforma Report'

@api.multi
def _get_report_values(self, docids, data=None):
docs = self.env['sale.order'].browse(docids)
return {
'doc_ids': docs.ids,
'doc_model': 'sale.order',
'docs': docs,
'proforma': True
}​

Thanks,
Dipak

1
Avatar
Opusti
Usman Farzand
Avtor

Dipak my report is not Proforma report my report name is Qoutation / Sale ...is it possible this code i can inherit and get state from self and put condition on it ...

pls write some more help

Dipak Shah

> Your report name is "Quotation / Order" as you mentioned in your question.

> the code i given is useful.and yes please use 'docs' variable instead of 'self' if you can see in code 'docs' variable already contains recordset. so iterate it and check your condition of state.

Usman Farzand
Avtor

```

class SaleOrderReportProforma(models.AbstractModel):

_inherit = 'report.sale.report_saleproforma'

@api.multi

def _get_report_values(self, docids, data=None):

res = super(SaleOrderReportProforma, self)._get_report_values(self, docids, data=None)

docs = self.env['sale.order'].browse(docids)

for doc in docs:

if doc.state != 'sale':

raise exceptions.ValidationError('Please approve the order to print the report.')

else:

return res

```

it's not working not giving error install successfully ... where i'm wrong ?

Dipak Shah

Hello Usman,

I tested below code , its working well.

Please try below code:

class SaleOrderReport(models.AbstractModel):

_name = 'report.sale.report_saleorder'

_description = 'Sale order Report'

@api.multi

def _get_report_values(self, docids, data=None):

docs = self.env['sale.order'].browse(docids)

for doc in docs:

if doc.state != 'sale':

raise exceptions.ValidationError('Please approve the order to print the report.')

return {

'doc_ids': docs.ids,

'doc_model': 'sale.order',

'docs': docs,

'proforma': True

}

Dipak Shah

replace ...

_inherit = 'report.sale.report_saleproforma'

with this code ..

_name = 'report.sale.report_saleorder'

Sakthi Priya

@Dipek I tried your code, it works but it prints empty report for me.

Sakthi Priya

could you please let me know how to replace @api.multi in v14

Avatar
Turkesh Patel
Best Answer

* Hide report on print 
* Now add button on object with states option to print report (For sale print button is already there just show it in "Sale" state only)

0
Avatar
Opusti
Usman Farzand
Avtor

this is last option

but any logic how i can achive my goal ?

Turkesh Patel

This is the simplest option to achieve your goal.

Enjoying the discussion? Don't just read, join in!

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

Prijavi
Related Posts Odgovori Prikazi Aktivnost
why does Odoo 12 invoice Prints text file with no alignment & logo (Urgent Solution Needed)
pdf invoice print odoo12
Avatar
1
nov. 20
3901
error when going to print PDF and EXCEL
pdf qweb print excel odoo12
Avatar
Avatar
1
feb. 22
3394
adding custom field in quotation/invoice
sales pdf
Avatar
Avatar
1
nov. 25
417
Odoo 18 Quotation Builder Header/Footer Print Problem Solved
sales pdf
Avatar
Avatar
2
avg. 25
4474
Digital products
sales pdf
Avatar
Avatar
1
feb. 25
8050
Community
  • Tutorials
  • Dokumentacija
  • Forum
Open Source
  • Prenesi
  • Github
  • Runbot
  • Prevodi
Services
  • Odoo.sh Hosting
  • Podpora
  • Nadgradnja
  • Custom Developments
  • Izobraževanje
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Sredstva blagovne znamke
  • Kontakt
  • Zaposlitve
  • Dogodki
  • Podcast
  • Blog
  • Stranke
  • Pravno • Zasebnost
  • Varnost
الْعَرَبيّة 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 is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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