[REV] sale: partial revert of 34f2d0c267c54cce53b654b4d1c4228f1cd32c20

* the referenced commit didn't remove the used config parameter
* it's quite dumb to stop considering the parameters of a db out of nowhere
and force the usage of a specific template when a lot of databases were potentially
using another one.

This commit makes sure the parameter is still used when defined.
It is set to the forced valued in the data by default anyway.

task-2880950

closes odoo/odoo#97565

Related: odoo/upgrade#3965
Related: odoo/enterprise#30168
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
This commit is contained in:
Victor Feyens
2023-02-03 11:45:19 +01:00
parent 8c2450de7d
commit d9548b6681
+10 -1
View File
@@ -779,7 +779,16 @@ class SaleOrder(models.Model):
:return: `mail.template` record or None if default template wasn't found
"""
return self.env.ref('sale.mail_template_sale_confirmation', raise_if_not_found=False)
self.ensure_one()
default_confirmation_template_id = self.env['ir.config_parameter'].sudo().get_param(
'sale.default_confirmation_template'
)
default_confirmation_template = default_confirmation_template_id \
and self.env['mail.template'].browse(int(default_confirmation_template_id)).exists()
if default_confirmation_template:
return default_confirmation_template
else:
return self.env.ref('sale.mail_template_sale_confirmation', raise_if_not_found=False)
def action_quotation_sent(self):
""" Mark the given draft quotation(s) as sent.