diff --git a/invoice_send_automatic/__init__.py b/invoice_send_automatic/__init__.py
new file mode 100644
index 00000000000..0650744f6bc
--- /dev/null
+++ b/invoice_send_automatic/__init__.py
@@ -0,0 +1 @@
+from . import models
diff --git a/invoice_send_automatic/__manifest__.py b/invoice_send_automatic/__manifest__.py
new file mode 100644
index 00000000000..569364454c2
--- /dev/null
+++ b/invoice_send_automatic/__manifest__.py
@@ -0,0 +1,9 @@
+{
+ "name": "Automated Action Send Invoice Sales",
+ "version": "1.0",
+ "depends": ["base", "sale_management", "accountant"],
+ "data": ["views/res_config_settings_views.xml", "data/ir_cron.xml"],
+ "sequence": 1,
+ "application": True,
+ "license": "OEEL-1",
+}
diff --git a/invoice_send_automatic/data/ir_cron.xml b/invoice_send_automatic/data/ir_cron.xml
new file mode 100644
index 00000000000..6174ff84e68
--- /dev/null
+++ b/invoice_send_automatic/data/ir_cron.xml
@@ -0,0 +1,13 @@
+
+
+
+ Automatic Send Invoice after due days
+
+
+ code
+ model.method_to_send_invoice_automatically()
+ 1
+ days
+
+
+
diff --git a/invoice_send_automatic/models/__init__.py b/invoice_send_automatic/models/__init__.py
new file mode 100644
index 00000000000..123c3f25143
--- /dev/null
+++ b/invoice_send_automatic/models/__init__.py
@@ -0,0 +1,2 @@
+from . import res_config_settings
+from . import account_move
diff --git a/invoice_send_automatic/models/account_move.py b/invoice_send_automatic/models/account_move.py
new file mode 100644
index 00000000000..44dfc216f34
--- /dev/null
+++ b/invoice_send_automatic/models/account_move.py
@@ -0,0 +1,32 @@
+from odoo import api, models
+from datetime import date, timedelta
+
+
+class AccountMove(models.Model):
+ _inherit = "account.move"
+
+ def _send_invoice_email(self):
+ self.ensure_one()
+
+ template = self.env.ref("account.email_template_edi_invoice")
+ template.send_mail(self.id)
+ self.message_post(body="Invoice automatically sent by cron job.")
+
+ @api.model
+ def method_to_send_invoice_automatically(self):
+ automatic_send_invoice_days = int(
+ self.env["ir.config_parameter"]
+ .sudo()
+ .get_param("invoice_send_automatic.automatic_send_invoice_days")
+ )
+ target_invoice_date = date.today() - timedelta(days=automatic_send_invoice_days)
+
+ invoices_to_send = self.search(
+ [
+ ("state", "=", "posted"),
+ ("move_type", "in", ("out_invoice", "out_refund")),
+ ("invoice_date", "=", target_invoice_date),
+ ]
+ )
+ for invoice in invoices_to_send:
+ invoice._send_invoice_email()
diff --git a/invoice_send_automatic/models/res_config_settings.py b/invoice_send_automatic/models/res_config_settings.py
new file mode 100644
index 00000000000..2860d0b5d43
--- /dev/null
+++ b/invoice_send_automatic/models/res_config_settings.py
@@ -0,0 +1,11 @@
+from odoo import fields, models
+
+
+class ResConfigSettings(models.TransientModel):
+ _inherit = "res.config.settings"
+
+ automatic_send_invoice_days = fields.Integer(
+ related="company_id.account_tax_periodicity_reminder_day",
+ readonly=False,
+ config_parameter="invoice_send_automatic.automatic_send_invoice_days",
+ )
diff --git a/invoice_send_automatic/views/res_config_settings_views.xml b/invoice_send_automatic/views/res_config_settings_views.xml
new file mode 100644
index 00000000000..0c671488eba
--- /dev/null
+++ b/invoice_send_automatic/views/res_config_settings_views.xml
@@ -0,0 +1,21 @@
+
+
+
+
+ res.config.settings.inherit.view.form
+ res.config.settings
+
+
+
+
+
+
+ days
+
+
+
+
+
+
+
\ No newline at end of file