[FIX] sale: use str2bool to make sure the boolean sale.automatic_invoice is
correctly used
When a boolean ir.config.parameter is set to False,
self.env['ir.config_parameter'].sudo().get_param('parzm_key') will return
'False'. As the string is not falsy, the parameter value match as true.
This commit fix the behavior for the sale.automatic_invoice to keep coherence
with the subscription module
closes odoo/odoo#101906
X-original-commit: ade1a1f5ee00baa88347bfd151f028bd17d7f4f1
Related: odoo/enterprise#32173
Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: Arnaud Joset <arj@odoo.com>
This commit is contained in:
@@ -5,7 +5,7 @@ from datetime import datetime
|
||||
from dateutil import relativedelta
|
||||
|
||||
from odoo import _, api, Command, fields, models, SUPERUSER_ID
|
||||
from odoo.tools import format_amount
|
||||
from odoo.tools import format_amount, str2bool
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -117,7 +117,7 @@ class PaymentTransaction(models.Model):
|
||||
confirmed_orders._send_order_confirmation_mail()
|
||||
|
||||
# invoice the sale orders if needed and send it
|
||||
if self.env['ir.config_parameter'].sudo().get_param('sale.automatic_invoice'):
|
||||
if str2bool(self.env['ir.config_parameter'].sudo().get_param('sale.automatic_invoice')):
|
||||
# Invoice the sale orders in self instead of in confirmed_orders to create the invoice
|
||||
# even if only a partial payment was made.
|
||||
self._invoice_sale_orders()
|
||||
|
||||
Reference in New Issue
Block a user