~camptocamp/c2c-financial-addons/trunk

« back to all changes in this revision

Viewing changes to account_statement_ext/wizard/import_statement.py

  • Committer: Joël Grand-Guillaume
  • Date: 2012-06-11 06:13:37 UTC
  • Revision ID: joel.grandguillaume@camptocamp.com-20120611061337-n1yji5we5subxb70
[MRG] From last dev on customer branch: finaly we override the way the bank statement work instead of having another object. You have now profil on bank statement to configure the generated entries once posted.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# -*- coding: utf-8 -*-
2
2
##############################################################################
3
3
#
4
 
#    Author: Nicolas Bessi
 
4
#    Author: Nicolas Bessi, Joel Grand-Guillaume
5
5
#    Copyright 2011-2012 Camptocamp SA
6
6
#
7
7
#    This program is free software: you can redistribute it and/or modify
34
34
    _description = __doc__
35
35
    _columns = {
36
36
        
37
 
        'import_config_id': fields.many2one('account.treasury.statement.profil',
 
37
        'import_config_id': fields.many2one('account.statement.profil',
38
38
                                      'Import configuration parameter',
39
39
                                      required=True),
40
40
        'partner_id': fields.many2one('res.partner',
57
57
                                                    help="Tic that box if you want to use the credit insitute partner\
58
58
                                                    in the counterpart of the treasury/banking move."
59
59
                                                    ),
 
60
        'balance_check': fields.boolean('Balance check', 
 
61
                                                    help="Tic that box if you want OpenERP to control the start/end balance\
 
62
                                                    before confirming a bank statement. If don't ticked, no balance control will be done."
 
63
                                                    ),
 
64
                                                    
60
65
    }   
61
66
 
62
67
    def onchange_import_config_id(self, cr, uid, ids, import_config_id, context=None):
63
68
        res={}
64
69
        if import_config_id:
65
 
            c = self.pool.get("account.treasury.statement.profil").browse(cr,uid,import_config_id)
 
70
            c = self.pool.get("account.statement.profil").browse(cr,uid,import_config_id)
66
71
            res = {'value': {'partner_id': c.partner_id and c.partner_id.id or False,
67
72
                    'journal_id': c.journal_id and c.journal_id.id or False, 'commission_account_id': \
68
73
                    c.commission_account_id and c.commission_account_id.id or False, 
69
74
                    'receivable_account_id': c.receivable_account_id and c.receivable_account_id.id or False,
70
75
                    'commission_a':c.commission_analytic_id and c.commission_analytic_id.id or False,
71
 
                    'force_partner_on_bank':c.force_partner_on_bank}}
 
76
                    'force_partner_on_bank':c.force_partner_on_bank,
 
77
                    'balance_check':c.balance_check,}}
72
78
        return res
73
79
 
74
80
    def import_statement(self, cursor, uid, req_id, context=None):
82
88
            #We do not use osv exception we do not want to have it logged
83
89
            raise Exception(_('Please use a file with an extention'))
84
90
        sid = self.pool.get(
85
 
                'account.treasury.statement').credit_statement_import(
 
91
                'account.bank.statement').credit_statement_import(
86
92
                                            cursor,
87
93
                                            uid,
88
94
                                            False,