24
24
from osv import osv
25
25
from osv import fields
26
from tools.translate import _
28
27
class account_bank_statement(osv.osv):
29
28
_name = 'account.bank.statement'
30
29
_inherit = 'account.bank.statement'
33
'prev_reg_id': fields.many2one('account.bank.statement', string="Previous register", required=False, readonly=True,
32
'prev_reg_id': fields.many2one('account.bank.statement', string="Previous register", required=False, readonly=True,
34
33
help="This fields give the previous register from which this one is linked."),
35
'next_reg_id': fields.one2many('account.bank.statement', 'prev_reg_id', string="Next register", readonly=True,
34
'next_reg_id': fields.one2many('account.bank.statement', 'prev_reg_id', string="Next register", readonly=True,
36
35
help="This fields give the next register if exists."),
39
38
account_bank_statement()
41
class account_bank_statement_line(osv.osv):
42
_name = 'account.bank.statement.line'
43
_inherit = 'account.bank.statement.line'
45
def create(self, cr, uid, vals, context=None):
47
UTP-317: Check if partner is inactive or not. If inactive, raise an execption to the user.
52
res = super(account_bank_statement_line, self).create(cr, uid, vals, context)
53
# UTP-317: Check partner (if active or not)
55
absl = self.browse(cr, uid, [res], context)
56
# UF-2300: for the case of sync, the line can also be created if the partner is inactive
57
if not context.get('sync_update_execution', False) and absl and absl[0] and absl[0].partner_id and not absl[0].partner_id.active:
58
raise osv.except_osv(_('Warning'), _("Partner '%s' is not active.") % (absl[0].partner_id.name or '',))
62
'ref': fields.char('Reference', size=50), # UF-1613 - add reference field from 32 to 50 chars
63
'invoice_id': fields.many2one('account.invoice', "Invoice", required=False),
66
account_bank_statement_line()
67
39
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: