This question has been flagged
2 Replies
8237 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

Avatar
Discard
Best Answer

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 ''  ]]
Avatar
Discard
Author

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.

Best Answer
<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.

Avatar
Discard
Author

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 ?