Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Priemyselné odvetvia
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Reštaurácia
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Reality
    • Real Estate Agency
    • Architecture Firm
    • Konštrukcia
    • Estate Managament
    • Gardening
    • Property Owner Association
    Poradenstvo
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Jedlo
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Iní
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

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

Odoberať

Get notified when there's activity on this post

This question has been flagged
salespdfprintodoo12qoutation
3 Replies
16712 Zobrazenia
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
Zrušiť
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
Zrušiť
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
Zrušiť
Usman Farzand
Autor

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
Autor

```

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
Zrušiť
Usman Farzand
Autor

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!

Registrácia
Related Posts Replies Zobrazenia Aktivita
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
aug 25
4474
Digital products
sales pdf
Avatar
Avatar
1
feb 25
8050
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة 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 je sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

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