[IMP] account_banking_reconciliation: view, security and documentation

pull/268/head
Maxime Chambreuil 2019-05-31 18:41:34 -05:00 committed by Murtuza Saleh
parent 253b8db6d4
commit 358b1a469e
11 changed files with 199 additions and 141 deletions

View File

@ -5,13 +5,16 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Bank Account Reconciliation",
"summary": "Check transactions that cleared the bank",
"version": "11.0.1.0.0",
"license": "AGPL-3",
"category": "Accounting and Financial Management",
"author": "NovaPoint Group LLC, Open Source Integrators, "
"author": "NovaPoint Group LLC, "
"Open Source Integrators, "
"Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-reconcile",
"depends": [
"account_invoicing",
"account_voucher",
],
"data": [
@ -20,7 +23,9 @@
"views/account_banking_reconciliation.xml",
"views/account_move_line.xml",
"report/bank_statement_report.xml",
"views/report_bank_statement_summary.xml",
"views/report_bank_statement_detail.xml"],
"report/report_bank_statement_summary.xml",
"report/report_bank_statement_detail.xml"],
"installable": True,
"development_status": "Stable",
"maintainers": ["max3903"],
}

View File

@ -54,9 +54,8 @@ class BankAccRecStatement(models.Model):
@api.multi
def unlink(self):
"""Reset the related account.move.line to be re-assigned later
to statement."""
self.check_group() # Check if user is allowed to perform the action
"""Check if the user is allowed to perform the action"""
self.check_group()
return super(BankAccRecStatement, self).unlink()
@api.multi
@ -188,7 +187,7 @@ class BankAccRecStatement(models.Model):
line.cleared_bank_account and \
float_round(line.amountcur, account_precision) or 0.0
statement.sum_of_credits_lines += \
line.cleared_bank_account and 1.0 or 0.0
line.cleared_bank_account and 1 or 0
statement.sum_of_ucredits += \
(not line.cleared_bank_account) and \
float_round(line.amount, account_precision) or 0.0
@ -196,7 +195,7 @@ class BankAccRecStatement(models.Model):
(not line.cleared_bank_account) and \
float_round(line.amountcur, account_precision) or 0.0
statement.sum_of_ucredits_lines += \
(not line.cleared_bank_account) and 1.0 or 0.0
(not line.cleared_bank_account) and 1 or 0
for line in statement.debit_move_line_ids:
statement.sum_of_debits += \
line.cleared_bank_account and \
@ -205,7 +204,7 @@ class BankAccRecStatement(models.Model):
line.cleared_bank_account and \
float_round(line.amountcur, account_precision) or 0.0
statement.sum_of_debits_lines += \
line.cleared_bank_account and 1.0 or 0.0
line.cleared_bank_account and 1 or 0
statement.sum_of_udebits += \
(not line.cleared_bank_account) and \
float_round(line.amount, account_precision) or 0.0
@ -213,7 +212,7 @@ class BankAccRecStatement(models.Model):
(not line.cleared_bank_account) and \
float_round(line.amountcur, account_precision) or 0.0
statement.sum_of_udebits_lines += \
(not line.cleared_bank_account) and 1.0 or 0.0
(not line.cleared_bank_account) and 1 or 0
statement.cleared_balance = float_round(
statement.sum_of_debits - statement.sum_of_credits,
account_precision)
@ -288,9 +287,8 @@ class BankAccRecStatement(models.Model):
reslist = []
statement_obj = self.env['bank.acc.rec.statement']
domain = [('account_id', '=', account_id), ('state', '=', 'done')]
statement_ids = statement_obj.search(domain)
# get all statements for this account in the past
for statement in statement_ids:
for statement in statement_obj.search(domain):
if statement.ending_date < ending_date:
reslist.append(
(statement.ending_date, statement.ending_balance))
@ -306,7 +304,7 @@ class BankAccRecStatement(models.Model):
statement_line_obj = self.env['bank.acc.rec.statement.line']
val = {
'value': {'credit_move_line_ids': [], 'debit_move_line_ids': []}}
if self.account_id:
if self.ending_date and self.account_id:
for statement in self:
statement_line_ids = statement_line_obj.search(
[('statement_id', '=', statement.id)])
@ -326,8 +324,7 @@ class BankAccRecStatement(models.Model):
('cleared_bank_account', '=', False)]
if not self.suppress_ending_date_filter:
domain += [('date', '<=', self.ending_date)]
line_ids = account_move_line_obj.search(domain)
for line in line_ids:
for line in account_move_line_obj.search(domain):
amount_currency = (line.amount_currency < 0) and (
-1 * line.amount_currency) or line.amount_currency
res = {
@ -355,7 +352,7 @@ class BankAccRecStatement(models.Model):
def get_default_company_id(self):
return self.env['res.users'].browse([self.env.uid]).company_id.id
name = fields.Char('Name', required=True, size=64, copy=False, default='',
name = fields.Char('Name', required=True, size=64,
states={'done': [('readonly', True)]},
help="This is a unique name identifying "
"the statement (e.g. Bank X January 2012).")
@ -388,11 +385,13 @@ class BankAccRecStatement(models.Model):
notes = fields.Text('Notes')
verified_date = fields.Date('Verified Date',
states={'done': [('readonly', True)]},
copy=False,
help="Date in which Deposit "
"Ticket was verified.")
verified_by_user_id = fields.Many2one('res.users', 'Verified By',
states={
'done': [('readonly', True)]},
copy=False,
help="Entered automatically by "
"the “last user” who saved it. "
"System generated.")
@ -472,17 +471,17 @@ class BankAccRecStatement(models.Model):
digits=dp.get_precision('Account'),
help="Total SUM of Amts of lines "
"with Cleared = True")
sum_of_credits_lines = fields.Float(compute='_compute_get_balance',
string='Checks, Withdrawals, Debits, '
'and Service Charges # of '
'Items',
help="Total of number of lines with "
"Cleared = True")
sum_of_debits_lines = fields.Float(compute='_compute_get_balance',
string='Deposits, Credits, and Interest'
' # of Items',
help="Total of number of lines with"
" Cleared = True")
sum_of_credits_lines = fields.Integer(compute='_compute_get_balance',
string='''Checks, Withdrawals,
Debits, and Service Charges # of
Items''',
help="Total of number of lines with "
"Cleared = True")
sum_of_debits_lines = fields.Integer(compute='_compute_get_balance',
string='''Deposits, Credits, and
Interest # of Items''',
help="Total of number of lines with"
" Cleared = True")
sum_of_ucredits = fields.Float(compute='_compute_get_balance',
string='Uncleared - Checks, Withdrawals, '
'Debits, and Service Charges Amount',
@ -508,17 +507,17 @@ class BankAccRecStatement(models.Model):
digits=dp.get_precision('Account'),
help="Total SUM of Amts of lines with"
" Cleared = False")
sum_of_ucredits_lines = fields.Float(compute='_compute_get_balance',
string='Uncleared - Checks, '
'Withdrawals, Debits, and '
'Service Charges # of Items',
help="Total of number of lines with"
" Cleared = False")
sum_of_udebits_lines = fields.Float(compute='_compute_get_balance',
string='Uncleared - Deposits, Credits,'
' and Interest # of Items',
help="Total of number of lines "
"with Cleared = False")
sum_of_ucredits_lines = fields.Integer(compute='_compute_get_balance',
string='Uncleared - Checks, '
'Withdrawals, Debits, and '
'Service Charges # of Items',
help="Total of number of lines with"
" Cleared = False")
sum_of_udebits_lines = fields.Integer(compute='_compute_get_balance',
string='''Uncleared - Deposits,
Credits, and Interest # of Items''',
help="Total of number of lines "
"with Cleared = False")
suppress_ending_date_filter = fields.Boolean('Remove Ending Date Filter',
help="If this is checked then"
" the Statement End Date"
@ -531,7 +530,7 @@ class BankAccRecStatement(models.Model):
('draft', 'Draft'),
('to_be_reviewed', 'Ready for Review'),
('done', 'Done'),
('cancel', 'Cancel')
('cancel', 'Cancelled')
], 'State', index=True, readonly=True, default='draft')
_sql_constraints = [
@ -540,6 +539,15 @@ class BankAccRecStatement(models.Model):
'company and G/L account!')
]
@api.multi
def copy(self, default=None):
for rec in self:
if default is None:
default = {}
if 'name' not in default:
default['name'] = _("%s (copy)") % rec.name
return super(BankAccRecStatement, self).copy(default=default)
class BankAccRecStatementLine(models.Model):
_name = "bank.acc.rec.statement.line"

View File

@ -0,0 +1,6 @@
To configure this module
* Go to Settings and activate the developer mode
* Go to Settings > Users and Companies > Users
* Add users who will prepare the bank statements to the "Bank Statement Preparer"
* Add users who will verify them to the "Bank Statement Manager" group

View File

@ -2,4 +2,4 @@
* Balaji Kannan <bkannan@opensourceintegrators.com>
* Bhavesh Odedra <bodedra@opensourceintegrators.com>
* Sandeep Mangukiya <smangukiya@opensourceintegrators.com>
* Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com>
* Murtuza Saleh <murtuza.saleh@serpentcs.com>

View File

@ -0,0 +1,3 @@
* Nova Point Group <https://www.novapointgroup.com>
* Open Source Integrators <https://www.opensourceintegrators.com>
* Serpent Consulting Services Pvt. Ltd. <https://www.serpentcs.com>

View File

@ -0,0 +1,11 @@
To use this module:
* Go to Accounting > Adviser > Bank Statements
* Create a new bank statement
* Select the account and provide a name
* Enter the ending balance from the bank statement
* Check the transactions that cleared the bank
* Check the balances
* Save and submit for review
* As a reviewer, check the transactions, totals and balances
* Click on Process

View File

@ -6,14 +6,13 @@
<t t-set="o"
t-value="o.with_context({'lang':o.company_id.partner_id.lang})"/>
<div class="page">
<h2 style='text-align:center;'>
<p style='text-align:center;'>
Reconciliation Detail
</h2>
</p>
<h5 style='text-align:center;'>
<span>Period Ending</span>
<span t-field="o.ending_date"/>
</h5>
<div class="row">
<table class="table table-condensed"
t-if="not o.account_id.currency_id">
@ -23,8 +22,8 @@
<th>Date</th>
<th class="text-center">Comment</th>
<th class="text-center">Partner</th>
<th class="text-right">Reference</th>
<th class="text-right">Cleared</th>
<th class="text-center">Reference</th>
<th class="text-center">Cleared</th>
<th class="text-right">
<span t-field="o.company_id.currency_id.symbol"/>
</th>
@ -42,11 +41,12 @@
<th>Date</th>
<th class="text-center">Comment</th>
<th class="text-center">Partner</th>
<th class="text-right">Reference</th>
<th class="text-right">Cleared</th>
<th class="text-center">Reference</th>
<th class="text-center">Cleared</th>
<th class="text-right">
<span t-field="o.company_id.currency_id.symbol"/>
</th>
<th class="text-right">Cleared</th>
</tr>
</thead>
</table>
@ -141,7 +141,9 @@
<span t-field="debit.ref"/>
</td>
<td class="text-right">
<span t-esc="debit.cleared_bank_account and 'X' or ''"/>
<t t-if="debit.cleared_bank_account">
<input type="checkbox" checked="1"/>
</t>
</td>
<td class="text-right">
<span t-field="debit.amount"
@ -173,7 +175,9 @@
<span t-field="debit.ref"/>
</td>
<td class="text-right">
<span t-esc="debit.cleared_bank_account and 'X' or ''"/>
<t t-if="debit.cleared_bank_account">
<input type="checkbox" checked="1"/>
</t>
</td>
<td class="text-right">
<span t-field="debit.amount"
@ -279,7 +283,9 @@
<span t-field="credit.ref"/>
</td>
<td class="text-right">
<span t-esc="credit.cleared_bank_account and 'X' or ''"/>
<t t-if="credit.cleared_bank_account">
<input type="checkbox" checked="1"/>
</t>
</td>
<td class="text-right">
<span t-field="credit.amount"
@ -312,7 +318,9 @@
<span t-field="credit.ref"/>
</td>
<td class="text-right">
<span t-esc="credit.cleared_bank_account and 'X' or ''"/>
<t t-if="credit.cleared_bank_account">
<input type="checkbox" checked="1"/>
</t>
</td>
<td class="text-right">
<span t-field="credit.amount"

View File

@ -6,14 +6,13 @@
<t t-set="o"
t-value="o.with_context({'lang':o.company_id.partner_id.lang})"/>
<div class="page">
<h2 style='text-align:center;'>
<p style='text-align:center;'>
Reconciliation Summary
</h2>
</p>
<h5 style='text-align:center;'>
<span>Period Ending</span>
<span t-field="o.ending_date"/>
</h5>
<div class="row" t-if="not o.account_id.currency_id">
<table class="table table-condensed">
<tbody class="invoice_tbody">

View File

@ -1,12 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Groups - Bank Stmt Preparer , Bank Stmt Verifier -->
<record id="group_bank_stmt_preparer" model="res.groups">
<field name="name">Bank Statement Preparer</field>
<field name="category_id" ref="base.module_category_hidden"/>
<field name="implied_ids" eval="[(4, ref('account.group_account_user'))]"/>
</record>
<record id="group_bank_stmt_verifier" model="res.groups">
<field name="name">Bank Statement Verifier</field>
<field name="category_id" ref="base.module_category_hidden"/>
<field name="implied_ids" eval="[(4, ref('group_bank_stmt_preparer'))]"/>
<field name="users" eval="[(4, ref('base.user_root'))]"/>
</record>
<!-- Security Rule for Bank Rec Stmts -->
@ -15,7 +21,9 @@
<field ref="model_bank_acc_rec_statement" name="model_id"/>
<field eval="True" name="global"/>
<field name="domain_force">
['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]
['|',
('company_id', '=', False),
('company_id', 'child_of', [user.company_id.id])]
</field>
</record>

View File

@ -26,39 +26,49 @@
<field name="arch" type="xml">
<form string="Bank Account Reconciliation Statement">
<header>
<button name="action_cancel" type="object"
states="draft,to_be_reviewed"
string="Cancel" icon="fa-ban"/>
<button name="action_review" type="object" states="draft"
string="Ready for Review" icon="fa-forward"/>
string="Submit for Review"
class="oe_highlight"/>
<button name="action_process" type="object"
states="to_be_reviewed"
string="Process"/>
string="Process"
class="oe_highlight"/>
<button name="action_cancel_draft" states="cancel,done"
string="Set to Draft" type="object"/>
<button name="action_cancel" type="object"
states="draft,to_be_reviewed"
string="Cancel"/>
<button name='refresh_record' string='Refresh'
confirm="Current edits in statement will be lost. Do you want to refresh?"
states="draft" type='object'/>
<field name="state" widget="statusbar" nolabel="1"/>
</header>
<sheet>
<group col="4" colspan="4">
<field name="account_id"
placeholder="Enter Account Name"/>
<field name="name" placeholder="Enter Name"/>
<field name="ending_date"
placeholder="Enter ending date"/>
<field name="starting_balance"
placeholder="Enter Starting Balance"/>
<field name="ending_balance"
placeholder="Enter Ending Balance"/>
<field name="last_ending_date"
placeholder="Last Statement Date"
readonly="1" force_save="1"/>
<field name="suppress_ending_date_filter"/>
<field name="company_id"
groups="base.group_multi_company"
placeholder="Enter Company Name"/>
<div class="oe_title">
<h1>
<field name="name" placeholder="Enter Name"/>
</h1>
</div>
<group>
<group>
<field name="account_id"
placeholder="Select the account"/>
<field name="ending_date"
placeholder="Enter the ending date"/>
<field name="ending_balance"
placeholder="Enter the ending balance"/>
</group>
<group>
<field name="last_ending_date"
placeholder="Date of the last statement"
readonly="1" force_save="1"/>
<field name="starting_balance"
placeholder="Enter the starting balance"/>
<field name="suppress_ending_date_filter"/>
<field name="company_id"
groups="base.group_multi_company"
placeholder="Select the company"/>
</group>
</group>
<notebook colspan="5">
<page string="Journal Items">
@ -69,34 +79,36 @@
nolabel="1" widget="one2many_list"
height="300">
<form string="Deposits, Credits, and Interest">
<field name="cleared_bank_account"/>
<field name="date" readonly="1"
force_save="1"/>
<field name="name" readonly="1"
force_save="1"/>
<field name="ref" readonly="1"
force_save="1"/>
<field name="partner_id" readonly="1"
force_save="1"/>
<field name="amount" readonly="1"
force_save="1"/>
<field name="amountcur" readonly="1"
force_save="1"/>
<field name="currency_id" readonly="1"
force_save="1"/>
<field name="research_required"
readonly="1" force_save="1"/>
<group col="4">
<field name="cleared_bank_account"/>
<field name="date" readonly="1"
force_save="1"/>
<field name="name" readonly="1"
force_save="1"/>
<field name="ref" readonly="1"
force_save="1"/>
<field name="partner_id" readonly="1"
force_save="1"/>
<field name="amount" readonly="1"
force_save="1"/>
<field name="amountcur" readonly="1"
force_save="1"/>
<field name="currency_id" readonly="1"
force_save="1"/>
<field name="research_required"
readonly="1" force_save="1"/>
</group>
</form>
<tree string="Deposits, Credits, and Interest"
editable="top"
mute_additem="draft,to_be_reviewed,done, cancel">
mute_additem="draft,to_be_reviewed,done, cancel"
create="0">
<field name="cleared_bank_account"/>
<field name="date" readonly="1"
force_save="1"/>
<field name="name" readonly="1"
force_save="1"/>
<field name="ref" readonly="1"
force_save="1"/>
<field name="ref" readonly="1"/>
<field name="partner_id" readonly="1"
force_save="1"/>
<field name="amount" readonly="1"
@ -117,27 +129,30 @@
nolabel="1" widget="one2many_list"
height="300">
<form string="Checks, Withdrawals, Debits, and Service Charges">
<field name="cleared_bank_account"/>
<field name="date" readonly="1"
force_save="1"/>
<field name="name" readonly="1"
force_save="1"/>
<field name="ref" readonly="1"
force_save="1"/>
<field name="partner_id" readonly="1"
force_save="1"/>
<field name="amount" readonly="1"
force_save="1"/>
<field name="amountcur" readonly="1"
force_save="1"/>
<field name="currency_id" readonly="1"
force_save="1"/>
<field name="research_required"
readonly="1" force_save="1"/>
<group col="4">
<field name="cleared_bank_account"/>
<field name="date" readonly="1"
force_save="1"/>
<field name="name" readonly="1"
force_save="1"/>
<field name="ref" readonly="1"
force_save="1"/>
<field name="partner_id" readonly="1"
force_save="1"/>
<field name="amount" readonly="1"
force_save="1"/>
<field name="amountcur" readonly="1"
force_save="1"/>
<field name="currency_id" readonly="1"
force_save="1"/>
<field name="research_required"
readonly="1" force_save="1"/>
</group>
</form>
<tree string="Checks, Withdrawals, Debits, and Service Charges"
editable="top"
mute_additem="draft,to_be_reviewed,done, cancel">
mute_additem="draft,to_be_reviewed,done, cancel"
create="0">
<field name="cleared_bank_account"/>
<field name="date" readonly="1"
force_save="1"/>
@ -173,12 +188,8 @@
string="Unselect All"
icon="fa-close"/>
</group>
<newline/>
<separator string="Totals - Cleared and Uncleared"
colspan="2"/>
<group name="totals" col="4" colspan="4">
<group name="total1" col="2" colspan="2">
<group name="totals" string="Totals">
<group name="total1" string="Cleared">
<field name="sum_of_debits"/>
<field name="sum_of_debits_cur"/>
<field name="sum_of_debits_lines"/>
@ -186,7 +197,7 @@
<field name="sum_of_credits_cur"/>
<field name="sum_of_credits_lines"/>
</group>
<group name="total2" col="2" colspan="2">
<group name="total2" string="Uncleared">
<field name="sum_of_udebits"/>
<field name="sum_of_udebits_cur"/>
<field name="sum_of_udebits_lines"/>
@ -195,11 +206,8 @@
<field name="sum_of_ucredits_lines"/>
</group>
</group>
<newline/>
<separator
string="Balances - Cleared and Uncleared"/>
<group name="balances" col="4" colspan="4">
<group name="balance1" col="2" colspan="2">
<group name="balances" string="Balances">
<group name="balance1" string="Cleared">
<field name="cleared_balance"/>
<field name="cleared_balance_cur"
attrs="{'invisible':[('cleared_balance_cur','=', 0.0)]}"/>
@ -207,7 +215,7 @@
<field name="difference_cur"
attrs="{'invisible':[('cleared_balance_cur','=', 0.0)]}"/>
</group>
<group name="balance2" col="2" colspan="2">
<group name="balance2" string="Uncleared">
<field name="uncleared_balance"/>
<field name="uncleared_balance_cur"
attrs="{'invisible':[('uncleared_balance_cur','=', 0.0)]}"/>
@ -215,15 +223,17 @@
</group>
</page>
<page string="Other Information">
<separator string="Tracking Information"
colspan="4"/>
<group colspan="2" col="2">
<field name="verified_by_user_id"
placeholder="Enter user whoever varified"/>
</group>
<group colspan="2" col="2">
<field name="verified_date"
placeholder="Enter date of varification"/>
<group string="Tracking Information">
<group>
<field name="verified_by_user_id"
placeholder="Enter the user who verified"
readonly="1"/>
</group>
<group>
<field name="verified_date"
placeholder="Enter the verification date"
readonly="1"/>
</group>
</group>
</page>
<page string="Notes">
@ -262,7 +272,8 @@
</field>
<newline/>
<group expand="0" string="Group By...">
<filter string="Account" icon="terp-personal" domain="[]" context="{'group_by':'account_id'}"/>
<filter string="Account" icon="terp-personal" domain="[]"
context="{'group_by':'account_id'}"/>
<separator orientation="vertical"/>
<filter string="State"
icon="terp-stock_effects-object-colorize"

View File

@ -4,7 +4,7 @@
<record id="view_account_move_line_bank_acc_rec_statement_id"
model="ir.ui.view">
<field name="name">account.move.line.bank.acc.rec.statement.id</field>
<field name="name">account.move.line</field>
<field name="model">account.move.line</field>
<field name="inherit_id" ref="account.view_account_move_line_filter"/>
<field name="type">search</field>
@ -24,8 +24,7 @@
<record id="view_account_move_line_bank_acc_rec_statement_id_form"
model="ir.ui.view">
<field name="name">account.move.line.bank.acc.rec.statement.id.form
</field>
<field name="name">account.move.line.form</field>
<field name="model">account.move.line</field>
<field name="inherit_id" ref="account.view_move_line_form"/>
<field name="type">form</field>