Do not fail to apply statement rules if account is missing on party
Closes #14741 (grafted from 9e844110997c686bbc21a2194be47a02335610a6) --HG-- branch : 7.0
This commit is contained in:
@@ -8,6 +8,7 @@ from decimal import Decimal
|
||||
from simpleeval import simple_eval
|
||||
|
||||
from trytond.model import ModelSQL, ModelView, fields, sequence_ordered
|
||||
from trytond.modules.account.exceptions import AccountMissing
|
||||
from trytond.modules.currency.fields import Monetary
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.pyson import Eval, If
|
||||
@@ -348,10 +349,13 @@ class StatementRuleLine(sequence_ordered(), ModelSQL, ModelView):
|
||||
date=origin.date,
|
||||
company=origin.company.id):
|
||||
party = Party(party.id)
|
||||
if amount > Decimal(0):
|
||||
account = party.account_receivable_used
|
||||
else:
|
||||
account = party.account_payable_used
|
||||
try:
|
||||
if amount > Decimal(0):
|
||||
account = party.account_receivable_used
|
||||
else:
|
||||
account = party.account_payable_used
|
||||
except AccountMissing:
|
||||
pass
|
||||
|
||||
if not account:
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user