Reviewers: ,
Please review this at http://codereview.tryton.org/705003/
Affected files:
M purchase.py
Index: purchase.py
===================================================================
--- a/purchase.py
+++ b/purchase.py
@@ -4,6 +4,7 @@
from trytond.pyson import Eval
from trytond.transaction import Transaction
from trytond.pool import Pool, PoolMeta
+from trytond.exceptions import UserError
__all__ = ['Purchase', 'PurchaseLine', 'Account']
__metaclass__ = PoolMeta
@@ -25,15 +26,20 @@
super(Purchase, self).check_for_quotation()
- if not AccountSelection.check_root(
+ try:
+ AccountSelection.check_root(
[x.analytic_accounts for x in self.lines
- if x.analytic_accounts]):
+ if x.analytic_accounts])
+ except UserError:
for line in self.lines:
if line.type != 'line':
continue
- if not
AccountSelection.check_root([line.analytic_accounts]):
+ try:
+ AccountSelection.check_root([line.analytic_accounts])
+ except UserError:
self.raise_user_error('analytic_account_required',
(line.rec_name,))
+ raise
class PurchaseLine:
--
--
[email protected] mailing list
---
You received this message because you are subscribed to the Google Groups "tryton-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.