Odoo Help

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 3,193 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

1
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
1
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

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

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