PEP8 fix for module account_banking_make_deposit

This commit is contained in:
Loïc Faure-Lacroix
2015-03-17 19:24:31 +03:00
committed by Sandy Carter
parent 5cd18db073
commit 9b644e0f93
6 changed files with 210 additions and 80 deletions

View File

@@ -22,18 +22,43 @@
{
'name': 'Bank Deposit Ticket',
'description': '''
This module supports the functionality to prepare and record Bank Deposit Tickets, often found in check centric markets like the US. It allows users to select various customer payments and receipts and bundle them into a Deposit Ticket. This would be used to support the following activities: Depositing multiple Checks into your bank account under one deposit ticket, and Deposit Checks and Cash into your bank account from multiple customer receipts or payments. This module can be used for any “bank transaction” centric process including: Paypal, Bank Accounts, and even credit cards which tend to deposit funds by bundled transactions versus individual checks. By combining payments and receipts into deposit tickets, and using this module to manage the general ledger entries, it will streamline the bank account statement reconciliation process (defined as: comparing your bank account transactions versus the recorded transactions in OpenERP for audit and financial control purposes).
This module supports the functionality to prepare and record Bank Deposit
Tickets, often found in check centric markets like the US. It allows users
to select various customer payments and receipts and bundle them into a
Deposit Ticket. This would be used to support the following activities:
Depositing multiple Checks into your bank account under one deposit ticket,
and Deposit Checks and Cash into your bank account from multiple customer
receipts or payments. This module can be used for any “bank transaction”
centric process including: Paypal, Bank Accounts, and even credit cards
which tend to deposit funds by bundled transactions versus individual
checks. By combining payments and receipts into deposit tickets, and using
this module to manage the general ledger entries, it will streamline the bank
account statement reconciliation process (defined as: comparing your bank
account transactions versus the recorded transactions in OpenERP for audit
and financial control purposes).
This module also tracks who prepared the Deposit Ticket, and the user who verified the deposit ticket. In addition to the following: Method of Deposit (e.g. ATM, Night Drop, Teller, Remote Deposit Capture, Online Deposit Capture); Bank Tracking number (e.g. TLR#3 BC#47331 REF#94849303938); Date of Deposit, Deposit Bag #, etc.
This module also tracks who prepared the Deposit Ticket, and the user who
verified the deposit ticket. In addition to the following: Method of
Deposit (e.g. ATM, Night Drop, Teller, Remote Deposit Capture, Online
Deposit Capture); Bank Tracking number (e.g. TLR#3 BC#47331 REF#94849303938)
; Date of Deposit, Deposit Bag #, etc.
We recommend users add to their GL Chart of Accounts a new Other Current Account named Undeposited Funds, as well as a new journal to post payments to with the Undeposited Funds on the debit side of the transaction.
We recommend users add to their GL Chart of Accounts a new Other Current
Account named Undeposited Funds, as well as a new journal to post payments
to with the Undeposited Funds on the debit side of the transaction.
Future enhancements will also include the ability to track deposits NOT using the Undeposited Funds GL account.
Future enhancements will also include the ability to track deposits NOT
using the Undeposited Funds GL account.
Why is this module needed? OpenERP by default is designed for more electronic transaction management driven by its heritage in Europe when EFT (electronic) transactions are more readily used versus Check centric transactions. In electronic transaction management bundled deposits dont typically occur as payment transactions typically are displayed individual on statements.
This module is seen as a prerequisite to support efficient Bank Account Statement Reconciliation found in the US and other countries.
Why is this module needed? OpenERP by default is designed for more
electronic transaction management driven by its heritage in Europe
when EFT (electronic) transactions are more readily used versus Check
centric transactions. In electronic transaction management bundled
deposits dont typically occur as payment transactions typically are
displayed individual on statements.
This module is seen as a prerequisite to support efficient Bank Account
Statement Reconciliation found in the US and other countries.
''',
'category': 'Generic Modules/Accounting',
'version': '1.4',
@@ -55,5 +80,5 @@ This module is seen as a prerequisite to support efficient Bank Account Statemen
'test': [],
'active': False,
'installable': True,
'certificate':''
'certificate': ''
}

View File

@@ -21,12 +21,22 @@
##############################################################################
from osv import osv, fields
class account_move_line(osv.osv):
_inherit = 'account.move.line'
_columns = {
'draft_assigned': fields.boolean('Draft Assigned', help="This field is checked when the move line is assigned to a draft deposit ticket.\
The deposit ticket is not still completely processed"),
'deposit_id': fields.many2one('deposit.ticket', 'Deposit Ticket')
'draft_assigned': fields.boolean(
'Draft Assigned',
help=(
"This field is checked when the move line is assigned "
"to a draft deposit ticket. The deposit ticket is not "
"still completely processed"
),
),
'deposit_id': fields.many2one(
'deposit.ticket',
'Deposit Ticket'
)
}
account_move_line()

View File

@@ -19,7 +19,4 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>
#
##############################################################################
import deposit_ticket
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@@ -24,19 +24,23 @@ import time
from report import report_sxw
from osv import osv
#Enter Report Class Information Here
# Enter Report Class Information Here
class deposit_ticket_webkit(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(deposit_ticket_webkit, self).__init__(cr, uid, name, context=context)
super(deposit_ticket_webkit, self).__init__(
cr, uid, name, context=context
)
self.localcontext.update({
'time': time,
'cr':cr,
'cr': cr,
'uid': uid,
})
report_sxw.report_sxw('report.deposit.ticket.webkit',
'deposit.ticket',
'addons/deposit_ticket_report_webkit/report/deposit_ticket.mako',
parser=deposit_ticket_webkit)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
report_sxw.report_sxw(
'report.deposit.ticket.webkit',
'deposit.ticket',
'addons/deposit_ticket_report_webkit/report/deposit_ticket.mako',
parser=deposit_ticket_webkit
)

View File

@@ -20,5 +20,3 @@
#
##############################################################################
import add_deposit_items
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@@ -23,12 +23,20 @@ from osv import fields, osv
from tools.translate import _
import decimal_precision as dp
class add_deposit_items(osv.osv_memory):
_name = "add.deposit.items"
_description = "Add Deposit Items"
_columns = {
'name': fields.char('Name', size=64),
'deposit_items_line_ids': fields.one2many('deposit.items.line', 'deposit_items_id', 'Lines')
'name': fields.char(
'Name',
size=64
),
'deposit_items_line_ids': fields.one2many(
'deposit.items.line',
'deposit_items_id',
'Lines'
),
}
def default_get(self, cr, uid, fields, context=None):
@@ -36,31 +44,51 @@ class add_deposit_items(osv.osv_memory):
account_move_line_obj = self.pool.get('account.move.line')
account_move = self.pool.get('account.move')
result = []
res = super(add_deposit_items, self).default_get(cr, uid, fields, context=context)
for deposit in deposit_ticket_obj.browse(cr, uid, context.get('active_ids', []), context=context):
res = super(add_deposit_items, self).default_get(
cr, uid, fields, context=context
)
deposits = deposit_ticket_obj.browse(
cr, uid, context.get('active_ids', []), context=context
)
for deposit in deposits:
# Filter all the move lines which are:
#1.Account.move.lines that are a member of the Deposit From GL Account and are Debits
#2.State of the move_id == Posted
#3.The Deposit Ticket # value is blank (null) not assigned
#4.The account move line is not a member of another Draft/To Be Review (this is the list (one2many) of
#debit transactions displayed on the selected Account (Undeposited Funds Acct) including this account.
move_ids = account_move.search(cr, uid, [('state', '=', 'posted')], context=context)
line_ids = account_move_line_obj.search(cr, uid, [('account_id', '=', deposit.deposit_from_account_id.id),
('debit', '>', 0.0),
('move_id', 'in', move_ids),
('draft_assigned', '=', False),
('deposit_id', '=', False)
],
context=context)
for line in account_move_line_obj.browse(cr, uid, line_ids, context=context):
result.append({'name': line.name,
'ref': line.ref,
'amount': line.debit,
'partner_id': line.partner_id.id,
'date': line.date,
'move_line_id': line.id,
'company_id':line.company_id.id
})
# 1. Account.move.lines that are a member of the Deposit From
# GL Account and are Debits
# 2. State of the move_id == Posted
# 3. The Deposit Ticket # value is blank (null) not assigned
# 4. The account move line is not a member of another Draft/To Be
# Review (this is the list (one2many) of
#
# debit transactions displayed on the selected Account (Undeposited
# Funds Acct) including this account.
move_ids = account_move.search(
cr, uid, [('state', '=', 'posted')], context=context
)
line_ids = account_move_line_obj.search(
cr, uid,
[
('account_id', '=', deposit.deposit_from_account_id.id),
('debit', '>', 0.0),
('move_id', 'in', move_ids),
('draft_assigned', '=', False),
('deposit_id', '=', False)
],
context=context
)
lines = account_move_line_obj.browse(
cr, uid, line_ids, context=context
)
for line in lines:
result.append({
'name': line.name,
'ref': line.ref,
'amount': line.debit,
'partner_id': line.partner_id.id,
'date': line.date,
'move_line_id': line.id,
'company_id': line.company_id.id
})
if 'deposit_items_line_ids' in fields:
res.update({'deposit_items_line_ids': result})
return res
@@ -69,16 +97,32 @@ class add_deposit_items(osv.osv_memory):
"""Select all the deposit item lines in the wizard."""
deposit_items_line_obj = self.pool.get('deposit.items.line')
deposit_ticket_item = self.browse(cr, uid, ids[0], context=context)
line_ids = deposit_items_line_obj.search(cr, uid, [('deposit_items_id', '=', deposit_ticket_item.id)], context=context)
deposit_items_line_obj.write(cr, uid, line_ids, {'draft_assigned': True}, context=context)
line_ids = deposit_items_line_obj.search(
cr, uid,
[
('deposit_items_id', '=', deposit_ticket_item.id)
],
context=context
)
deposit_items_line_obj.write(
cr, uid, line_ids, {'draft_assigned': True}, context=context
)
return True
def unselect_all(self, cr, uid, ids, context=None):
"""Unselect all the deposit item lines in the wizard."""
deposit_items_line_obj = self.pool.get('deposit.items.line')
deposit_ticket_item = self.browse(cr, uid, ids[0], context=context)
line_ids = deposit_items_line_obj.search(cr, uid, [('deposit_items_id', '=', deposit_ticket_item.id)], context=context)
deposit_items_line_obj.write(cr, uid, line_ids, {'draft_assigned': False}, context=context)
line_ids = deposit_items_line_obj.search(
cr, uid,
[
('deposit_items_id', '=', deposit_ticket_item.id)
],
context=context
)
deposit_items_line_obj.write(
cr, uid, line_ids, {'draft_assigned': False}, context=context
)
return True
def add_deposit_lines(self, cr, uid, ids, context=None):
@@ -87,45 +131,97 @@ class add_deposit_items(osv.osv_memory):
account_move_line_obj = self.pool.get('account.move.line')
deposit_ticket_line_obj = self.pool.get('deposit.ticket.line')
deposit_ticket_item = self.browse(cr, uid, ids[0], context=context)
for deposit in deposit_ticket_obj.browse(cr, uid, context.get('active_ids', []), context=context):
# Add the deposit ticket item lines which have 'draft_assigned' checked
valid_items_line_ids = [line for line in deposit_ticket_item.deposit_items_line_ids if line.draft_assigned]
deposits = deposit_ticket_obj.browse(
cr, uid, context.get('active_ids', []), context=context
)
for deposit in deposits:
# Add the deposit ticket item lines which have
# 'draft_assigned' checked
valid_items_line_ids = [
line
for line in deposit_ticket_item.deposit_items_line_ids
if line.draft_assigned
]
move_line_ids = []
for line in valid_items_line_ids:
# Any Line cannot be manually added. Choose only from the selected lines.
# Any Line cannot be manually added.
# Choose only from the selected lines.
if not line.move_line_id:
raise osv.except_osv(_('Processing Error'),\
_ ('You cannot add any new deposit line item manually as of this revision!'))
res_id = deposit_ticket_line_obj.create(cr, uid, {'name': line.name,
'ref': line.ref,
'amount': line.amount,
'partner_id': line.partner_id.id,
'date': line.date,
'move_line_id': line.move_line_id.id,
'company_id': line.company_id.id,
'deposit_id': deposit.id
},
context=context)
raise osv.except_osv(
_('Processing Error'),
_(
'You cannot add any new deposit line item '
'manually as of this revision!'
)
)
res_id = deposit_ticket_line_obj.create(
cr, uid,
{
'name': line.name,
'ref': line.ref,
'amount': line.amount,
'partner_id': line.partner_id.id,
'date': line.date,
'move_line_id': line.move_line_id.id,
'company_id': line.company_id.id,
'deposit_id': deposit.id
},
context=context
)
move_line_ids.append(line.move_line_id.id)
account_move_line_obj.write(cr, uid, move_line_ids, {'draft_assigned': True}, context=context)
account_move_line_obj.write(
cr, uid,
move_line_ids,
{
'draft_assigned': True
},
context=context
)
return {'type': 'ir.actions.act_window_close'}
add_deposit_items()
class deposit_items_line(osv.osv_memory):
_name = "deposit.items.line"
_description = "Deposit Items Line"
_columns = {
'name': fields.char('Name', size=64),
'ref': fields.char('Reference', size=64),
'partner_id': fields.many2one('res.partner', 'Partner'),
'date': fields.date('Date', required=True),
'amount': fields.float('Amount', digits_compute=dp.get_precision('Account')),
'name': fields.char(
'Name',
size=64
),
'ref': fields.char(
'Reference',
size=64
),
'partner_id': fields.many2one(
'res.partner',
'Partner'
),
'date': fields.date(
'Date',
required=True
),
'amount': fields.float(
'Amount',
digits_compute=dp.get_precision('Account')
),
'draft_assigned': fields.boolean('Select'),
'deposit_items_id': fields.many2one('add.deposit.items', 'Deposit Items ID'),
'move_line_id': fields.many2one('account.move.line', 'Journal Item'),
'company_id': fields.many2one('res.company', 'Company'),
'deposit_items_id': fields.many2one(
'add.deposit.items',
'Deposit Items ID'
),
'move_line_id': fields.many2one(
'account.move.line',
'Journal Item'
),
'company_id': fields.many2one(
'res.company',
'Company'
),
}
deposit_items_line()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: