From 1efa951effb07b835f2a6a0727535caa0cea935b Mon Sep 17 00:00:00 2001 From: "ARA (OpenERP)" Date: Mon, 11 Oct 2010 15:46:12 +0530 Subject: [PATCH] [REF] cleaning code of account_payment bzr revid: ara@tinyerp.com-20101011101612-g5kumq1dr7i73bn3 --- addons/account_payment/__init__.py | 2 +- addons/account_payment/__openerp__.py | 6 ++--- addons/account_payment/account_move_line.py | 22 +++++++++---------- addons/account_payment/account_payment.py | 2 +- addons/account_payment/report/__init__.py | 6 ++--- .../account_payment/report/payment_order.py | 12 +++++----- .../wizard/account_payment_order.py | 2 +- .../wizard/account_payment_pay.py | 2 +- .../account_payment_populate_statement.py | 6 ++--- 9 files changed, 30 insertions(+), 30 deletions(-) diff --git a/addons/account_payment/__init__.py b/addons/account_payment/__init__.py index 82a05aa73e9..6188de6a9da 100644 --- a/addons/account_payment/__init__.py +++ b/addons/account_payment/__init__.py @@ -29,4 +29,4 @@ import account_move_line import account_invoice import report -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/account_payment/__openerp__.py b/addons/account_payment/__openerp__.py index be0ca2a127b..7ccafd90eb4 100644 --- a/addons/account_payment/__openerp__.py +++ b/addons/account_payment/__openerp__.py @@ -28,9 +28,9 @@ "depends": ["account"], "init_xml": [], "description": """ - This module provides : - * a more efficient way to manage invoice payment. - * a basic mechanism to easily plug various automated payment. +This module provides : +* a more efficient way to manage invoice payment. +* a basic mechanism to easily plug various automated payment. """, 'author': 'OpenERP SA', 'depends': ['account_voucher'], diff --git a/addons/account_payment/account_move_line.py b/addons/account_payment/account_move_line.py index 3f9b6c4b094..2b9ea22d824 100644 --- a/addons/account_payment/account_move_line.py +++ b/addons/account_payment/account_move_line.py @@ -47,7 +47,7 @@ class account_move_line(osv.osv): return r def _to_pay_search(self, cr, uid, obj, name, args, context): - if not len(args): + if not args: return [] line_obj = self.pool.get('account.move.line') query = line_obj._query_get(cr, uid, context={}) @@ -63,17 +63,17 @@ class account_move_line(osv.osv): ) %(operator)s %%s ''' % {'operator': x[1]}, args)) sql_args = tuple(map(itemgetter(2), args)) - cr.execute(('''select id - from account_move_line l - where account_id in (select id - from account_account - where type=%s and active) - and reconcile_id is null - and credit > 0 - and ''' + where + ' and ' + query), ('payable',)+sql_args ) + cr.execute(('''SELECT id + FROM account_move_line l + WHERE account_id IN (select id + FROM account_account + WHERE type=%s AND active) + AND reconcile_id IS null + AND credit > 0 + AND ''' + where + ' and ' + query), ('payable',)+sql_args ) res = cr.fetchall() - if not len(res): + if not res: return [('id','=','0')] return [('id','in',map(lambda x:x[0], res))] @@ -110,7 +110,7 @@ class account_move_line(osv.osv): return line2bank _columns = { - 'amount_to_pay' : fields.function(amount_to_pay, method=True, + 'amount_to_pay': fields.function(amount_to_pay, method=True, type='float', string='Amount to pay', fnct_search=_to_pay_search), } diff --git a/addons/account_payment/account_payment.py b/addons/account_payment/account_payment.py index 1c0596ddf96..e4a121fb03e 100644 --- a/addons/account_payment/account_payment.py +++ b/addons/account_payment/account_payment.py @@ -330,7 +330,7 @@ class payment_line(osv.osv): 'info_owner': fields.function(info_owner, string="Owner Account", method=True, type="text", help='Address of the Main Partner'), 'info_partner': fields.function(info_partner, string="Destination Account", method=True, type="text", help='Address of the Ordering Customer.'), 'date': fields.date('Payment Date', help="If no payment date is specified, the bank will treat this payment line directly"), - 'create_date': fields.datetime('Created' , readonly=True), + 'create_date': fields.datetime('Created', readonly=True), 'state': fields.selection([('normal','Free'), ('structured','Structured')], 'Communication Type', required=True), 'bank_statement_line_id': fields.many2one('account.bank.statement.line', 'Bank statement line') } diff --git a/addons/account_payment/report/__init__.py b/addons/account_payment/report/__init__.py index 5a5c1dab1f2..e9d7f4013ac 100644 --- a/addons/account_payment/report/__init__.py +++ b/addons/account_payment/report/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (). # @@ -15,9 +15,9 @@ # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . +# along with this program. If not, see . # ############################################################################## import payment_order -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/account_payment/report/payment_order.py b/addons/account_payment/report/payment_order.py index a00c7a7871b..e0b0713c614 100644 --- a/addons/account_payment/report/payment_order.py +++ b/addons/account_payment/report/payment_order.py @@ -31,11 +31,11 @@ class payment_order(report_sxw.rml_parse): self.localcontext.update( { 'time': time, 'get_invoice_name': self._get_invoice_name, - 'get_company_currency' : self._get_company_currency, - 'get_company_currency_symbol': self._get_company_currency_symbol, - 'get_amount_total_in_currency' : self._get_amount_total_in_currency, - 'get_amount_total' : self._get_amount_total, - 'get_account_name' : self._get_account_name, + 'get_company_currency': self._get_company_currency, + 'get_company_currency_symbol': self._get_company_currency_symbol, + 'get_amount_total_in_currency': self._get_amount_total_in_currency, + 'get_amount_total': self._get_amount_total, + 'get_account_name': self._get_account_name, }) def _get_invoice_name(self, invoice_id): @@ -87,4 +87,4 @@ class payment_order(report_sxw.rml_parse): report_sxw.report_sxw('report.payment.order', 'payment.order', 'addons/account_payment/report/payment_order.rml', parser=payment_order, header="external") -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/account_payment/wizard/account_payment_order.py b/addons/account_payment/wizard/account_payment_order.py index 97a66e937ca..4a070f05a27 100644 --- a/addons/account_payment/wizard/account_payment_order.py +++ b/addons/account_payment/wizard/account_payment_order.py @@ -28,7 +28,7 @@ class payment_order_create(osv.osv_memory): Create a payment object with lines corresponding to the account move line to pay according to the date and the mode provided by the user. Hypothesis: - - Small number of non-reconcilied move line , payment mode and bank account type, + - Small number of non-reconcilied move line, payment mode and bank account type, - Big number of partner and bank account. If a type is given, unsuitable account Entry lines are ignored. diff --git a/addons/account_payment/wizard/account_payment_pay.py b/addons/account_payment/wizard/account_payment_pay.py index 49858151670..132ab33af2c 100644 --- a/addons/account_payment/wizard/account_payment_pay.py +++ b/addons/account_payment/wizard/account_payment_pay.py @@ -36,7 +36,7 @@ class account_payment_make_payment(osv.osv_memory): obj_payment_order.set_done(cr, uid, context['active_id'], context) return {} # t = order.mode and order.mode.type.code or 'manual' -# if t == 'manual' : +# if t == 'manual': # obj_payment_order.set_done(cr,uid,context['active_id'],context) # return {} # diff --git a/addons/account_payment/wizard/account_payment_populate_statement.py b/addons/account_payment/wizard/account_payment_populate_statement.py index 53c9f14b6e8..7697d4eea6d 100644 --- a/addons/account_payment/wizard/account_payment_populate_statement.py +++ b/addons/account_payment/wizard/account_payment_populate_statement.py @@ -77,13 +77,13 @@ class account_payment_populate_statement(osv.osv_memory): if line.partner_id: # line['partner_id'] = mv.partner_id.id - if amount < 0 : + if amount < 0: account = line.partner_id.property_account_payable.id - else : + else: account = line.partner_id.property_account_receivable.id if line.move_line_id: - voucher_res = { 'type': 'payment' , + voucher_res = { 'type': 'payment', 'name': line.name, 'partner_id': line.partner_id.id, 'journal_id': statement.journal_id.id,