[REF] cleaning code of account_payment

bzr revid: ara@tinyerp.com-20101011101612-g5kumq1dr7i73bn3
This commit is contained in:
ARA (OpenERP) 2010-10-11 15:46:12 +05:30
parent 5785d49b74
commit 1efa951eff
9 changed files with 30 additions and 30 deletions

View File

@ -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:

View File

@ -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'],

View File

@ -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),
}

View File

@ -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')
}

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@ -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 <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import payment_order
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -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:

View File

@ -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.

View File

@ -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 {}
#

View File

@ -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,