This code extends Odoo’s standard `account.move` model to automate the process of sending customer invoices and credit notes by email. A new Boolean field called `invoice_sent` is added to track whether an invoice has already been emailed, preventing duplicates. The main logic is defined in the `_cron_send_daily_invoices` method, which is designed to run automatically through a scheduled cron job. This method searches for all posted invoices and refunds that have not yet been sent and belong to customers with a valid email address. For each matching invoice, it retrieves Odoo’s default email template for invoices (`account.email_template_edi_invoice`) and sends the invoice via email using that template. Once the email is successfully sent, the system marks the invoice as sent by setting the `invoice_sent` field to `True`. If any errors occur during the process—such as missing templates or email delivery failures—they are logged in the Odoo server logs for debugging. This automation ensures that all posted invoices are emailed to customers daily without manual intervention, improving efficiency and consistency in invoice delivery.