Hi, I would like to hide/show “Print as PDF” based on the status(two options, Paid and Cancelled) in Invoice, here is what I did.
I created a view.detail.php in custom/modules/AOS_Invoices/views
<?php
require_once('modules/AOS_Invoices/views/view.detail.php');
class CustomAOS_InvoicesViewDetail extends AOS_InvoicesViewDetail {
public function display(){
if($this->bean->status == 'Cancelled') {
unset($this->dv->defs['templateMeta']['form']['buttons'][4]);
}
$this->dv->process();
echo $this->dv->display();
}
}
It doesn’t hide/show “Print as PDF” button, unless I run the Quick Repair and Rebuild every time after I changed the status of an invoice.
After creating above 3 files, you need to repair and rebuild your CRM only one time because we have Hide and Show print as pdf option from invoice module detail view by using a logic hook.
I hope it helps you. if you face any issue please let me know.
Thank
Urvi Solanki