1
# -*- encoding: utf-8 -*-
2
##############################################################################
4
# Copyright (c) 2010 Latinux Inc (http://www.latinux.com/) All Rights Reserved.
5
# Javier Duran <jduran@corvus.com.ve>
8
# WARNING: This program as such is intended to be used by professional
9
# programmers who take the whole responsability of assessing all potential
10
# consequences resulting from its eventual inadequacies and bugs
11
# End users who are looking for a ready-to-use solution with commercial
12
# garantees and support are strongly adviced to contract a Free Software
15
# This program is Free Software; you can redistribute it and/or
16
# modify it under the terms of the GNU General Public License
17
# as published by the Free Software Foundation; either version 2
18
# of the License, or (at your option) any later version.
20
# This program is distributed in the hope that it will be useful,
21
# but WITHOUT ANY WARRANTY; without even the implied warranty of
22
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
# GNU General Public License for more details.
25
# You should have received a copy of the GNU General Public License
26
# along with this program; if not, write to the Free Software
27
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29
##############################################################################
31
from openerp.osv import osv, fields
34
class account_move_line(osv.Model):
35
_inherit = 'account.move.line'
36
_description = "Entry lines"
38
def find(self, cr, uid, **kwargs):
43
if kwargs.get('dt', False):
46
cond_str += 'aml.date=%s'
47
cond_val.append(kwargs['dt'])
48
if kwargs.get('acc_id', False):
51
cond_str += 'aml.account_id=%s'
52
cond_val.append(kwargs['acc_id'])
53
if kwargs.get('prd_id', False):
56
cond_str += 'aml.product_id=%s'
57
cond_val.append(kwargs['prd_id'])
58
if kwargs.get('mov_id', False):
61
cond_str += 'aml.move_id=%s'
62
cond_val.append(kwargs['mov_id'])
63
if kwargs.get('per_id', False):
66
cond_str += 'aml.period_id=%s'
67
cond_val.append(kwargs['per_id'])
68
if kwargs.get('jou_id', False):
71
cond_str += 'aml.journal_id=%s'
72
cond_val.append(kwargs['jou_id'])
73
if kwargs.get('par_id', False):
76
cond_str += 'aml.partner_id=%s'
77
cond_val.append(kwargs['par_id'])
78
if kwargs.get('cur_id', False):
81
cond_str += 'aml.currency_id=%s'
82
cond_val.append(kwargs['cur_id'])
83
if kwargs.get('qty', False):
86
cond_str += 'aml.quantity=%s'
87
cond_val.append(kwargs['qty'])
88
if kwargs.get('name', False):
91
cond_str += 'aml.name=%s'
92
cond_val.append(kwargs['name'])
93
if kwargs.get('ref', False):
96
cond_str += 'aml.ref=%s'
97
cond_val.append(kwargs['ref'])
98
if kwargs.get('debit', False):
101
cond_str += 'aml.debit=%s'
102
cond_val.append(kwargs['debit'])
103
if kwargs.get('credit', False):
106
cond_str += 'aml.credit=%s'
107
cond_val.append(kwargs['credit'])
110
cond_str = ' WHERE ' + cond_str
112
# print 'xxxxcondicion: ',cond_str
114
sql = 'SELECT aml.id FROM account_move_line aml' + \
115
cond_str % tuple(cond_val)
116
# print 'xxxxsql: ',sql
118
res = map(lambda x: x[0], cr.fetchall())