Browse Source

[ADD]Initial Commit

pull/94/head
Sreejith P 7 years ago
parent
commit
413e9ab319
  1. 24
      bank_reconciliation/__init__.py
  2. 43
      bank_reconciliation/__manifest__.py
  3. 3
      bank_reconciliation/models/__init__.py
  4. 53
      bank_reconciliation/models/account_journal.py
  5. 22
      bank_reconciliation/models/account_move_line.py
  6. 2
      bank_reconciliation/security/ir.model.access.csv
  7. BIN
      bank_reconciliation/static/description/bank_statement_edited.png
  8. BIN
      bank_reconciliation/static/description/bank_statement_wiz.png
  9. BIN
      bank_reconciliation/static/description/banner.jpg
  10. BIN
      bank_reconciliation/static/description/cybro_logo.png
  11. BIN
      bank_reconciliation/static/description/dash_board.png
  12. BIN
      bank_reconciliation/static/description/dashboard_change.png
  13. BIN
      bank_reconciliation/static/description/icon.png
  14. 128
      bank_reconciliation/static/description/index.html
  15. BIN
      bank_reconciliation/static/description/payment_done.png
  16. BIN
      bank_reconciliation/static/description/payments.png
  17. 28
      bank_reconciliation/views/account_journal_dashboard_view.xml
  18. 41
      bank_reconciliation/views/account_move_line_view.xml
  19. 2
      bank_reconciliation/wizard/__init__.py
  20. 76
      bank_reconciliation/wizard/bank_statement_wiz.py
  21. 57
      bank_reconciliation/wizard/bank_statement_wiz_view.xml

24
bank_reconciliation/__init__.py

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2018-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Fasluca(<faslu@cybrosys.in>)
# you can modify it under the terms of the GNU AFFERO
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3.
#
# It is forbidden to publish, distribute, sublicense, or sell copies
# of the Software or modified copies of the Software.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details.
#
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
# GENERAL PUBLIC LICENSE (AGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import models
from . import wizard

43
bank_reconciliation/__manifest__.py

@ -0,0 +1,43 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2018-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Fasluca(<faslu@cybrosys.in>)
# you can modify it under the terms of the GNU AFFERO
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3.
#
# It is forbidden to publish, distribute, sublicense, or sell copies
# of the Software or modified copies of the Software.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details.
#
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
# GENERAL PUBLIC LICENSE (AGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': 'Manual Bank Reconciliation',
'version': '11.0.1.0',
'author': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions',
'website': 'http://www.cybrosys.com',
'category': 'Accounting',
'summary': 'Replacing default method by traditional',
'description': """ Replacing default bank statement reconciliation method by traditional way """,
'depends': ['account'],
'data': [
'security/ir.model.access.csv',
'views/account_move_line_view.xml',
'views/account_journal_dashboard_view.xml',
'wizard/bank_statement_wiz_view.xml',
],
'images': ['static/description/pdc_banner.jpg'],
'license': 'AGPL-3',
'installable': True,
'auto_install': False,
}

3
bank_reconciliation/models/__init__.py

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import account_move_line
from . import account_journal

53
bank_reconciliation/models/account_journal.py

@ -0,0 +1,53 @@
# -*- coding: utf-8 -*-
from odoo import api, fields, models, _
from odoo.tools.misc import formatLang
class AccountJournal(models.Model):
_inherit = 'account.journal'
@api.multi
def create_bank_statement(self):
"""return action to create a bank statements. This button should be called only on journals with type =='bank'"""
self.bank_statements_source = 'manual'
action = self.env.ref('bank_reconciliation.action_bank_statement_wiz').read()[0]
action.update({
# 'views': [[False, 'form']],
'context': "{'default_journal_id': " + str(self.id) + "}",
})
return action
@api.multi
def get_journal_dashboard_datas(self):
res = super(AccountJournal, self).get_journal_dashboard_datas()
print(res)
account_sum = 0.0
bank_balance = 0.0
currency = self.currency_id or self.company_id.currency_id
account_ids = tuple(ac for ac in [self.default_debit_account_id.id, self.default_credit_account_id.id] if ac)
if account_ids:
amount_field = 'balance' if (
not self.currency_id or self.currency_id == self.company_id.currency_id) else 'amount_currency'
query = """SELECT sum(%s) FROM account_move_line WHERE account_id in %%s AND date <= %%s;""" % (
amount_field,)
self.env.cr.execute(query, (account_ids, fields.Date.today(),))
query_results = self.env.cr.dictfetchall()
if query_results and query_results[0].get('sum') != None:
account_sum = query_results[0].get('sum')
query = """SELECT sum(%s) FROM account_move_line WHERE account_id in %%s AND date <= %%s AND
statement_date is not NULL;""" % (amount_field,)
self.env.cr.execute(query, (account_ids, fields.Date.today(),))
query_results = self.env.cr.dictfetchall()
if query_results and query_results[0].get('sum') != None:
bank_balance = query_results[0].get('sum')
# account_id = self.default_debit_account_id.id or self.default_credit_account_id.id
# domain = [('account_id', '=', account_id),('statement_date', '!=', False)]
# lines = self.env['account.move.line'].search(domain)
# statement_balance += sum([line.balance for line in lines])
difference = currency.round(account_sum - bank_balance) + 0.0
res.update({
'last_balance': formatLang(self.env, currency.round(bank_balance) + 0.0, currency_obj=currency),
'difference': formatLang(self.env, currency.round(difference) + 0.0, currency_obj=currency)
})
print(res)
return res

22
bank_reconciliation/models/account_move_line.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
from odoo import api, fields, models, _
class AccountMoveLine(models.Model):
_inherit = "account.move.line"
bank_statement_id = fields.Many2one('bank.statement', 'Bank Statement', copy=False)
statement_date = fields.Date('Bank.St Date', copy=False)
@api.multi
def write(self, vals):
if not vals.get("statement_date"):
vals.update({"reconciled": False})
if self.payment_id and self.payment_id.state == 'reconciled':
self.payment_id.state = 'posted'
elif vals.get("statement_date"):
vals.update({"reconciled": True})
if self.payment_id:
self.payment_id.state = 'reconciled'
res = super(AccountMoveLine, self).write(vals)
return res

2
bank_reconciliation/security/ir.model.access.csv

@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_bank_statement,bank_statement,model_bank_statement,account.group_account_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_bank_statement bank_statement model_bank_statement account.group_account_user 1 1 1 1

BIN
bank_reconciliation/static/description/bank_statement_edited.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

BIN
bank_reconciliation/static/description/bank_statement_wiz.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

BIN
bank_reconciliation/static/description/banner.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

BIN
bank_reconciliation/static/description/cybro_logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
bank_reconciliation/static/description/dash_board.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

BIN
bank_reconciliation/static/description/dashboard_change.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
bank_reconciliation/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

128
bank_reconciliation/static/description/index.html

@ -0,0 +1,128 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">Manual Bank Reconciliation</h2>
<h4 class="oe_slogan">Cybrosys Techno Solutions, www.cybrosys.com</h4>
<h3 class="oe_slogan">...The traditional way of reconciling bank statement...</h3>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h3 class="oe_slogan"><b>What it does ?</b></h3>
</div>
<span style="font-size:18px;text-align: center" class="oe_slogan">This module replaces the Odoo default bank statement reconciliation with traditional way of just putting the date in each line</span>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<span style="font-size:18px;"> &#9827;</span><span style="font-size:15px;" class="oe_slogan">&nbsp;&nbsp;When You click on "New Statement" a window will open</span>
</div>
<div class="col-md-12">
<div class="oe_row_img oe_demo oe_picture oe_screenshot">
<img src="dash_board.png">
</div>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<span style="font-size:18px;"> &#9827;</span><span style="font-size:15px;" class="oe_slogan">&nbsp;&nbsp;There you can see the list on journal items that are 'not reconciled'</span>
</div>
<div class="col-md-12">
<div class="oe_row_img oe_demo oe_picture oe_screenshot">
<img src="bank_statement_wiz.png">
</div>
</div>
<div class="oe_span12">
<p class="oe_mt32">
<br/>
<p>You can see the details about the current balance as per company books, bank balance based on already reconciled journal entries as 'Balance as per bank' and difference between them as 'Amount not reflected in Bank'</p>
</p>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<span style="font-size:18px;"> &#9827;</span><span style="font-size:15px;" class="oe_slogan">&nbsp;&nbsp; Fill the dates mentioned in bank statement in 'Bank.St Date' column of respective line. Click on 'Save' button before closing the window.</span>
</div>
<div class="col-md-12">
<div class="oe_row_img oe_demo oe_picture oe_screenshot">
<img src="bank_statement_edited.png">
</div>
</div>
<div class="oe_span12">
<p class="oe_mt32">
<p> Hope you have noticed the changes in Balance as per company books, Balance as per bank and Amount not reflected in Bank</p>
</p>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<span style="font-size:18px;"> &#9827;</span><span style="font-size:15px;" class="oe_slogan">&nbsp;&nbsp; You will be back on dashboard now. Did you notice the status updated there also </span>
</div>
<div class="col-md-12">
<div class="oe_row_img oe_demo oe_picture oe_screenshot">
<img src="dashboard_change.png">
</div>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<span style="font-size:18px;"> &#9827;</span><span style="font-size:15px;" class="oe_slogan">&nbsp;&nbsp; One more thing to point out is, this will also mark the bank payments as 'Reconciled' </span>
</div>
<div class="col-md-12">
<div class="oe_row_img oe_demo oe_picture oe_screenshot">
<img src="payment_done.png">
</div>
</div>
</div>
</section>
<section class="oe_container">
<h2 class="oe_slogan" style="margin-top:20px;" >Need Any Help?</h2>
<div class="oe_slogan" style="margin-top:10px !important;">
<div>
<a class="btn btn-primary btn-lg mt8"
style="color: #FFFFFF !important;border-radius: 0;" href="https://www.cybrosys.com"><i
class="fa fa-envelope"></i> Email </a> <a
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;"
href="https://www.cybrosys.com/contact/"><i
class="fa fa-phone"></i> Contact Us </a> <a
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;"
href="https://www.cybrosys.com/odoo-customization-and-installation/"><i
class="fa fa-check-square"></i> Request Customization </a>
</div>
<br>
<img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block">
<div>
<a href="https://twitter.com/cybrosys" target="_blank"><i class="fa fa-2x fa-twitter" style="color:white;background: #00a0d1;width:35px;"></i></a></td>
<a href="https://www.linkedin.com/company/cybrosys-technologies-pvt-ltd" target="_blank"><i class="fa fa-2x fa-linkedin" style="color:white;background: #31a3d6;width:35px;padding-left: 3px;"></i></a></td>
<a href="https://www.facebook.com/cybrosystechnologies" target="_blank"><i class="fa fa-2x fa-facebook" style="color:white;background: #3b5998;width:35px;padding-left: 8px;"></i></a></td>
<a href="https://plus.google.com/106641282743045431892/about" target="_blank"><i class="fa fa-2x fa-google-plus" style="color:white;background: #c53c2c;width:35px;padding-left: 3px;"></i></a></td>
<a href="https://in.pinterest.com/cybrosys" target="_blank"><i class="fa fa-2x fa-pinterest" style="color:white;background: #ac0f18;width:35px;padding-left: 3px;"></i></a></td>
</div>
</div>
</section>

BIN
bank_reconciliation/static/description/payment_done.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

BIN
bank_reconciliation/static/description/payments.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

28
bank_reconciliation/views/account_journal_dashboard_view.xml

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="account_journal_dashboard_kanban_view" model="ir.ui.view">
<field name="name">account.journal.dashboard.kanban</field>
<field name="model">account.journal</field>
<field name="inherit_id" ref="account.account_journal_dashboard_kanban_view"/>
<field name="arch" type="xml">
<div name="latest_statement" position="replace">
<div class="row" name="latest_statement" t-if="dashboard.last_balance and dashboard.account_balance">
<div class="col-xs-6">
<span title="Latest Statement">Latest Statement</span>
</div>
<div class="col-xs-6 text-right">
<span><t t-esc="dashboard.last_balance"/></span>
</div>
</div>
<div class="row" name="difference" t-if="dashboard.last_balance and dashboard.account_balance">
<div class="col-xs-6">
<span title="Balance Difference">Difference</span>
</div>
<div class="col-xs-6 text-right">
<span><t t-esc="dashboard.difference"/></span>
</div>
</div>
</div>
</field>
</record>
</odoo>

41
bank_reconciliation/views/account_move_line_view.xml

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_move_line_form" model="ir.ui.view">
<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="arch" type="xml">
<field name="date_maturity" position="after">
<field name="statement_date"/>
</field>
</field>
</record>
<record id="view_bank_statement_move_line_tree" model="ir.ui.view">
<field name="name">account.bank.statement.move.line.tree</field>
<field name="model">account.move.line</field>
<field name="arch" type="xml">
<tree string="Journal Items" create="false">
<field name="date"/>
<field name="move_id" required="0" groups="account.group_account_user"/>
<field name="journal_id" options='{"no_open":True}'/>
<field name="name"/>
<field name="ref"/>
<field name="statement_id" invisible="1"/>
<field name="partner_id"/>
<!--<field name="account_id" options='{"no_open":True}' domain="[('company_id', '=', company_id)]" groups="account.group_account_user"/>-->
<!--<field name="analytic_account_id" groups="account.group_account_user"/>-->
<field name="reconciled" invisible="1"/>
<field name="full_reconcile_id"/>
<field name="debit"/>
<field name="credit"/>
<field name="amount_currency" readonly="True" groups="base.group_multi_currency"/>
<field name="currency_id" readonly="True" invisible="1" />
<field name="date_maturity"/>
<field name="statement_date"/>
<field name="company_currency_id" invisible="1"/>
<field name="company_id" invisible="1"/>
</tree>
</field>
</record>
</odoo>

2
bank_reconciliation/wizard/__init__.py

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import bank_statement_wiz

76
bank_reconciliation/wizard/bank_statement_wiz.py

@ -0,0 +1,76 @@
# -*- coding: utf-8 -*-
from odoo import api, fields, models, _
class BankStatement(models.Model):
_name = 'bank.statement'
@api.onchange('journal_id', 'date_from', 'date_to')
def _get_lines(self):
self.account_id = self.journal_id.default_debit_account_id.id or self.journal_id.default_credit_account_id.id
self.currency_id = self.journal_id.currency_id or self.journal_id.company_id.currency_id or \
self.env.user.company_id.currency_id
domain = [('account_id', '=', self.account_id.id), ('statement_date', '=', False)]
if self.date_from:
domain += [('date', '>=', self.date_from)]
if self.date_to:
domain += [('date', '<=', self.date_to)]
s_lines = []
lines = self.env['account.move.line'].search(domain)
for line in self.statement_lines:
line.bank_statement_id = self.id
self.statement_lines = lines
@api.one
@api.depends('statement_lines.statement_date')
def _compute_amount(self):
print("_compute_amount")
gl_balance = 0
bank_balance = 0
current_update = 0
domain = [('account_id', '=', self.account_id.id)]
lines = self.env['account.move.line'].search(domain)
gl_balance += sum([line.debit - line.credit for line in lines])
domain += [('id', 'not in', self.statement_lines.ids), ('statement_date', '!=', False)]
lines = self.env['account.move.line'].search(domain)
bank_balance += sum([line.balance for line in lines])
current_update += sum([line.debit - line.credit if line.statement_date else 0 for line in self.statement_lines])
self.gl_balance = gl_balance
self.bank_balance = bank_balance + current_update
self.balance_difference = self.gl_balance - self.bank_balance
journal_id = fields.Many2one('account.journal', 'Bank', domain=[('type', '=', 'bank')])
account_id = fields.Many2one('account.account', 'Bank Account')
date_from = fields.Date('Date From')
date_to = fields.Date('Date To')
statement_lines = fields.One2many('account.move.line', 'bank_statement_id')
# statement_lines = fields.One2many('bank.statement.line', 'bank_statement_id')
gl_balance = fields.Monetary('Balance as per Company Books', readonly=True, compute='_compute_amount')
bank_balance = fields.Monetary('Balance as per Bank', readonly=True, compute='_compute_amount')
balance_difference = fields.Monetary('Amounts not Reflected in Bank', readonly=True, compute='_compute_amount')
current_update = fields.Monetary('Balance of entries updated now')
currency_id = fields.Many2one('res.currency', string='Currency')
company_id = fields.Many2one('res.company', string='Company',
default=lambda self: self.env['res.company']._company_default_get('bank.statement'))
# class BankStatementLine(models.Model):
# _name = 'bank.statement.line'
#
# bank_statement_id = fields.Many2one('bank.statement', 'Bank Statement')
# move_id = fields.Many2one('account.move.line', 'Journal Item')
# date = fields.Date(related='move_id.date', string='Date')
# name = fields.Char(string="Label", related='move_id.name')
# ref = fields.Char(related='move_id.ref', string='Reference')
# partner_id = fields.Many2one('res.partner', string='Partner', related='move_id.partner_id')
# account_id = fields.Many2one('account.account', 'Account', related='move_id.account_id')
# debit = fields.Monetary(currency_field='company_currency_id', related='move_id.debit')
# credit = fields.Monetary(currency_field='company_currency_id', related='move_id.credit')
# amount_currency = fields.Monetary(related='move_id.amount_currency')
# currency_id = fields.Many2one('res.currency', string='Currency', related='move_id.currency_id')
# company_currency_id = fields.Many2one('res.currency', string="Company Currency", readonly=True,
# related='move_id.currency_id')
# date_maturity = fields.Date(string='Due date', related='move_id.date_maturity')
# statement_date = fields.Date('Bank.St Date', related='move_id.statement_date')

57
bank_reconciliation/wizard/bank_statement_wiz_view.xml

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="bank_statement_wiz" model="ir.ui.view">
<field name="name">bank.statement.reconciliation</field>
<field name="model">bank.statement</field>
<field name="arch" type="xml">
<form string="Bank Statement Reconciliation">
<group>
<group>
<field name="journal_id"/>
<field name="account_id"/>
</group>
<group>
<field name="date_from"/>
<field name="date_to"/>
</group>
</group>
<group>
<field name="statement_lines" nolabel="1">
<tree create="false" editable="bottom" default_order="date">
<field name="date" readonly="True"/>
<field name="move_id" readonly="True" invisible="1" groups="account.group_account_user"/>
<field name="name" readonly="True"/>
<field name="ref" readonly="True"/>
<field name="partner_id" readonly="True"/>
<field name="amount_currency" readonly="True" groups="base.group_multi_currency"/>
<field name="currency_id" readonly="True" invisible="1" />
<field name="date_maturity" readonly="True"/>
<field name="statement_date"/>
<field name="company_currency_id" invisible="1" readonly="True"/>
<field name="debit" readonly="True"/>
<field name="credit" readonly="True"/>
</tree>
</field>
</group>
<group class="oe_subtotal_footer oe_right">
<field name="gl_balance"/>
<field name="balance_difference"/>
<field name="bank_balance"/>
</group>
</form>
</field>
</record>
<record id="action_bank_statement_wiz" model="ir.actions.act_window">
<field name="name">Bank Statement Reconciliation</field>
<field name="res_model">bank.statement</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<menuitem id="menu_action_bank_reconciliation" parent="account.menu_finance_entries_actions" action="action_bank_statement_wiz" sequence="25"/>
</odoo>
Loading…
Cancel
Save