From d6cf41b67b471c3511c2f025f3ec9e15bda50828 Mon Sep 17 00:00:00 2001 From: eLBati Date: Tue, 11 Apr 2017 10:27:25 +0200 Subject: [PATCH] [FIX] account_payment: The payment line name must be unique per company Closes #16366 Steps to reproduce the problem: - create 2 company - create 2 different sequences 'payment line', one for company - create a payment order for company A and insert a line - create a payment order for company B and insert a line Get SQL error saying The payment line name must be unique --- addons/account_payment/account_payment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account_payment/account_payment.py b/addons/account_payment/account_payment.py index 3f9e41cd48c..30bec3e917f 100644 --- a/addons/account_payment/account_payment.py +++ b/addons/account_payment/account_payment.py @@ -329,7 +329,7 @@ class payment_line(osv.osv): 'date': _get_date, } _sql_constraints = [ - ('name_uniq', 'UNIQUE(name)', 'The payment line name must be unique!'), + ('name_uniq', 'UNIQUE(name, company_id)', 'The payment line name must be unique per company!'), ] def onchange_move_line(self, cr, uid, ids, move_line_id, payment_type, date_prefered, date_scheduled, currency=False, company_currency=False, context=None):