If we have any kind of action needed to perform when an invoice is completed. So for this, we can use the observer function to identify the action of voice placed and we could implement the functionality based on that.
For that create an events.xml
?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="sales_order_invoice_register">
<observer name="Ivoice_created" instance="Vendor\Extension\Observer\InvoiceRegister" />
</event>
</config>
Create an observer function
<?php
namespace Vendor\Extension\Observer;
use Magento\Framework\Event\ObserverInterface;
class InvoiceRegister implements ObserverInterface
{
public function execute(\Magento\Framework\Event\Observer $observer)
{
return $this;
}
}
here can perform the functionality to take place after the invoice is completed.