From 63abcfb51909d76dfd2add7342258fb23c9cd4a3 Mon Sep 17 00:00:00 2001 From: Carlos Dauden Date: Fri, 8 Sep 2017 12:50:33 +0200 Subject: [PATCH] [FIX] partner_financial_risk: Error when risk_total includes draft_invoices (#468) --- partner_financial_risk/__openerp__.py | 2 +- partner_financial_risk/models/account_invoice.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/partner_financial_risk/__openerp__.py b/partner_financial_risk/__openerp__.py index a6eb5161c..a23c078d5 100644 --- a/partner_financial_risk/__openerp__.py +++ b/partner_financial_risk/__openerp__.py @@ -5,7 +5,7 @@ { 'name': 'Partner Financial Risk', 'summary': 'Manage partner risk', - 'version': '9.0.1.0.0', + 'version': '9.0.1.0.1', 'category': 'Sales Management', 'license': 'AGPL-3', 'author': 'Tecnativa, Odoo Community Association (OCA)', diff --git a/partner_financial_risk/models/account_invoice.py b/partner_financial_risk/models/account_invoice.py index 30714f102..843d60718 100644 --- a/partner_financial_risk/models/account_invoice.py +++ b/partner_financial_risk/models/account_invoice.py @@ -22,7 +22,9 @@ class AccountInvoice(models.Model): partner.risk_invoice_open_limit): exception_msg = _( "This invoice exceeds the open invoices risk.\n") - elif partner.risk_invoice_open_include and ( + # If risk_invoice_draft_include this invoice included in risk_total + elif not partner.risk_invoice_draft_include and ( + partner.risk_invoice_open_include and (partner.risk_total + invoice.amount_total) > partner.credit_limit): exception_msg = _(