Browse Source

[UPDT] Comma separator in dashboard 'base_accounting_kit'

pull/165/head
Ajmal JK 5 years ago
parent
commit
f4417ed3f8
  1. 2
      base_accounting_kit/__manifest__.py
  2. 8
      base_accounting_kit/doc/changelog.md
  3. 1
      base_accounting_kit/models/account_asset.py
  4. 29
      base_accounting_kit/models/account_dashboard.py
  5. 18
      base_accounting_kit/models/account_payment.py
  6. BIN
      base_accounting_kit/static/description/banner.gif
  7. BIN
      base_accounting_kit/static/description/images/base_accounting_kit_dashboard-1.png
  8. BIN
      base_accounting_kit/static/description/images/base_accounting_kit_dashboard-2.png
  9. 20
      base_accounting_kit/static/description/index.html
  10. 208
      base_accounting_kit/static/src/js/account_dashboard.js
  11. 14
      base_accounting_kit/views/account_payment_view.xml

2
base_accounting_kit/__manifest__.py

@ -22,7 +22,7 @@
{ {
'name': 'Odoo 13 Full Accounting Kit', 'name': 'Odoo 13 Full Accounting Kit',
'version': '13.0.4.7.8', 'version': '13.0.4.8.9',
'category': 'Accounting', 'category': 'Accounting',
'live_test_url': 'https://www.youtube.com/watch?v=peAp2Tx_XIs', 'live_test_url': 'https://www.youtube.com/watch?v=peAp2Tx_XIs',
'summary': """ Asset and Budget Management, 'summary': """ Asset and Budget Management,

8
base_accounting_kit/doc/changelog.md

@ -74,3 +74,11 @@
#### Version 13.0.4.7.8 #### Version 13.0.4.7.8
#### UPDT #### UPDT
- Report updated. - Report updated.
#### 10.06.2020
#### Version 13.0.4.8.9
#### UPDT
- Comma separator in Dashboard
- Currency symbol position in Dashboard
- Monthly invoice filter in Dashboard
- Check payment issue, in case of multi payment

1
base_accounting_kit/models/account_asset.py

@ -586,7 +586,6 @@ class AccountAssetAsset(models.Model):
res = super(AccountAssetAsset, self).write(vals) res = super(AccountAssetAsset, self).write(vals)
if 'depreciation_line_ids' not in vals and 'state' not in vals: if 'depreciation_line_ids' not in vals and 'state' not in vals:
for rec in self: for rec in self:
print("rec",rec)
rec.compute_depreciation_board() rec.compute_depreciation_board()
return res return res

29
base_accounting_kit/models/account_dashboard.py

@ -639,6 +639,7 @@ class DashBoard(models.Model):
self._cr.execute((''' select res_partner.name as customers, account_move.commercial_partner_id as parent, self._cr.execute((''' select res_partner.name as customers, account_move.commercial_partner_id as parent,
sum(account_move.amount_total) as amount from account_move, res_partner sum(account_move.amount_total) as amount from account_move, res_partner
where account_move.commercial_partner_id = res_partner.id where account_move.commercial_partner_id = res_partner.id
AND account_move.company_id = %s
AND account_move.type = 'out_invoice' AND account_move.type = 'out_invoice'
AND %s AND %s
AND Extract(month FROM account_move.invoice_date_due) = Extract(month FROM DATE(NOW())) AND Extract(month FROM account_move.invoice_date_due) = Extract(month FROM DATE(NOW()))
@ -646,13 +647,14 @@ class DashBoard(models.Model):
group by parent, customers group by parent, customers
order by amount desc order by amount desc
limit 10 limit 10
''') % (states_arg)) ''') % (company_id, states_arg))
record_invoice = self._cr.dictfetchall() record_invoice = self._cr.dictfetchall()
self._cr.execute((''' select res_partner.name as customers, account_move.commercial_partner_id as parent, self._cr.execute((''' select res_partner.name as customers, account_move.commercial_partner_id as parent,
sum(account_move.amount_total) as amount from account_move, res_partner sum(account_move.amount_total) as amount from account_move, res_partner
where account_move.commercial_partner_id = res_partner.id where account_move.commercial_partner_id = res_partner.id
AND account_move.company_id = %s
AND account_move.type = 'out_refund' AND account_move.type = 'out_refund'
AND %s AND %s
AND Extract(month FROM account_move.invoice_date_due) = Extract(month FROM DATE(NOW())) AND Extract(month FROM account_move.invoice_date_due) = Extract(month FROM DATE(NOW()))
@ -660,7 +662,7 @@ class DashBoard(models.Model):
group by parent, customers group by parent, customers
order by amount desc order by amount desc
limit 10 limit 10
''') % (states_arg)) ''') % (company_id, states_arg))
record_refund = self._cr.dictfetchall() record_refund = self._cr.dictfetchall()
else: else:
@ -668,6 +670,7 @@ class DashBoard(models.Model):
self._cr.execute((''' select res_partner.name as customers, account_move.commercial_partner_id as parent, self._cr.execute((''' select res_partner.name as customers, account_move.commercial_partner_id as parent,
sum(account_move.amount_total) as amount from account_move, res_partner sum(account_move.amount_total) as amount from account_move, res_partner
where account_move.commercial_partner_id = res_partner.id where account_move.commercial_partner_id = res_partner.id
AND account_move.company_id = %s
AND account_move.type = 'out_invoice' AND account_move.type = 'out_invoice'
AND %s AND %s
AND Extract(month FROM account_move.invoice_date_due) = ''' + str( AND Extract(month FROM account_move.invoice_date_due) = ''' + str(
@ -675,13 +678,14 @@ class DashBoard(models.Model):
group by parent, customers group by parent, customers
order by amount desc order by amount desc
limit 10 limit 10
''') % (states_arg)) ''') % (company_id, states_arg))
record_invoice = self._cr.dictfetchall() record_invoice = self._cr.dictfetchall()
self._cr.execute((''' select res_partner.name as customers, account_move.commercial_partner_id as parent, self._cr.execute((''' select res_partner.name as customers, account_move.commercial_partner_id as parent,
sum(account_move.amount_total) as amount from account_move, res_partner sum(account_move.amount_total) as amount from account_move, res_partner
where account_move.commercial_partner_id = res_partner.id where account_move.commercial_partner_id = res_partner.id
AND account_move.company_id = %s
AND account_move.type = 'out_refund' AND account_move.type = 'out_refund'
AND %s AND %s
AND Extract(month FROM account_move.invoice_date_due) = ''' + str( AND Extract(month FROM account_move.invoice_date_due) = ''' + str(
@ -689,7 +693,7 @@ class DashBoard(models.Model):
group by parent, customers group by parent, customers
order by amount desc order by amount desc
limit 10 limit 10
''') % (states_arg)) ''') % (company_id, states_arg))
record_refund = self._cr.dictfetchall() record_refund = self._cr.dictfetchall()
@ -928,7 +932,8 @@ class DashBoard(models.Model):
paid_supplier_refund_current_month = [item['supplier_refund_paid'] for item in paid_supplier_refund_current_month = [item['supplier_refund_paid'] for item in
result_paid_supplier_refund_current_month] result_paid_supplier_refund_current_month]
return customer_invoice_current_month, credit_note_current_month, supplier_invoice_current_month, refund_current_month, paid_customer_invoice_current_month, paid_supplier_invoice_current_month, paid_customer_credit_current_month, paid_supplier_refund_current_month currency = self.get_currency()
return customer_invoice_current_month, credit_note_current_month, supplier_invoice_current_month, refund_current_month, paid_customer_invoice_current_month, paid_supplier_invoice_current_month, paid_customer_credit_current_month, paid_supplier_refund_current_month, currency
@api.model @api.model
def get_total_invoice_this_month(self, *post): def get_total_invoice_this_month(self, *post):
@ -1162,10 +1167,12 @@ class DashBoard(models.Model):
def get_current_company_value(self): def get_current_company_value(self):
current_company = request.httprequest.cookies.get('cids') current_company = request.httprequest.cookies.get('cids')
if current_company: if current_company:
company_id = current_company[0] company_id = int(current_company[0])
else: else:
company_id = self.env.company.id company_id = self.env.company.id
return int(company_id) if company_id not in self.env.user.company_ids.ids:
company_id = self.env.company.id
return company_id
@api.model @api.model
def profit_income_this_year(self, *post): def profit_income_this_year(self, *post):
@ -1263,8 +1270,12 @@ class DashBoard(models.Model):
def get_currency(self): def get_currency(self):
current_company = self.env['res.company'].browse(self.get_current_company_value()) current_company = self.env['res.company'].browse(self.get_current_company_value())
default = current_company.currency_id or self.env.ref('base.main_company').currency_id default = current_company.currency_id or self.env.ref('base.main_company').currency_id
default = default.symbol lang = self.env.user.lang
return default if not lang:
lang = 'en_US'
lang = lang.replace("_", '-')
currency = {'position': default.position, 'symbol': default.symbol, 'language': lang}
return currency
# function to get total expense # function to get total expense

18
base_accounting_kit/models/account_payment.py

@ -32,14 +32,20 @@ class AccountRegisterPayments(models.TransientModel):
help='Effective date of PDC', copy=False, help='Effective date of PDC', copy=False,
default=False) default=False)
def get_payments_vals(self): def _prepare_payment_vals(self, invoices):
res = super(AccountRegisterPayments, self).get_payments_vals() res = super(AccountRegisterPayments, self)._prepare_payment_vals(invoices)
if self.payment_method_id == self.env.ref( # Check payment method is Check or PDC
'account_check_printing.account_payment_method_check'): check_pdc_ids = self.env['account.payment.method'].search([('code', 'in', ['pdc', 'check_printing'])])
if self.payment_method_id.id in check_pdc_ids.ids:
currency_id = self.env['res.currency'].browse(res['currency_id'])
journal_id = self.env['account.journal'].browse(res['journal_id'])
# Updating values in case of Multi payments
res.update({ res.update({
'check_amount_in_words': self.check_amount_in_words, 'bank_reference': self.bank_reference,
'check_manual_sequencing': self.check_manual_sequencing, 'cheque_reference': self.cheque_reference,
'check_manual_sequencing': journal_id.check_manual_sequencing,
'effective_date': self.effective_date, 'effective_date': self.effective_date,
'check_amount_in_words': currency_id.amount_to_text(res['amount']),
}) })
return res return res

BIN
base_accounting_kit/static/description/banner.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 71 KiB

BIN
base_accounting_kit/static/description/images/base_accounting_kit_dashboard-1.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 89 KiB

BIN
base_accounting_kit/static/description/images/base_accounting_kit_dashboard-2.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 91 KiB

20
base_accounting_kit/static/description/index.html

@ -8,19 +8,25 @@
<div class="row" <div class="row"
style="margin:75px 0;position: relative;color: #000;background-position: center;background: #ffffff;border-bottom: 1px solid #e4e4e4; padding-bottom: 30px;"> style="margin:75px 0;position: relative;color: #000;background-position: center;background: #ffffff;border-bottom: 1px solid #e4e4e4; padding-bottom: 30px;">
<div class="col-md-7 col-sm-12 col-xs-12" style="padding: 0px"> <div class="col-md-7 col-sm-12 col-xs-12" style="padding: 0px">
<h2 style="font-weight: 600;font-size: 1.8rem;margin-top: 15px;"><i>Latest Updates</i></h2>
<ul style=" padding: 0 1px; list-style: none;">
<li style="display: flex;align-items: center;padding: 8px 0;font-size: 19px;"><img src="images/checked.png" style=" width: 19px; margin-right: 6px; " alt="check">
Comma separator added in Dashboard
</li>
<li style="display: flex;align-items: center;padding: 8px 0;font-size: 19px;"><img src="images/checked.png" style=" width: 19px; margin-right: 6px; " alt="check">
Updated currency symbol position in Dashboard
</li>
<li style="display: flex;align-items: center;padding: 8px 0;font-size: 19px;"><img src="images/checked.png" style=" width: 19px; margin-right: 6px; " alt="check">
Accounting Dashboard.
</li>
<li style="display: flex;align-items: center;padding: 8px 0;font-size: 18px;"></li>
</ul>
<div style=" margin: 0 0 0px;padding: 20px 0 10;font-size: 23px;line-height: 35px;font-weight: 400;color: #000;border-top: 1px solid rgba(255,255,255,0.1);border-bottom: 1px solid rgba(255,255,255,0.11);text-align: left;"> <div style=" margin: 0 0 0px;padding: 20px 0 10;font-size: 23px;line-height: 35px;font-weight: 400;color: #000;border-top: 1px solid rgba(255,255,255,0.1);border-bottom: 1px solid rgba(255,255,255,0.11);text-align: left;">
<h1 style="font-size: 39px;font-weight: 600;margin: 0px !important;">Odoo 13 Accounting</h1> <h1 style="font-size: 39px;font-weight: 600;margin: 0px !important;">Odoo 13 Accounting</h1>
<h3 style="font-size: 21px;margin-top: 8px;position: relative;">Dashboard, Asset Management, Accounting Reports, PDC Management, <h3 style="font-size: 21px;margin-top: 8px;position: relative;">Dashboard, Asset Management, Accounting Reports, PDC Management,
Account Lock dates, Customer Credit Limit and Follow Ups, Day book, Account Lock dates, Customer Credit Limit and Follow Ups, Day book,
Bank book and Cash book reports in Odoo 13 community edition.</h3> Bank book and Cash book reports in Odoo 13 community edition.</h3>
</div> </div>
<h2 style="font-weight: 600;font-size: 1.8rem;margin-top: 15px;">New Feature</h2>
<ul style=" padding: 0 1px; list-style: none;">
<li style="display: flex;align-items: center;padding: 8px 0;font-size: 18px;"><img src="images/checked.png" style=" width: 22px; margin-right: 6px; " alt="check">
Accounting Dashboard.
</li>
<li style="display: flex;align-items: center;padding: 8px 0;font-size: 18px;"></li>
</ul>
<h2 style="font-weight: 600;font-size: 1.8rem;margin-top: 15px;">Key Highlights</h2> <h2 style="font-weight: 600;font-size: 1.8rem;margin-top: 15px;">Key Highlights</h2>
<ul style=" padding: 0 1px; list-style: none; "> <ul style=" padding: 0 1px; list-style: none; ">
<li style="display: flex;align-items: center;padding: 8px 0;font-size: 18px;"><img src="images/checked.png" style=" width: 22px; margin-right: 6px; " alt="check"> <li style="display: flex;align-items: center;padding: 8px 0;font-size: 18px;"><img src="images/checked.png" style=" width: 22px; margin-right: 6px; " alt="check">

208
base_accounting_kit/static/src/js/account_dashboard.js

@ -79,11 +79,17 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) {
var selected = $('.btn.btn-tool.income'); var selected = $('.btn.btn-tool.income');
var data = $(selected[0]).data(); var data = $(selected[0]).data();
var posted = false; var posted = false;
var self = this;
var f = f; var f = f;
if ($('#toggle-two')[0].checked == true) { if ($('#toggle-two')[0].checked == true) {
posted = "posted" posted = "posted"
} }
rpc.query({
model: "account.move",
method: "get_currency",
}).then(function (result) {
currency = result;
})
rpc.query({ rpc.query({
model: "account.move", model: "account.move",
method: "get_top_10_customers_month", method: "get_top_10_customers_month",
@ -99,7 +105,8 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) {
var due_count = 0; var due_count = 0;
_.forEach(result, function (x) { _.forEach(result, function (x) {
due_count++; due_count++;
$('#top_10_customers_this_month').append('<li><div id="line_' + x.parent + '" data-user-id="' + x.parent + '">' + x.customers + '</div>' + '<div id="line_' + x.parent + '" data-user-id="' + x.parent + '">' + x.amount.toFixed(2) + ' ' + currency + '</div>' + '</li>'); var amount = self.format_currency(currency, x.amount);
$('#top_10_customers_this_month').append('<li><div id="line_' + x.parent + '" data-user-id="' + x.parent + '">' + x.customers + '</div>' + '<div id="line_' + x.parent + '" data-user-id="' + x.parent + '">' + amount + '</div>' + '</li>');
}); });
}) })
@ -349,10 +356,18 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) {
var selected = $('.btn.btn-tool.selected'); var selected = $('.btn.btn-tool.selected');
var data = $(selected[0]).data(); var data = $(selected[0]).data();
var posted = false; var posted = false;
var self = this;
if ($('#toggle-two')[0].checked == true) { if ($('#toggle-two')[0].checked == true) {
posted = "posted" posted = "posted"
} }
rpc.query({
model: "account.move",
method: "get_currency",
}).then(function (result) {
currency = result;
})
rpc.query({ rpc.query({
model: "account.move", model: "account.move",
method: "get_total_invoice_current_year", method: "get_total_invoice_current_year",
@ -409,6 +424,11 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) {
$('#tot_invoice_current_year').attr("value", customer_invoice_paid_current_year); $('#tot_invoice_current_year').attr("value", customer_invoice_paid_current_year);
$('#tot_invoice_current_year').attr("max", customer_invoice_total_current_year); $('#tot_invoice_current_year').attr("max", customer_invoice_total_current_year);
customer_invoice_paid_current_year = self.format_currency(currency, customer_invoice_paid_current_year);
customer_invoice_total_current_year = self.format_currency(currency, customer_invoice_total_current_year);
supplier_invoice_paid_current_year = self.format_currency(currency, supplier_invoice_paid_current_year);
supplier_invoice_total_current_year = self.format_currency(currency, supplier_invoice_total_current_year);
$('#total_customer_invoice_paid_current_year').append('<div class="logo">' + '<span>' + customer_invoice_paid_current_year + '</span><span>Total Paid<span></div>'); $('#total_customer_invoice_paid_current_year').append('<div class="logo">' + '<span>' + customer_invoice_paid_current_year + '</span><span>Total Paid<span></div>');
$('#total_customer_invoice_current_year').append('<div" class="logo">' + '<span>' + customer_invoice_total_current_year + '</span><span>Total Invoice <span></div>'); $('#total_customer_invoice_current_year').append('<div" class="logo">' + '<span>' + customer_invoice_total_current_year + '</span><span>Total Invoice <span></div>');
@ -422,40 +442,46 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) {
var selected = $('.btn.btn-tool.selected'); var selected = $('.btn.btn-tool.selected');
var data = $(selected[0]).data(); var data = $(selected[0]).data();
var posted = false; var posted = false;
var self = this;
if ($('#toggle-two')[0].checked == true) { if ($('#toggle-two')[0].checked == true) {
posted = "posted" posted = "posted"
} }
rpc.query({
model: "account.move",
method: "get_currency",
}).then(function (result) {
currency = result;
})
rpc.query({ rpc.query({
model: "account.move", model: "account.move",
method: "get_total_invoice_current_month", method: "get_total_invoice_current_month",
args: [posted], args: [posted],
}) })
.then(function (result) { .then(function (result) {
$('#total_supplier_invoice_paid').hide();
// $('#total_supplier_invoice_paid').hide(); $('#total_supplier_invoice').hide();
// $('#total_supplier_invoice').hide(); $('#total_customer_invoice_paid').hide();
// $('#total_customer_invoice_paid').hide(); $('#total_customer_invoice').hide();
// $('#total_customer_invoice').hide(); $('#tot_invoice').hide();
// $('#tot_invoice').hide(); $('#tot_supplier_inv').hide();
// $('#tot_supplier_inv').hide(); $('#total_supplier_invoice_paid_current_month').empty();
// $('#total_supplier_invoice_paid_current_month').empty(); $('#total_supplier_invoice_current_month').empty();
// $('#total_supplier_invoice_current_month').empty(); $('#total_customer_invoice_paid_current_month').empty();
// $('#total_customer_invoice_paid_current_month').empty(); $('#total_customer_invoice_current_month').empty();
// $('#total_customer_invoice_current_month').empty(); $('#tot_invoice_current_month').empty();
// $('#tot_invoice_current_month').empty(); $('#tot_supplier_inv_current_month').empty();
// $('#tot_supplier_inv_current_month').empty(); $('#total_supplier_invoice_paid_current_year').hide();
// $('#total_supplier_invoice_paid_current_year').hide(); $('#total_supplier_invoice_current_year').hide();
// $('#total_supplier_invoice_current_year').hide(); $('#total_customer_invoice_paid_current_year').hide();
// $('#total_customer_invoice_paid_current_year').hide(); $('#total_customer_invoice_current_year').hide();
// $('#total_customer_invoice_current_year').hide(); $('#tot_invoice_current_year').hide();
// $('#tot_invoice_current_year').hide(); $('#tot_supplier_inv_current_year').hide();
// $('#tot_supplier_inv_current_year').hide(); $('#total_supplier_invoice_paid_current_month').show();
// $('#total_supplier_invoice_paid_current_month').show(); $('#total_supplier_invoice_current_month').show();
// $('#total_supplier_invoice_current_month').show(); $('#total_customer_invoice_paid_current_month').show();
// $('#total_customer_invoice_paid_current_month').show(); $('#total_customer_invoice_current_month').show();
// $('#total_customer_invoice_current_month').show(); $('#tot_invoice_current_month').show();
// $('#tot_invoice_current_month').show(); $('#tot_supplier_inv_current_month').show();
// $('#tot_supplier_inv_current_month').show();
var tot_invoice_current_month = result[0][0] var tot_invoice_current_month = result[0][0]
var tot_credit_current_month = result[1][0] var tot_credit_current_month = result[1][0]
var tot_supplier_inv_current_month = result[2][0] var tot_supplier_inv_current_month = result[2][0]
@ -477,6 +503,12 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) {
$('#tot_invoice_current_month').attr("value", customer_invoice_paid_current_month); $('#tot_invoice_current_month').attr("value", customer_invoice_paid_current_month);
$('#tot_invoice_current_month').attr("max", customer_invoice_total_current_month); $('#tot_invoice_current_month').attr("max", customer_invoice_total_current_month);
customer_invoice_paid_current_month = self.format_currency(currency, customer_invoice_paid_current_month);
customer_invoice_total_current_month = self.format_currency(currency, customer_invoice_total_current_month);
supplier_invoice_paid_current_month = self.format_currency(currency, supplier_invoice_paid_current_month);
supplier_invoice_total_current_month = self.format_currency(currency, supplier_invoice_total_current_month);
$('#total_customer_invoice_paid_current_month').append('<div class="logo">' + '<span>' + customer_invoice_paid_current_month + '</span><span>Total Paid<span></div>'); $('#total_customer_invoice_paid_current_month').append('<div class="logo">' + '<span>' + customer_invoice_paid_current_month + '</span><span>Total Paid<span></div>');
$('#total_customer_invoice_current_month').append('<div" class="logo">' + '<span>' + customer_invoice_total_current_month + '</span><span>Total Invoice<span></div>'); $('#total_customer_invoice_current_month').append('<div" class="logo">' + '<span>' + customer_invoice_total_current_month + '</span><span>Total Invoice<span></div>');
@ -578,7 +610,6 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) {
args: [posted,f], args: [posted,f],
}) })
.then(function (result) { .then(function (result) {
// Doughnut Chart // Doughnut Chart
$(document).ready(function () { $(document).ready(function () {
var options = { var options = {
@ -709,7 +740,9 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) {
}) })
}, },
renderElement: function (ev) { renderElement: function (ev) {
var self = this;
$.when(this._super()) $.when(this._super())
.then(function (ev) { .then(function (ev) {
@ -923,6 +956,11 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) {
$('#tot_invoice_current_month').attr("value", customer_invoice_paid_current_month); $('#tot_invoice_current_month').attr("value", customer_invoice_paid_current_month);
$('#tot_invoice_current_month').attr("max", customer_invoice_total_current_month); $('#tot_invoice_current_month').attr("max", customer_invoice_total_current_month);
currency = result[8]
customer_invoice_paid_current_month = self.format_currency(currency, customer_invoice_paid_current_month);
customer_invoice_total_current_month = self.format_currency(currency, customer_invoice_total_current_month);
supplier_invoice_paid_current_month = self.format_currency(currency, supplier_invoice_paid_current_month);
supplier_invoice_total_current_month = self.format_currency(currency, supplier_invoice_total_current_month);
$('#total_customer_invoice_paid_current_month').append('<div class="logo">' + '<span>' + customer_invoice_paid_current_month + '</span><span>Total Paid<span></div>'); $('#total_customer_invoice_paid_current_month').append('<div class="logo">' + '<span>' + customer_invoice_paid_current_month + '</span><span>Total Paid<span></div>');
$('#total_customer_invoice_current_month').append('<div" class="logo">' + '<span>' + customer_invoice_total_current_month + '</span><span>Total Invoice<span></div>'); $('#total_customer_invoice_current_month').append('<div" class="logo">' + '<span>' + customer_invoice_total_current_month + '</span><span>Total Invoice<span></div>');
@ -1011,11 +1049,12 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) {
args: [posted,f] args: [posted,f]
}).then(function (result) { }).then(function (result) {
var due_count = 0; var due_count = 0;
var amount;
_.forEach(result, function (x) { _.forEach(result, function (x) {
$('#top_10_customers_this_month').show(); $('#top_10_customers_this_month').show();
due_count++; due_count++;
$('#top_10_customers_this_month').append('<li><div id="line_' + x.parent + '" data-user-id="' + x.parent + '">' + x.customers + '</div>' + '<div id="line_' + x.parent + '" data-user-id="' + x.parent + '">' + x.amount.toFixed(2) + ' ' + currency + '</div>' + '</li>'); amount = self.format_currency(currency, x.amount);
$('#top_10_customers_this_month').append('<li><div id="line_' + x.parent + '" data-user-id="' + x.parent + '">' + x.customers + '</div>' + '<div id="line_' + x.parent + '" data-user-id="' + x.parent + '">' + amount + '</div>' + '</li>');
}); });
}) })
@ -1026,10 +1065,12 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) {
}) })
.then(function (result) { .then(function (result) {
var banks = result['banks']; var banks = result['banks'];
var amount;
var balance = result['banking']; var balance = result['banking'];
for (var k = 0; k < banks.length; k++) { for (var k = 0; k < banks.length; k++) {
amount = self.format_currency(currency, balance[k]);
// $('#charts').append('<li><a ' + banks[k] + '" data-user-id="' + banks[k] + '">' + banks[k] + '</a>'+ '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + '<span>'+ balance[k] +'</span>' + '</li>' ); // $('#charts').append('<li><a ' + banks[k] + '" data-user-id="' + banks[k] + '">' + banks[k] + '</a>'+ '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + '<span>'+ balance[k] +'</span>' + '</li>' );
$('#current_bank_balance').append('<li><div>' + banks[k] + '</div><div>' + balance[k].toFixed(2) + '&nbsp;' + currency + '</div></li>'); $('#current_bank_balance').append('<li><div>' + banks[k] + '</div><div>' + amount + '</div></li>');
// $('#current_bank_balance').append('<li>' + banks[k] +'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+ balance[k] + '</li>' ); // $('#current_bank_balance').append('<li>' + banks[k] +'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+ balance[k] + '</li>' );
$('#drop_charts_balance').append('<li>' + balance[k].toFixed(2) + '</li>'); $('#drop_charts_balance').append('<li>' + balance[k].toFixed(2) + '</li>');
} }
@ -1129,8 +1170,8 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) {
.then(function (result) { .then(function (result) {
var income = result[0].debit - result[0].credit; var income = result[0].debit - result[0].credit;
income = -income; income = -income;
income = self.format_currency(currency, income);
$('#total_income').append('<span>' + income.toFixed(2) + ' ' + currency + '</span>') $('#total_income').append('<span>' + income + '</span>')
}) })
rpc.query({ rpc.query({
model: "account.move", model: "account.move",
@ -1140,13 +1181,14 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) {
.then(function (result) { .then(function (result) {
var incomes_ = result[0].debit - result[0].credit; var incomes_ = result[0].debit - result[0].credit;
if (incomes_) { if (incomes_) {
incomes_ = -incomes_.toFixed(2); incomes_ = -incomes_;
incomes_ = self.format_currency(currency, incomes_);
$('#total_incomes_').append('<span>' + incomes_.toFixed(2) + ' ' + currency + '</span><div class="title">This month</div>') $('#total_incomes_').append('<span>' + incomes_ + '</span><div class="title">This month</div>')
} else { } else {
incomes_ = -incomes_.toFixed(2); incomes_ = -incomes_;
$('#total_incomes_').append('<span>' + 0.0 + ' ' + currency + '</span><div class="title">This month</div>') incomes_ = self.format_currency(currency, incomes_);
$('#total_incomes_').append('<span>' + incomes_ + '</span><div class="title">This month</div>')
} }
}) })
@ -1157,8 +1199,8 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) {
.then(function (result) { .then(function (result) {
var incomes_last = result[0].debit - result[0].credit; var incomes_last = result[0].debit - result[0].credit;
incomes_last = -incomes_last; incomes_last = -incomes_last;
incomes_last = self.format_currency(currency, incomes_last);
$('#total_incomes_last').append('<span>' + incomes_last + ' ' + currency + '</span><div class="title">Last month</div>') $('#total_incomes_last').append('<span>' + incomes_last + '</span><div class="title">Last month</div>')
}) })
rpc.query({ rpc.query({
@ -1167,8 +1209,9 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) {
}) })
.then(function (result) { .then(function (result) {
var expense = result[0].debit - result[0].credit; var expense = result[0].debit - result[0].credit;
var expenses = expense.toFixed() var expenses = expense;
$('#total_expense').append('<span>' + expenses + ' ' + currency + '</span>') expenses = self.format_currency(currency, expenses);
$('#total_expense').append('<span>' + expenses + '</span>')
}) })
rpc.query({ rpc.query({
model: "account.move", model: "account.move",
@ -1178,11 +1221,13 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) {
var expense_this_month = result[0].debit - result[0].credit; var expense_this_month = result[0].debit - result[0].credit;
if (expense_this_month) { if (expense_this_month) {
var expenses_this_month_ = expense_this_month.toFixed(2) var expenses_this_month_ = expense_this_month;
$('#total_expenses_').append('<span>' + expenses_this_month_ + ' ' + currency + '</span><div class="title">This month</div>') expenses_this_month_ = self.format_currency(currency, expenses_this_month_);
$('#total_expenses_').append('<span>' + expenses_this_month_ + '</span><div class="title">This month</div>')
} else { } else {
var expenses_this_month_ = expense_this_month.toFixed(2) var expenses_this_month_ = expense_this_month;
$('#total_expenses_').append('<span>' + 0.0 + ' ' + currency + '</span><div class="title">This month</div>') expenses_this_month_ = self.format_currency(currency, expenses_this_month_);
$('#total_expenses_').append('<span>' + expenses_this_month_ + '</span><div class="title">This month</div>')
} }
}) })
@ -1194,13 +1239,13 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) {
var expense_this_year = result[0].debit - result[0].credit; var expense_this_year = result[0].debit - result[0].credit;
if (expense_this_year) { if (expense_this_year) {
var expenses_this_year_ = expense_this_year.toFixed(2) var expenses_this_year_ = expense_this_year;
expenses_this_year_ = self.format_currency(currency, expenses_this_year_);
$('#total_expense_this_year').append('<span >' + expenses_this_year_ + ' ' + currency + '</span><div class="title">This Year</div>') $('#total_expense_this_year').append('<span >' + expenses_this_year_ + '</span><div class="title">This Year</div>')
} else { } else {
var expenses_this_year_ = expense_this_year.toFixed(2) var expenses_this_year_ = expense_this_year;
expenses_this_year_ = self.format_currency(currency, expenses_this_year_);
$('#total_expense_this_year').append('<span >' + 0.0 + ' ' + currency + '</span><div class="title">This Year</div>') $('#total_expense_this_year').append('<span >' + expenses_this_year_ + '</span><div class="title">This Year</div>')
} }
}) })
rpc.query({ rpc.query({
@ -1210,8 +1255,8 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) {
.then(function (result) { .then(function (result) {
var incomes_last_year = result[0].debit - result[0].credit; var incomes_last_year = result[0].debit - result[0].credit;
incomes_last_year = -incomes_last_year incomes_last_year = -incomes_last_year
incomes_last_year = self.format_currency(currency, incomes_last_year);
$('#total_incomes_last_year').append('<span>' + incomes_last_year + '' + currency + '</span><div class="title">Last Year</div>') $('#total_incomes_last_year').append('<span>' + incomes_last_year + '</span><div class="title">Last Year</div>')
}) })
rpc.query({ rpc.query({
model: "account.move", model: "account.move",
@ -1221,13 +1266,13 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) {
.then(function (result) { .then(function (result) {
var incomes_this_year = result[0].debit - result[0].credit; var incomes_this_year = result[0].debit - result[0].credit;
if (incomes_this_year) { if (incomes_this_year) {
incomes_this_year = -incomes_this_year;
incomes_this_year = -incomes_this_year.toFixed(2); incomes_this_year = self.format_currency(currency, incomes_this_year);
$('#total_incomes_this_year').append('<span>' + incomes_this_year + '</span><div class="title">This Year</div>')
$('#total_incomes_this_year').append('<span>' + incomes_this_year.toFixed(2) + ' ' + currency + '</span><div class="title">This Year</div>')
} else { } else {
incomes_this_year = -incomes_this_year.toFixed(2); incomes_this_year = -incomes_this_year;
$('#total_incomes_this_year').append('<span>' + 0.0 + '' + currency + '</span><div class="title">This Year</div>') incomes_this_year = self.format_currency(currency, incomes_this_year);
$('#total_incomes_this_year').append('<span>' + incomes_this_year + '</span><div class="title">This Year</div>')
} }
}) })
@ -1260,16 +1305,18 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) {
} }
var profit_this_months = net_profit; var profit_this_months = net_profit;
if (profit_this_months) { if (profit_this_months) {
var net_profit_this_months = profit_this_months.toFixed(2) var net_profit_this_months = profit_this_months;
net_profit_this_months = self.format_currency(currency, net_profit_this_months);
$('#net_profit_this_months').empty(); $('#net_profit_this_months').empty();
$('#net_profit_this_months').append('<div class="title">Net Profit/Loss &nbsp;&nbsp;&nbsp;</div><span>' + net_profit_this_months + ' ' + currency + '</span>') $('#net_profit_this_months').append('<div class="title">Net Profit/Loss &nbsp;&nbsp;&nbsp;</div><span>' + net_profit_this_months + '</span>')
$('#net_profit_current_months').append('<span>' + net_profit_this_months + ' ' + currency + '</span> <div class="title">This Month</div>') $('#net_profit_current_months').append('<span>' + net_profit_this_months + '</span> <div class="title">This Month</div>')
} else { } else {
var net_profit_this_months = profit_this_months.toFixed(2) var net_profit_this_months = profit_this_months;
net_profit_this_months = self.format_currency(currency, net_profit_this_months);
$('#net_profit_this_months').empty(); $('#net_profit_this_months').empty();
$('#net_profit_this_months').append('<div class="title">Net Profit/Loss &nbsp;&nbsp;&nbsp;</div><span>' + 0.0 + ' ' + currency + '</span>') $('#net_profit_this_months').append('<div class="title">Net Profit/Loss &nbsp;&nbsp;&nbsp;</div><span>' + net_profit_this_months + '</span>')
$('#net_profit_current_months').append('<span>' + 0.0 + ' ' + currency + '</span> <div class="title">This Month</div>') $('#net_profit_current_months').append('<span>' + net_profit_this_months + '</span> <div class="title">This Month</div>')
} }
}) })
@ -1302,24 +1349,37 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) {
} else { } else {
net_profit = -result[1] - result[0] net_profit = -result[1] - result[0]
} }
var profit_this_year = net_profit; var profit_this_year = net_profit;
if (profit_this_year) { if (profit_this_year) {
var net_profit_this_year = profit_this_year.toFixed(2) var net_profit_this_year = profit_this_year;
net_profit_this_year = self.format_currency(currency, net_profit_this_year);
$('#net_profit_this_year').empty(); $('#net_profit_this_year').empty();
$('#net_profit_this_year').append('<div class="title">Net Profit/Loss &nbsp;&nbsp;&nbsp;</div><span>' + net_profit_this_year + ' ' + currency + '</span>') $('#net_profit_this_year').append('<div class="title">Net Profit/Loss &nbsp;&nbsp;&nbsp;</div><span>' + net_profit_this_year + '</span>')
$('#net_profit_current_year').append('<span>' + net_profit_this_year + ' ' + currency + '</span> <div class="title">This Year</div>') $('#net_profit_current_year').append('<span>' + net_profit_this_year + '</span> <div class="title">This Year</div>')
} else { } else {
var net_profit_this_year = profit_this_year.toFixed(2) var net_profit_this_year = profit_this_year;
net_profit_this_year = self.format_currency(currency, net_profit_this_year);
$('#net_profit_this_year').empty(); $('#net_profit_this_year').empty();
$('#net_profit_this_year').append('<div class="title">Net Profit/Loss &nbsp;&nbsp;&nbsp;</div><span>' + 0.0 + ' ' + currency + '</span>') $('#net_profit_this_year').append('<div class="title">Net Profit/Loss &nbsp;&nbsp;&nbsp;</div><span>' + net_profit_this_year + '</span>')
$('#net_profit_current_year').append('<span>' + 0.0 + ' ' + currency + '</span> <div class="title">This Year</div>') $('#net_profit_current_year').append('<span>' + net_profit_this_year + '</span> <div class="title">This Year</div>')
} }
}) })
}); });
}, },
format_currency: function(currency, amount){
if (typeof(amount) != 'number'){
amount = parseFloat(amount);
}
var formatted_value = (parseInt(amount)).toLocaleString(currency.language, {minimumFractionDigits: 2})
if (currency.position === "after") {
return formatted_value += ' ' + currency.symbol;
} else {
return currency.symbol + ' ' + formatted_value;
}
},
willStart: function () { willStart: function () {
var self = this; var self = this;
self.drpdn_show = false; self.drpdn_show = false;

14
base_accounting_kit/views/account_payment_view.xml

@ -33,4 +33,18 @@
</xpath> </xpath>
</field> </field>
</record> </record>
<!-- For multiple payments -->
<record model="ir.ui.view" id="view_account_reg_payment_form_check_pdc">
<field name="name">view.account.reg.payment.form.check.pdc</field>
<field name="model">account.payment.register</field>
<field name="inherit_id" ref="account.view_account_payment_form_multi"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='payment_date']" position="after">
<field name="effective_date"/>
<field name="bank_reference"/>
<field name="cheque_reference"/>
</xpath>
</field>
</record>
</odoo> </odoo>
Loading…
Cancel
Save