mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
FIX bug #262 in account_credit_control: Avoid a crash
This commit is contained in:
committed by
Pedro M. Baeza
parent
6d6e6306f3
commit
28e4f2c24a
@@ -19,6 +19,7 @@
|
||||
#
|
||||
##############################################################################
|
||||
from openerp import models, fields, api
|
||||
from openerp.exceptions import Warning, ValidationError
|
||||
|
||||
|
||||
class ResPartner(models.Model):
|
||||
@@ -42,7 +43,7 @@ class ResPartner(models.Model):
|
||||
string='Credit Control Lines',
|
||||
readonly=True)
|
||||
|
||||
@api.constrains('credit_policy_id')
|
||||
@api.constrains('credit_policy_id', 'property_account_receivable')
|
||||
def _check_credit_policy(self):
|
||||
""" Ensure that policy on partner are limited to the account policy """
|
||||
for partner in self:
|
||||
@@ -53,6 +54,6 @@ class ResPartner(models.Model):
|
||||
policy = partner.credit_policy_id
|
||||
try:
|
||||
policy.check_policy_against_account(account)
|
||||
except api.Warning as err:
|
||||
except Warning as err:
|
||||
# constrains should raise ValidationError exceptions
|
||||
raise api.ValidationError(err)
|
||||
raise ValidationError(err)
|
||||
|
||||
Reference in New Issue
Block a user