Browse Source

[ADD] Initial Commit

pull/30/merge
SHEREEF PT 8 years ago
parent
commit
6bd03b95f6
  1. 20
      account_limit/README.rst
  2. 25
      account_limit/__init__.py
  3. 45
      account_limit/__manifest__.py
  4. 1
      account_limit/models/__init__.py
  5. 114
      account_limit/models/account.py
  6. BIN
      account_limit/static/description/Cash.png
  7. BIN
      account_limit/static/description/Tree view account.png
  8. BIN
      account_limit/static/description/Warning.png
  9. BIN
      account_limit/static/description/banner.jpg
  10. BIN
      account_limit/static/description/cybro_logo.png
  11. BIN
      account_limit/static/description/icon.png
  12. 105
      account_limit/static/description/index.html
  13. 31
      account_limit/views/account_credit_limit_view.xml

20
account_limit/README.rst

@ -0,0 +1,20 @@
========================
Account Credit Limit v10
========================
Account credit limit is a handy plugin for Odoo Accounting module to set a Credit limit for each Account.
The module will bring new fields total Credit, Debit and Balance in ‘Accounts tree view’ and ‘Account form view’.
The module also produce a warning message while making journal entries which will exceed the credit limit.
The features can simplify the credit evaluation
process of accounts like Customers accounts, Overdraft accounts, Bank accounts etc.
Features
========
* Know Total Debit of an account.
* Know Total Credit of an account.
* Know Balance of the account.
* Set the Credit limit for accounts.
* Stop an account exceeding the credit limit.
Credits
=======
Nikhil Krishnan @ cybrosys, nikhil@cybrosys.in

25
account_limit/__init__.py

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Nikhil krishnan(nikhil@cybrosys.in)
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <https://www.gnu.org/licenses/>.
#
##############################################################################
import models

45
account_limit/__manifest__.py

@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-
#
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Nikhil krishnan(<https://www.cybrosys.com>)
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <https://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': 'Account Credit Limit',
'version': '10.0.1.0',
'summary': """Generate warning message when credit limit of an account is exceed.""",
'description': """Account credit limit is a handy plugin for Odoo Accounting module to set a Credit limit
for each Account. The module will bring new fields total Credit, Debit and Balance in Accounts tree view and
Account form view. The module also produce a warning message while making journal entries which will exceed
the credit limit. The features can simplify the credit evaluation process of accounts like Customers accounts,
Overdraft accounts, Bank accounts etc.""",
'author': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions',
'website': 'https://www.cybrosys.com',
'category': 'Accounting',
'depends': ['account', 'account_accountant'],
'license': 'LGPL-3',
'data': ['views/account_credit_limit_view.xml'],
'demo': [],
'images': ['static/description/banner.jpg'],
'installable': True,
'auto_install': False,
}

1
account_limit/models/__init__.py

@ -0,0 +1 @@
import account

114
account_limit/models/account.py

@ -0,0 +1,114 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Nikhil krishnan(<https://www.cybrosys.com>)
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <https://www.gnu.org/licenses/>.
#
##############################################################################
from odoo import fields, api, _, models
from odoo.exceptions import Warning
class AccountAccount(models.Model):
_inherit = 'account.account'
@api.depends('credit', 'debit', 'balance')
@api.multi
def get_credit_debit_balance(self):
print "get_credit_debit_balance", self
for obj in self:
credit = 0
debit = 0
account_lines = self.env['account.move.line'].search([('account_id', '=', obj.id)])
for line in account_lines:
credit += line.credit
debit += line.debit
obj.credit = credit
obj.debit = debit
obj.balance = debit - credit
credit = fields.Float(string='Credit', compute='get_credit_debit_balance')
debit = fields.Float(string='Debit', compute='get_credit_debit_balance')
balance = fields.Float(string='Balance', compute='get_credit_debit_balance')
account_credit_limit = fields.Float(string='Credit Limit', Help="Credit Limit for this particular Account.")
class AccountMove(models.Model):
_inherit = "account.move"
@api.model
def create(self, vals):
credit = 0
debit = 0
if "line_ids" in vals.keys():
for line in vals['line_ids']:
if line[2]['credit']:
account = self.env['account.account'].browse(line[2]['account_id'])
account_lines = self.env['account.move.line'].search([('account_id', '=', account.id)])
for lines in account_lines:
credit += lines.credit
debit += lines.debit
if account.account_credit_limit:
if (credit+line[2]['credit'] - debit) > account.account_credit_limit:
raise Warning(_('Limit will Exceed .! \n Making this transaction will exceed the limit '
'defined for " %s " account') % account.name)
result = super(AccountMove, self).create(vals)
return result
@api.multi
def write(self, vals):
if "line_ids" in vals.keys():
for line in vals['line_ids']:
account_lines = self.env['account.move.line'].browse(line[1])
if line[2]:
if 'account_id' in line[2]:
if line[2]['account_id']:
account = self.env['account.account'].browse(line[2]['account_id'])
if account.account_credit_limit:
if 'debit' in line[2]:
new_debit = line[2]['debit']
else:
new_debit = account_lines.debit
if 'credit' in line[2]:
new_credit = line[2]['credit']
else:
new_credit = account_lines.credit
if (account.credit + new_credit - new_debit - account.debit) > account.account_credit_limit:
raise Warning(
_('Limit will Exceed .! \n Making this transaction will exceed the limit '
'defined for " %s " account') % account.name)
else:
account = account_lines.account_id
if account.account_credit_limit:
if 'debit' in line[2]:
if line[2]['debit']:
old_debit = account_lines.debit
if (account.credit - line[2]['debit'] - account.debit + old_debit) > account.account_credit_limit:
raise Warning(
_('Limit will Exceed .! \n Making this transaction will exceed the limit '
'defined for " %s " account') % account.name)
if 'credit' in line[2]:
if line[2]['credit']:
old_credit = account_lines.credit
if (account.credit+line[2]['credit']-account.debit-old_credit) > account.account_credit_limit:
raise Warning(
_('Limit will Exceed .! \n Making this transaction will exceed the limit '
'defined for " %s " account') % account.name)
result = super(AccountMove, self).write(vals)
return result

BIN
account_limit/static/description/Cash.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

BIN
account_limit/static/description/Tree view account.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
account_limit/static/description/Warning.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
account_limit/static/description/banner.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

BIN
account_limit/static/description/cybro_logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
account_limit/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

105
account_limit/static/description/index.html

@ -0,0 +1,105 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">Account Credit Limit</h2>
<h3 class="oe_slogan">Get total credit, total debit, balance of each account.</h3>
<h3 class="oe_slogan">Set credit limits for accounts.</h3>
<h4 class="oe_slogan"><a href="https://www.cybrosys.com">Cybrosys Technologies</a> </h4>
</div>
<div class="oe_row oe_spaced">
<h4><p style="margin-left: 42px;">Major Features:</p></h4>
<ul>
<li style="list-style:none !important;"><span style="color:green;"> &#9733;</span>&nbsp;&nbsp; Know Total Debit of an account.</li>
<li style="list-style:none !important;"><span style="color:green;"> &#9733;</span>&nbsp;&nbsp; Know Total Credit of an account.</li>
<li style="list-style:none !important;"><span style="color:green;"> &#9733;</span>&nbsp;&nbsp; Know Balance of the account.</li>
<li style="list-style:none !important;"><span style="color:green;"> &#9733;</span>&nbsp;&nbsp; Set the Credit limit for accounts.</li>
<li style="list-style:none !important;"><span style="color:green;"> &#9733;</span>&nbsp;&nbsp; Stop an account exceeding the credit limit.</li>
</ul>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div class="oe_picture">
<h3 class="oe_slogan">Overview</h3>
<p class="oe_mt32"> Account credit limit is a handy plugin for Odoo Accounting module to set a Credit limit for each Account. The module will bring new fields total Credit, Debit and Balance in ‘Accounts tree view’ and ‘Account form view’. The module also produce a warning message while making journal entries which will exceed the credit limit.
The features can simplify the credit evaluation process of accounts like Customers accounts, Overdraft accounts, Bank accounts etc.</p>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<p><h1>Account List/Tree view</h1> </p>
<p class="oe_mt32">
<p>Install the module and open chart of Accounts.</p>
</p>
<div class="oe_demo oe_picture oe_screenshot">
<img src="Tree view account.png">
</div>
</div>
<div class="oe_span12">
<p class="oe_mt32">
<p>You can see that a new tree view is created here which lists Debit, Credit, and Balance of the respective accounts.</p>
</p>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<p><h1>Account Form view</h1> </p>
<div class="oe_demo oe_picture oe_screenshot">
<img src="Cash.png">
</div>
</div>
<div class="oe_span12">
<p class="oe_mt32">
<p>The fields i.e. Debit, Credit, and Balance will be displayed in individual account form also.
From here you can set the credit limit for the individual account.</p>
</p>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<p><h1>Warning</h1> </p>
<p class="oe_mt32">
<p>The app will pop up a warning message while you make a journal entry which exceeds the credit limit.</p>
</p>
<div class="oe_demo oe_picture oe_screenshot">
<img src="Warning.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>

31
account_limit/views/account_credit_limit_view.xml

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="view_account_credit_limit_form" model="ir.ui.view">
<field name="name">account.account.form</field>
<field name="model">account.account</field>
<field name="inherit_id" ref="account.view_account_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='deprecated']" position="after">
<field name="debit"/>
<field name="credit"/>
<field name="balance"/>
<field name="account_credit_limit"/>
</xpath>
</field>
</record>
<record id="view_account_credit_limit_list" model="ir.ui.view">
<field name="name">account.account.list</field>
<field name="model">account.account</field>
<field name="inherit_id" ref="account.view_account_list"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='name']" position="after">
<field name="debit" invisible="True"/>
<field name="credit" invisible="True"/>
<field name="balance"/>
</xpath>
</field>
</record>
</data>
</odoo>
Loading…
Cancel
Save