~vauxoo/addons-vauxoo/6.0-trunk

« back to all changes in this revision

Viewing changes to account_bank_statement_vauxoo/model/account_invoice.py

  • Committer: moylop260
  • Date: 2012-09-08 02:03:25 UTC
  • Revision ID: moylop260@vauxoo.com-20120908020325-h5yurx5rqkc1ml6w
[ADD] [account_analytic_btree] Add module account_analytic_btree

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- encoding: utf-8 -*-
 
2
##############################################################################
 
3
#
 
4
#    OpenERP, Open Source Management Solution    
 
5
#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
 
6
#    d$
 
7
#
 
8
#    This program is free software: you can redistribute it and/or modify
 
9
#    it under the terms of the GNU General Public License as published by
 
10
#    the Free Software Foundation, either version 3 of the License, or
 
11
#    (at your option) any later version.
 
12
#
 
13
#    This program is distributed in the hope that it will be useful,
 
14
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
#    GNU General Public License for more details.
 
17
#
 
18
#    You should have received a copy of the GNU General Public License
 
19
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
20
#
 
21
##############################################################################
 
22
 
 
23
from osv import osv
 
24
from osv import fields
 
25
 
 
26
class account_invoice(osv.osv):
 
27
    """
 
28
    account_invoice
 
29
    """
 
30
    _inherit = 'account.invoice'
 
31
    _columns = {
 
32
    'bank_statement_line_ids':fields.many2many('bank.statement.imported.lines','bs_invoice_rel','invoice_id','st_id_id','Invoices',
 
33
            help="Invoices to be reconciled with this line",
 
34
            ),#TODO: Resolve: We should use date as filter, is a question of POV
 
35
    }
 
36
    
 
37
    def button_reconcile_bsl(self, cr, uid, ids, context=None):
 
38
        if context is None:
 
39
            context={}
 
40
        res=[]
 
41
        bsl_obj = self.pool.get('bank.statement.imported.lines')
 
42
        bsl_ids = self.browse(cr,uid,ids,context=context)[0].bank_statement_line_ids
 
43
        
 
44
        res = [bsl_id.id for bsl_id in bsl_ids]
 
45
        bsl_obj.button_setinvoice(cr, uid, res, context=context)
 
46
        return True
 
47
        
 
48
    def button_unreconcile_bsl(self, cr, uid, ids, context=None):
 
49
        if context is None:
 
50
            context={}
 
51
        res=[]
 
52
        bsl_obj = self.pool.get('bank.statement.imported.lines')
 
53
        bsl_ids = self.browse(cr,uid,ids,context=context)[0].bank_statement_line_ids
 
54
        
 
55
        res = [bsl_id.id for bsl_id in bsl_ids]
 
56
        bsl_obj.button_cancel(cr, uid, res, context=context)
 
57
        return True
 
58
 
 
59
account_invoice()