Skip to content

Commit

Permalink
Replace raise by logs in completion
Browse files Browse the repository at this point in the history
  • Loading branch information
ecino committed Sep 25, 2015
1 parent 0800cbb commit 77eda24
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions account_statement_completion_compassion/model/completion_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

from datetime import datetime
import time
import logging

logger = logging.getLogger(__name__)


class account_journal_completion(models.Model):
Expand Down Expand Up @@ -113,7 +116,6 @@ def auto_complete(self, stmt_line):
method = getattr(self, rule.function_to_call)
result = method(stmt_line)
if result:
result['already_completed'] = True
return result
return None

Expand Down Expand Up @@ -147,9 +149,9 @@ def get_from_partner_ref(self, st_line):
partner = partner_obj._find_accounting_partner(partner)
res['partner_id'] = partner.id
else:
raise exceptions.Warning(
('Line named "%s" (Ref:%s) was matched by more '
'than one partner while looking on partners') %
logger.warning(
'Line named "%s" (Ref:%s) was matched by more '
'than one partner while looking on partners' %
(st_line['name'], st_line['ref']))
return res

Expand Down Expand Up @@ -208,10 +210,10 @@ def get_from_amount(self, st_line):
partner = invoices[0].partner_id
for invoice in invoices:
if invoice.partner_id.id != partner.id:
raise exceptions.Warning(
('Line named "%s" (Ref:%s) was matched by '
'more than one invoice while looking on open'
' supplier invoices') %
logger.warning(
'Line named "%s" (Ref:%s) was matched by '
'more than one invoice while looking on open'
' supplier invoices' %
(st_line.name, st_line.ref))
res['partner_id'] = partner_obj._find_accounting_partner(
partner).id
Expand Down

0 comments on commit 77eda24

Please sign in to comment.