[REF] account_id is not anymore mandatory for creating a bank statement line. Still mandatory for the validation

This commit is contained in:
Sebastien Beau
2013-12-04 14:53:03 +01:00
parent e33044d520
commit 33dc39874b
3 changed files with 44 additions and 6 deletions

View File

@@ -382,6 +382,23 @@ class AccountStatementCompletionRule(orm.Model):
res.update(st_vals)
return res
class AccountStatement(orm.Model):
_inherit = "account.bank.statement"
def button_confirm_bank(self, cr, uid, ids, context=None):
line_obj = self.pool['account.bank.statement.line']
for stat_id in ids:
line_without_account = line_obj.search(cr, uid, [
['statement_id', '=', stat_id],
['account_id', '=', False],
], context=context)
if line_without_account:
stat = self.browse(cr, uid, stat_id, context=context)
raise osv.except_osv(_('User error'),
_('You should fill all account on the line of the'
' statement %s')%stat.name)
return super(AccountStatement, self).button_confirm_bank(cr, uid, ids, context=context)
class AccountStatementLine(orm.Model):
"""
@@ -393,6 +410,7 @@ class AccountStatementLine(orm.Model):
module to see how we've done it.
"""
_inherit = "account.bank.statement.line"
_order = "already_completed desc, date asc"
_columns = {
'additionnal_bank_fields': fields.serialized(