39
by Luc De Meyer
update accounting modules |
1 |
# -*- encoding: utf-8 -*-
|
2 |
##############################################################################
|
|
3 |
#
|
|
4 |
# OpenERP, Open Source Management Solution
|
|
5 |
#
|
|
6 |
# Copyright (c) 2014 Noviat nv/sa (www.noviat.com). All rights reserved.
|
|
7 |
#
|
|
8 |
# This program is free software: you can redistribute it and/or modify
|
|
9 |
# it under the terms of the GNU Affero General Public License as
|
|
10 |
# published by the Free Software Foundation, either version 3 of the
|
|
11 |
# License, or (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 Affero General Public License for more details.
|
|
17 |
#
|
|
18 |
# You should have received a copy of the GNU Affero General Public License
|
|
19 |
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20 |
#
|
|
21 |
##############################################################################
|
|
22 |
||
23 |
from openerp.osv import orm, fields |
|
24 |
from openerp.tools.translate import _ |
|
25 |
import logging |
|
26 |
_logger = logging.getLogger(__name__) |
|
27 |
||
28 |
||
29 |
class account_move(orm.Model): |
|
30 |
_inherit = 'account.move' |
|
31 |
||
32 |
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False): |
|
33 |
#_logger.warn('%s, search, args=%s, context=%s', self._name, args, context)
|
|
34 |
if context is None: |
|
35 |
context = {} |
|
36 |
if context.get('act_window_from_bank_statement_line'): |
|
37 |
absl_id = context.get('active_id') |
|
38 |
st_line = self.pool.get('account.bank.statement.line').browse(cr, uid, absl_id) |
|
39 |
moves = st_line.move_ids |
|
40 |
if moves: |
|
41 |
move_ids = [x.id for x in moves] |
|
42 |
else: |
|
43 |
move_ids = [] |
|
44 |
args.append(('id', 'in', move_ids)) |
|
45 |
#_logger.warn('%s, search, exit args=%s', self._name, args)
|
|
46 |
return super(account_move, self).search(cr, uid, args, offset, limit, order, context, count) |