~unifield-team/unifield-wm/us-826

« back to all changes in this revision

Viewing changes to account_override/account_bank_statement.py

  • Committer: matthieu.choplin at msf
  • Date: 2012-08-30 07:48:00 UTC
  • mto: This revision was merged to the branch mainline in revision 1118.
  • Revision ID: matthieu.choplin@geneva.msf.org-20120830074800-l442bu42mt0yzutn
[uf-1374]- change the write and create by an _sql_constraint on the financing contract check dates

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
from osv import osv
25
25
from osv import fields
26
 
from tools.translate import _
27
26
 
28
27
class account_bank_statement(osv.osv):
29
28
    _name = 'account.bank.statement'
30
29
    _inherit = 'account.bank.statement'
31
30
 
32
31
    _columns = {
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."),
37
36
    }
38
37
 
39
38
account_bank_statement()
40
 
 
41
 
class account_bank_statement_line(osv.osv):
42
 
    _name = 'account.bank.statement.line'
43
 
    _inherit = 'account.bank.statement.line'
44
 
 
45
 
    def create(self, cr, uid, vals, context=None):
46
 
        """
47
 
        UTP-317: Check if partner is inactive or not. If inactive, raise an execption to the user.
48
 
        """
49
 
        # Some verification
50
 
        if not context:
51
 
            context = {}
52
 
        res = super(account_bank_statement_line, self).create(cr, uid, vals, context)
53
 
        # UTP-317: Check partner (if active or not)
54
 
        if res:
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 '',))
59
 
        return res
60
 
 
61
 
    _columns = {
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),
64
 
    }
65
 
 
66
 
account_bank_statement_line()
67
39
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: