Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

2

How to not allow printing when in the draft state (up grey button "Print")?

By
Anabela Damas
on 10/11/13, 7:39 AM 2,423 views

Hi,

I don't want to allow printing, using the up grey button when invoices/ sales order/ delivery orders when the state is draft.

I tryed to find the code of this "Print" button : image description But I didn't figure it out.

Someone knows how do I restrict this print?

Probably explained myself badly. image description

The Print button red with black circle around I know control and prevent appear in the "Draft". The button that I want to control and prevent appear in the "Draft" is the "Print" gray with yellow circle.

Thanks

0

Cameron

--Cameron--
769
| 6 5 8
United Kingdom
--Cameron--
Cameron
On 10/11/13, 6:22 PM

I would think that was quiet hard, because you can print / attach reports from various places! You would have to block all these routes!

An idea maybe!.... to try and be clever with the report! eg set conditions to be remove parts of the report if condition is say "draft" - that way if they can print they

Take a look at the invoice report for inspiration!

Invoice [[ ((o.type == 'out_invoice' and (o.state == 'open')) or removeParentNode('para')) and '' ]]
Invoice [[ ((o.type == 'out_invoice' and (o.state == 'paid')) or removeParentNode('para')) and '' ]] [[ o.number ]] 
Pro-Forma [[ ((o.type == 'out_invoice' and o.state == 'proforma2') or removeParentNode('para')) and ''  ]]
Draft Invoice [[ ((o.type == 'out_invoice' and o.state == 'draft') or removeParentNode('para')) and ''  ]]

Thanks , but no similar document can be printed. So in draft state, I can't have a pdf file. I really need to change the "up grey" button print, and prevent that in the draft state this button generate a pdf file.

Versão Integral, Anabela Damas
on 10/14/13, 6:55 AM
0
Vikram
On 10/12/13, 4:46 AM
<button name="print_quotation" position = "attributes" > 
                <attribute name = "invisible">1</attribute>
         </button>
            <xpath expr="//form/header/button[@name='action_quotation_send']" position="after">
                <button name="print_quotation" string="Print" type="object" states="draft" class="oe_highlight" groups="base.group_user" invisible="1"/>
                <button name="print_quotation" string="Print" type="object" states="sent" groups="base.group_user" invisible="1"/>
                <button name="print_quotation" string="Print" type="object" class="oe_highlight"
                attrs="{'invisible': [('state','not in',('manual','progress'))]}" groups="base.group_user"/>
         </xpath>

Please use above code for hiding print option in sale order (appply on inherit sale.order).

Hope this will helpfull for you.

Thanks, Vikram.

I edited my question. This code just hide the print button with a black circle around, correct ?

Or the <button name="print_quotation" position = "attributes" > <attribute name = "invisible">1</attribute> </button>

Is what I need to hide the print button with the yellow circle around in the draft state ?

Versão Integral, Anabela Damas
on 10/14/13, 8:16 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 10/11/13, 7:39 AM
Seen: 2423 times
Last updated: 1/7/16, 12:56 PM