[FIX] lunch: return warning instead of UserError if amount order is larger than balance

This commit is contained in:
Nicolas Martinelli
2015-05-27 20:50:27 +02:00
parent c210cd3e3b
commit e658017f76
+6 -1
View File
@@ -81,7 +81,12 @@ class LunchOrder(models.Model):
balance = sum(cashmove.amount for cashmove in prev_cashmove)
if self.total > balance:
raise UserError('%s (%s %s)' % (_('Insufficient balance. The total amount of the order is larger than the available balance'), balance, self.currency_id.name))
return {
'warning': {
'title': _('Insufficient balance'),
'message': ('%s (%s %s)' % (_('The total amount of the order is larger than the available balance'), balance, self.currency_id.name)),
},
}
@api.one
@api.constrains('date')