changeset 6c704c8bfdb6 in modules/analytic_account:default
details: 
https://hg.tryton.org/modules/analytic_account?cmd=changeset;node=6c704c8bfdb6
description:
        Remove positive constraint on debit/credit

        issue7897
        review60471002
diffstat:

 CHANGELOG |  2 ++
 line.py   |  8 +++++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diffs (34 lines):

diff -r 7887cf23b411 -r 6c704c8bfdb6 CHANGELOG
--- a/CHANGELOG Tue Jan 08 16:46:13 2019 +0100
+++ b/CHANGELOG Mon Jan 14 23:52:58 2019 +0100
@@ -1,3 +1,5 @@
+* Remove positive constraint on debit/credit
+
 Version 5.0.0 - 2018-10-01
 * Bug fixes (see mercurial logs for details)
 * Remove support for Python 2.7
diff -r 7887cf23b411 -r 6c704c8bfdb6 line.py
--- a/line.py   Tue Jan 08 16:46:13 2019 +0100
+++ b/line.py   Mon Jan 14 23:52:58 2019 +0100
@@ -43,9 +43,8 @@
         super(Line, cls).__setup__()
         t = cls.__table__()
         cls._sql_constraints += [
-            ('credit_debit',
-                Check(t,
-                    (t.credit * t.debit == 0) & (t.credit + t.debit >= 0)),
+            ('credit_debit_',
+                Check(t, t.credit * t.debit == 0),
                 'account.msg_line_debit_credit'),
             ]
         cls._order.insert(0, ('date', 'ASC'))
@@ -59,6 +58,9 @@
         for field_name in ['name', 'journal']:
             table.not_null_action(field_name, action='remove')
 
+        # Migration from 5.0: replace credit_debit constraint by credit_debit_
+        table.drop_constraint('credit_debit')
+
     @staticmethod
     def default_date():
         Date = Pool().get('ir.date')

Reply via email to