mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
Reformat modules and fix pep8 errors
This commit is contained in:
committed by
Sandy Carter
parent
151358ba68
commit
b8fc3aad74
@@ -45,11 +45,11 @@ class deposit_ticket(orm.Model):
|
||||
def check_group(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
Check if following security constraints are implemented for groups:
|
||||
Make Deposits Preparer – they can create, view and delete any of the
|
||||
Make Deposits Preparer - they can create, view and delete any of the
|
||||
Deposit Tickets provided the Deposit Ticket is not in the DONE state,
|
||||
|
||||
or the Ready for Review state.
|
||||
Make Deposits Verifier – they can create, view, edit, and delete any of
|
||||
Make Deposits Verifier - they can create, view, edit, and delete any of
|
||||
the Deposits Tickets information at any time.
|
||||
NOTE: DONE Deposit Tickets are only allowed to be deleted by a
|
||||
Make Deposits Verifier.
|
||||
@@ -111,13 +111,15 @@ class deposit_ticket(orm.Model):
|
||||
return True
|
||||
|
||||
def action_process(self, cr, uid, ids, context=None):
|
||||
""" Do the following:
|
||||
"""
|
||||
Do the following:
|
||||
1.The 'Verifier By' field is populated by the name of the Verifier.
|
||||
2.The 'Deposit Ticket #' field is populated.
|
||||
3.The account.move.lines are updated and written with
|
||||
the 'Deposit Ticket #'
|
||||
4.The status field is updated to “Done”
|
||||
5.New GL entries are made."""
|
||||
4.The status field is updated to "Done"
|
||||
5.New GL entries are made.
|
||||
"""
|
||||
move_lines = []
|
||||
for deposit in self.browse(cr, uid, ids, context=context):
|
||||
if not deposit.journal_id.sequence_id:
|
||||
@@ -179,11 +181,13 @@ class deposit_ticket(orm.Model):
|
||||
}
|
||||
|
||||
def remove_all(self, cr, uid, ids, context=None):
|
||||
"""Reset the deposit ticket to draft state,
|
||||
"""
|
||||
Reset the deposit ticket to draft state,
|
||||
and remove the entries associated with the DONE transactions (
|
||||
account moves, updating account.move.lines, resetting preparer
|
||||
and verifier and verified date fields.
|
||||
Reflect all changes necessary."""
|
||||
Reflect all changes necessary.
|
||||
"""
|
||||
account_move_line_obj = self.pool.get('account.move.line')
|
||||
account_move_obj = self.pool.get('account.move')
|
||||
move_line_ids = []
|
||||
@@ -504,8 +508,10 @@ class deposit_ticket_line(orm.Model):
|
||||
)
|
||||
|
||||
def unlink(self, cr, uid, ids, context=None):
|
||||
"""Set the 'draft_assigned' field to False for related account move
|
||||
lines to allow to be entered for another deposit."""
|
||||
"""
|
||||
Set the 'draft_assigned' field to False for related account move
|
||||
lines to allow to be entered for another deposit.
|
||||
"""
|
||||
account_move_line_obj = self.pool.get('account.move.line')
|
||||
move_line_ids = [
|
||||
line.move_line_id.id
|
||||
|
||||
@@ -23,6 +23,9 @@ from openerp.osv import orm, fields
|
||||
|
||||
|
||||
class account_move_line(orm.Model):
|
||||
|
||||
"""Account move line."""
|
||||
|
||||
_inherit = 'account.move.line'
|
||||
_columns = {
|
||||
'draft_assigned': fields.boolean(
|
||||
|
||||
@@ -29,7 +29,6 @@ from openerp.report import report_sxw
|
||||
import openerp.addons.decimal_precision as dp
|
||||
|
||||
|
||||
|
||||
class bank_acc_rec_statement(orm.Model):
|
||||
|
||||
"""Bank account rec statement."""
|
||||
@@ -38,11 +37,11 @@ class bank_acc_rec_statement(orm.Model):
|
||||
"""
|
||||
Check if following security constraints are implemented for groups.
|
||||
|
||||
Bank Statement Preparer – they can create, view and delete any of
|
||||
Bank Statement Preparer - they can create, view and delete any of
|
||||
the Bank Statements provided the Bank Statement is not in the DONE
|
||||
state, or the Ready for Review state.
|
||||
|
||||
Bank Statement Verifier – they can create, view, edit, and delete any
|
||||
Bank Statement Verifier - they can create, view, edit, and delete any
|
||||
of the Bank Statements information at any time.
|
||||
|
||||
NOTE: DONE Bank Statements are only allowed to be deleted by a Bank
|
||||
@@ -94,7 +93,9 @@ class bank_acc_rec_statement(orm.Model):
|
||||
cr, uid, [],
|
||||
vals["exchange_date"], vals["account_id"],
|
||||
context=context)['value'])
|
||||
return super(bank_acc_rec_statement, self).create(cr, uid, vals, context=context)
|
||||
|
||||
base_func = super(bank_acc_rec_statement, self).create
|
||||
return base_func(cr, uid, vals, context=context)
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
# Check if the user is allowed to perform the action
|
||||
@@ -365,16 +366,17 @@ class bank_acc_rec_statement(orm.Model):
|
||||
return True
|
||||
|
||||
def _get_balance(self, cr, uid, ids, field_names, args, context=None):
|
||||
"""Computed as following:
|
||||
"""
|
||||
Computed as following:
|
||||
A) Deposits, Credits, and Interest Amount:
|
||||
Total SUM of Amts of lines with Cleared = True
|
||||
Deposits, Credits, and Interest # of Items:
|
||||
Total of number of lines with Cleared = True
|
||||
B) Checks, Withdrawals, Debits, and Service Charges Amount:
|
||||
Checks, Withdrawals, Debits, and Service Charges Amount # of Items:
|
||||
Cleared Balance (Total Sum of the Deposit Amount Cleared (A) –
|
||||
Cleared Balance (Total Sum of the Deposit Amount Cleared (A) -
|
||||
Total Sum of Checks Amount Cleared (B))
|
||||
Difference= (Ending Balance – Beginning Balance) -
|
||||
Difference= (Ending Balance - Beginning Balance) -
|
||||
cleared balance = should be zero.
|
||||
"""
|
||||
res = {}
|
||||
@@ -382,7 +384,7 @@ class bank_acc_rec_statement(orm.Model):
|
||||
cr, uid, 'Account'
|
||||
)
|
||||
for statement in self.browse(cr, uid, ids, context=context):
|
||||
currency_id = statement.company_id.currency_id.id
|
||||
|
||||
res[statement.id] = sres = {
|
||||
'sum_of_credits': 0.0,
|
||||
'sum_of_credits_in_currency': 0.0,
|
||||
@@ -672,7 +674,7 @@ class bank_acc_rec_statement(orm.Model):
|
||||
def _get_currency_help_label(self, cr, uid, currency_id, payment_rate,
|
||||
payment_rate_currency_id, context=None):
|
||||
"""
|
||||
This function builds a string to help the users to understand the
|
||||
The function builds a string to help the users to understand the
|
||||
behavior of the payment rate fields they can specify on the voucher.
|
||||
This string is only used to improve the usability in the voucher form
|
||||
view and has no other effect.
|
||||
@@ -681,9 +683,11 @@ class bank_acc_rec_statement(orm.Model):
|
||||
:type currency_id: integer
|
||||
:param payment_rate: the value of the payment_rate field of the voucher
|
||||
:type payment_rate: float
|
||||
:param payment_rate_currency_id: the value of the payment_rate_currency_id field of the voucher
|
||||
:param payment_rate_currency_id: the value of the
|
||||
payment_rate_currency_id field of the voucher
|
||||
:type payment_rate_currency_id: integer
|
||||
:return: translated string giving a tip on what's the effect of the current payment rate specified
|
||||
:return: translated string giving a tip on what's the effect of
|
||||
the current payment rate specified
|
||||
:rtype: str
|
||||
"""
|
||||
rml_parser = report_sxw.rml_parse(cr, uid, 'currency_help_label',
|
||||
@@ -693,14 +697,17 @@ class bank_acc_rec_statement(orm.Model):
|
||||
if currency_id:
|
||||
currency_str = rml_parser.formatLang(
|
||||
1,
|
||||
currency_obj=currency_pool.browse(cr, uid, currency_id,
|
||||
context=context))
|
||||
currency_obj=currency_pool.browse(
|
||||
cr, uid, currency_id, context=context
|
||||
)
|
||||
)
|
||||
if payment_rate_currency_id:
|
||||
payment_rate_str = rml_parser.formatLang(
|
||||
payment_rate_str = rml_parser.formatLang(
|
||||
payment_rate,
|
||||
currency_obj=currency_pool.browse(cr, uid,
|
||||
payment_rate_currency_id,
|
||||
context=context))
|
||||
currency_obj=currency_pool.browse(
|
||||
cr, uid, payment_rate_currency_id, context=context
|
||||
)
|
||||
)
|
||||
currency_help_label = _(
|
||||
'At the starting date, the exchange rate was\n%s = %s'
|
||||
) % (currency_str, payment_rate_str)
|
||||
@@ -709,10 +716,12 @@ class bank_acc_rec_statement(orm.Model):
|
||||
def onchange_currency_rate(self, cr, uid, ids, exchange_rate,
|
||||
start_balance, end_balance, context=None):
|
||||
if exchange_rate:
|
||||
return {'value':{
|
||||
'starting_balance': (start_balance or 0) * exchange_rate,
|
||||
'ending_balance': (end_balance or 0) * exchange_rate,
|
||||
}}
|
||||
return {
|
||||
'value': {
|
||||
'starting_balance': (start_balance or 0) * exchange_rate,
|
||||
'ending_balance': (end_balance or 0) * exchange_rate,
|
||||
}
|
||||
}
|
||||
else:
|
||||
return {}
|
||||
|
||||
@@ -774,7 +783,7 @@ class bank_acc_rec_statement(orm.Model):
|
||||
'exchange_date': fields.date(
|
||||
'Currency Exchange Date',
|
||||
required=False,
|
||||
states={'done':[('readonly', True)]},
|
||||
states={'done': [('readonly', True)]},
|
||||
help="The starting date of your bank statement.",
|
||||
),
|
||||
'ending_date': fields.date(
|
||||
@@ -796,7 +805,7 @@ class bank_acc_rec_statement(orm.Model):
|
||||
required=True,
|
||||
digits_compute=dp.get_precision('Account'),
|
||||
help="The Account Starting Balance on your bank statement",
|
||||
states={'done':[('readonly', True)]},
|
||||
states={'done': [('readonly', True)]},
|
||||
),
|
||||
'ending_balance': fields.float(
|
||||
'Ending Balance',
|
||||
@@ -811,7 +820,7 @@ class bank_acc_rec_statement(orm.Model):
|
||||
required=True,
|
||||
digits_compute=dp.get_precision('Account'),
|
||||
help="The Ending Balance on your bank statement.",
|
||||
states={'done':[('readonly', True)]}
|
||||
states={'done': [('readonly', True)]}
|
||||
),
|
||||
'company_id': fields.many2one(
|
||||
'res.company',
|
||||
@@ -1021,7 +1030,10 @@ class bank_acc_rec_statement(orm.Model):
|
||||
_get_balance,
|
||||
method=True,
|
||||
type='float',
|
||||
string='Checks, Withdrawals, Debits, and Service Charges # of Items',
|
||||
string=(
|
||||
'Checks, Withdrawals, Debits, and Service Charges # of '
|
||||
'Items'
|
||||
),
|
||||
help="Total of number of lines with Cleared = False",
|
||||
multi="balance",
|
||||
),
|
||||
|
||||
@@ -92,6 +92,8 @@ class test_bank_reconciliation(common.TransactionCase):
|
||||
self.reconcile.refresh()
|
||||
|
||||
def test_one_reconcile_line_per_move_line(self):
|
||||
"""Test that one line of reconciliation is created for
|
||||
each account move for the account"""
|
||||
"""
|
||||
Test that one line of reconciliation is created for
|
||||
each account move for the account
|
||||
"""
|
||||
self.assertEqual(len(self.reconcile.credit_move_line_ids), 3)
|
||||
|
||||
Reference in New Issue
Block a user