From 605e79b606bcef5b9a02e8e443f68331f081d38a Mon Sep 17 00:00:00 2001 From: Jared Kipe Date: Thu, 20 Jun 2019 15:15:54 -0700 Subject: [PATCH] IMP `sale_credit_limit` Include the Currency and Currency formatting in SO warning. --- sale_credit_limit/models/sale.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sale_credit_limit/models/sale.py b/sale_credit_limit/models/sale.py index ff40a466..5b1f9b89 100644 --- a/sale_credit_limit/models/sale.py +++ b/sale_credit_limit/models/sale.py @@ -1,4 +1,5 @@ from odoo import api, models +from odoo.addons.mail.models.mail_template import format_amount class SaleOrder(models.Model): @@ -9,8 +10,9 @@ class SaleOrder(models.Model): for so in self: partner = so.partner_invoice_id.commercial_partner_id if partner.credit_limit and partner.credit_limit <= partner.credit: - m = 'Partner outstanding receivables %0.2f is above their credit limit of %0.2f' \ - % (partner.credit, partner.credit_limit) + m = 'Partner outstanding receivables %s is above their credit limit of %s' \ + % (format_amount(self.env, partner.credit, so.currency_id), + format_amount(self.env, partner.credit_limit, so.currency_id)) return { 'warning': {'title': 'Sale Credit Limit', 'message': m}