diff --git a/addons/sale/models/payment_transaction.py b/addons/sale/models/payment_transaction.py index b960d32ee63..0d5d87ff0c7 100644 --- a/addons/sale/models/payment_transaction.py +++ b/addons/sale/models/payment_transaction.py @@ -98,7 +98,7 @@ class PaymentTransaction(models.Model): self._invoice_sale_orders() res = super()._reconcile_after_done() if self.env['ir.config_parameter'].sudo().get_param('sale.automatic_invoice'): - default_template = self.env['ir.config_parameter'].sudo().get_param('sale.default_email_template') + default_template = self.env['ir.config_parameter'].sudo().get_param('sale.default_invoice_email_template') if default_template: for trans in self.filtered(lambda t: t.sale_order_ids): trans = trans.with_company(trans.acquirer_id.company_id).with_context( diff --git a/addons/sale/models/res_config_settings.py b/addons/sale/models/res_config_settings.py index 33d7d343d85..8c440537559 100644 --- a/addons/sale/models/res_config_settings.py +++ b/addons/sale/models/res_config_settings.py @@ -47,21 +47,29 @@ class ResConfigSettings(models.TransientModel): module_sale_coupon = fields.Boolean("Coupons & Promotions") module_sale_amazon = fields.Boolean("Amazon Sync") - automatic_invoice = fields.Boolean("Automatic Invoice", - help="The invoice is generated automatically and available in the customer portal " - "when the transaction is confirmed by the payment acquirer.\n" - "The invoice is marked as paid and the payment is registered in the payment journal " - "defined in the configuration of the payment acquirer.\n" - "This mode is advised if you issue the final invoice at the order and not after the delivery.", - config_parameter='sale.automatic_invoice') - template_id = fields.Many2one('mail.template', 'Email Template', - domain="[('model', '=', 'account.move')]", - config_parameter='sale.default_email_template', - default=lambda self: self.env.ref('account.email_template_edi_invoice', False)) - confirmation_template_id = fields.Many2one('mail.template', string='Confirmation Email', - domain="[('model', '=', 'sale.order')]", - config_parameter='sale.default_confirmation_template', - help="Email sent to the customer once the order is paid.") + automatic_invoice = fields.Boolean( + string="Automatic Invoice", + help="The invoice is generated automatically and available in the customer portal when the " + "transaction is confirmed by the payment acquirer.\nThe invoice is marked as paid and " + "the payment is registered in the payment journal defined in the configuration of the " + "payment acquirer.\nThis mode is advised if you issue the final invoice at the order " + "and not after the delivery.", + config_parameter='sale.automatic_invoice', + ) + invoice_mail_template_id = fields.Many2one( + comodel_name='mail.template', + string='Invoice Email Template', + domain="[('model', '=', 'account.move')]", + config_parameter='sale.default_invoice_email_template', + default=lambda self: self.env.ref('account.email_template_edi_invoice', False) + ) + confirmation_mail_template_id = fields.Many2one( + comodel_name='mail.template', + string='Confirmation Email Template', + domain="[('model', '=', 'sale.order')]", + config_parameter='sale.default_confirmation_template', + help="Email sent to the customer once the order is paid." + ) def set_values(self): super(ResConfigSettings, self).set_values() diff --git a/addons/sale/views/res_config_settings_views.xml b/addons/sale/views/res_config_settings_views.xml index 291a2e218bb..f1ffea82bd6 100644 --- a/addons/sale/views/res_config_settings_views.xml +++ b/addons/sale/views/res_config_settings_views.xml @@ -209,8 +209,8 @@ Automatic email sent after the customer has signed or paid online