line: omit calculation of balance if credit/debit = None

remove unused imports
This commit is contained in:
Frederik Jaeckel 2023-01-15 11:03:50 +01:00
parent a9773a42df
commit 11d6183d65
8 changed files with 13 additions and 11 deletions

View file

@ -733,7 +733,12 @@ class Line(SecondCurrencyMixin, Workflow, ModelSQL, ModelView):
lines = Line2.search(query) lines = Line2.search(query)
for line3 in lines: for line3 in lines:
balance += getattr(line3, credit_name) - getattr(line3, debit_name) line_credit = getattr(line3, credit_name)
line_debit = getattr(line3, debit_name)
if (line_credit is not None) or (line_debit is not None):
balance += line_credit - line_debit
if line3.id == line.id: if line3.id == line.id:
break break
return balance return balance

View file

@ -13,6 +13,5 @@ full copyright notices and license terms. -->
<field name="debit" sum="Debit"/> <field name="debit" sum="Debit"/>
<field name="balance"/> <field name="balance"/>
<field name="state"/> <field name="state"/>
<button name="wfedit"/>
<button name="wfcheck"/> <button name="wfcheck"/>
</tree> </tree>

View file

@ -1,11 +1,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# This file is part of the cashbook-module from m-ds for Tryton. # This file is part of the cashbook-module from m-ds.de for Tryton.
# The COPYRIGHT file at the top level of this repository contains the # The COPYRIGHT file at the top level of this repository contains the
# full copyright notices and license terms. # full copyright notices and license terms.
from trytond.model import ModelView, fields from trytond.model import ModelView, fields
from trytond.wizard import Wizard, StateView, StateTransition, Button from trytond.wizard import Wizard, StateView, StateTransition, Button
from trytond.i18n import gettext
from trytond.pool import Pool from trytond.pool import Pool
from trytond.transaction import Transaction from trytond.transaction import Transaction
from trytond.pyson import Eval, Bool, If, And from trytond.pyson import Eval, Bool, If, And

View file

@ -1,5 +1,5 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!-- This file is part of the cashbook-module from m-ds for Tryton. <!-- This file is part of the cashbook-module from m-ds.de for Tryton.
The COPYRIGHT file at the top level of this repository contains the The COPYRIGHT file at the top level of this repository contains the
full copyright notices and license terms. --> full copyright notices and license terms. -->
<tryton> <tryton>

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# This file is part of the cashbook-module from m-ds for Tryton. # This file is part of the cashbook-module from m-ds.de for Tryton.
# The COPYRIGHT file at the top level of this repository contains the # The COPYRIGHT file at the top level of this repository contains the
# full copyright notices and license terms. # full copyright notices and license terms.

View file

@ -1,5 +1,5 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!-- This file is part of the cashbook-module from m-ds for Tryton. <!-- This file is part of the cashbook-module from m-ds.de for Tryton.
The COPYRIGHT file at the top level of this repository contains the The COPYRIGHT file at the top level of this repository contains the
full copyright notices and license terms. --> full copyright notices and license terms. -->
<tryton> <tryton>

View file

@ -1,12 +1,11 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# This file is part of the cashbook-module from m-ds for Tryton. # This file is part of the cashbook-module from m-ds.de for Tryton.
# The COPYRIGHT file at the top level of this repository contains the # The COPYRIGHT file at the top level of this repository contains the
# full copyright notices and license terms. # full copyright notices and license terms.
from trytond.model import ModelView, fields from trytond.model import ModelView, fields
from trytond.pyson import PYSONEncoder from trytond.pyson import PYSONEncoder
from trytond.wizard import Wizard, StateView, StateTransition, StateReport, Button from trytond.wizard import Wizard, StateView, StateReport, Button
from trytond.i18n import gettext
from trytond.pool import Pool from trytond.pool import Pool
from trytond.pyson import Eval, Bool from trytond.pyson import Eval, Bool
from trytond.transaction import Transaction from trytond.transaction import Transaction

View file

@ -1,5 +1,5 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!-- This file is part of the cashbook-module from m-ds for Tryton. <!-- This file is part of the cashbook-module from m-ds.de for Tryton.
The COPYRIGHT file at the top level of this repository contains the The COPYRIGHT file at the top level of this repository contains the
full copyright notices and license terms. --> full copyright notices and license terms. -->
<tryton> <tryton>