Browse Source

[UPDT] Actions added in dashboard

pull/165/head
Ajmal Cybro 4 years ago
parent
commit
b798334ab7
  1. 2
      base_accounting_kit/__manifest__.py
  2. 5
      base_accounting_kit/doc/changelog.md
  3. 356
      base_accounting_kit/models/account_dashboard.py
  4. 362
      base_accounting_kit/static/src/js/account_dashboard.js

2
base_accounting_kit/__manifest__.py

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

5
base_accounting_kit/doc/changelog.md

@ -98,3 +98,8 @@
#### Version 13.0.4.9.12
#### UPDT
- Field parameter spelling mistake
#### 12.12.2020
#### Version 13.0.4.9.13
#### UPDT
- Actions added in dashboard

356
base_accounting_kit/models/account_dashboard.py

@ -421,9 +421,9 @@ class DashBoard(models.Model):
states_arg = ""
if post != ('posted',):
states_arg = """ state in ('posted', 'draft')"""
states_arg = """ account_move.state in ('posted', 'draft')"""
else:
states_arg = """ state = 'posted'"""
states_arg = """ account_move.state = 'posted'"""
self._cr.execute((''' select res_partner.name as partner, res_partner.commercial_partner_id as res ,
account_move.commercial_partner_id as parent, sum(account_move.amount_total) as amount
@ -470,9 +470,9 @@ class DashBoard(models.Model):
states_arg = ""
if post != ('posted',):
states_arg = """ state in ('posted', 'draft')"""
states_arg = """ account_move.state in ('posted', 'draft')"""
else:
states_arg = """ state = 'posted'"""
states_arg = """ account_move.state = 'posted'"""
self._cr.execute((''' select res_partner.name as partner, res_partner.commercial_partner_id as res ,
account_move.commercial_partner_id as parent, sum(account_move.amount_total) as amount
@ -513,9 +513,9 @@ class DashBoard(models.Model):
states_arg = ""
if post[0] != 'posted':
states_arg = """ state in ('posted', 'draft')"""
states_arg = """ account_move.state in ('posted', 'draft')"""
else:
states_arg = """ state = 'posted'"""
states_arg = """ account_move.state = 'posted'"""
company_id = self.get_current_company_value()
if post[1] == 'this_month':
@ -573,9 +573,9 @@ class DashBoard(models.Model):
states_arg = ""
if post[0] != 'posted':
states_arg = """ state in ('posted', 'draft')"""
states_arg = """ account_move.state in ('posted', 'draft')"""
else:
states_arg = """ state = 'posted'"""
states_arg = """ account_move.state = 'posted'"""
if post[1] == 'this_month':
self._cr.execute(('''
@ -629,12 +629,11 @@ class DashBoard(models.Model):
record_invoice = {}
record_refund = {}
company_id = self.get_current_company_value()
states_arg = ""
if post[0] != 'posted':
states_arg = """ state in ('posted', 'draft')"""
states_arg = """ account_move.state in ('posted', 'draft')"""
else:
states_arg = """ state = 'posted'"""
states_arg = """ account_move.state = 'posted'"""
if post[1] == 'this_month':
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
@ -642,28 +641,25 @@ class DashBoard(models.Model):
AND account_move.company_id in %s
AND account_move.type = 'out_invoice'
AND %s
AND Extract(month FROM account_move.invoice_date_due) = Extract(month FROM DATE(NOW()))
AND Extract(YEAR FROM account_move.invoice_date_due) = Extract(YEAR FROM DATE(NOW()))
AND Extract(month FROM account_move.invoice_date) = Extract(month FROM DATE(NOW()))
AND Extract(YEAR FROM account_move.invoice_date) = Extract(YEAR FROM DATE(NOW()))
group by parent, customers
order by amount desc
limit 10
''') % (tuple(company_id), states_arg))
record_invoice = self._cr.dictfetchall()
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
where account_move.commercial_partner_id = res_partner.id
AND account_move.company_id in %s
AND account_move.type = 'out_refund'
AND %s
AND Extract(month FROM account_move.invoice_date_due) = Extract(month FROM DATE(NOW()))
AND Extract(YEAR FROM account_move.invoice_date_due) = Extract(YEAR FROM DATE(NOW()))
AND Extract(month FROM account_move.invoice_date) = Extract(month FROM DATE(NOW()))
AND Extract(YEAR FROM account_move.invoice_date) = Extract(YEAR FROM DATE(NOW()))
group by parent, customers
order by amount desc
limit 10
''') % (tuple(company_id), states_arg))
record_refund = self._cr.dictfetchall()
else:
one_month_ago = (datetime.now() - relativedelta(months=1)).month
@ -673,30 +669,26 @@ class DashBoard(models.Model):
AND account_move.company_id in %s
AND account_move.type = 'out_invoice'
AND %s
AND Extract(month FROM account_move.invoice_date_due) = ''' + str(
AND Extract(month FROM account_move.invoice_date) = ''' + str(
one_month_ago) + '''
group by parent, customers
order by amount desc
limit 10
''') % (tuple(company_id), states_arg))
record_invoice = self._cr.dictfetchall()
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
where account_move.commercial_partner_id = res_partner.id
AND account_move.company_id in %s
AND account_move.type = 'out_refund'
AND %s
AND Extract(month FROM account_move.invoice_date_due) = ''' + str(
AND Extract(month FROM account_move.invoice_date) = ''' + str(
one_month_ago) + '''
group by parent, customers
order by amount desc
limit 10
''') % (tuple(company_id), states_arg))
record_refund = self._cr.dictfetchall()
summed = []
for out_sum in record_invoice:
parent = out_sum['parent']
@ -709,7 +701,6 @@ class DashBoard(models.Model):
'amount': su,
'parent': parent
})
return summed
# function to get total invoice
@ -843,6 +834,7 @@ class DashBoard(models.Model):
result_refund_current_month = [{'refund': 0.0}]
self._cr.execute(('''select sum(amount_total_signed) - sum(amount_residual_signed) as customer_invoice_paid from account_move where type ='out_invoice'
AND %s
AND invoice_payment_state = 'paid'
AND Extract(month FROM account_move.date) = Extract(month FROM DATE(NOW()))
AND Extract(YEAR FROM account_move.date) = Extract(YEAR FROM DATE(NOW()))
AND account_move.company_id in ''' + str(tuple(company_id)) + '''
@ -851,6 +843,7 @@ class DashBoard(models.Model):
self._cr.execute(('''select sum(-(amount_total_signed)) - sum(-(amount_residual_signed)) as supplier_invoice_paid from account_move where type ='in_invoice'
AND %s
AND invoice_payment_state = 'paid'
AND Extract(month FROM account_move.date) = Extract(month FROM DATE(NOW()))
AND Extract(YEAR FROM account_move.date) = Extract(YEAR FROM DATE(NOW()))
AND account_move.company_id in ''' + str(tuple(company_id)) + '''
@ -952,7 +945,6 @@ class DashBoard(models.Model):
@api.model
def unreconcile_items_this_month(self, *post):
company_id = self.get_current_company_value()
states_arg = ""
@ -999,7 +991,6 @@ class DashBoard(models.Model):
@api.model
def unreconcile_items_this_year(self, *post):
company_id = self.get_current_company_value()
states_arg = ""
@ -1010,7 +1001,7 @@ class DashBoard(models.Model):
self._cr.execute((''' select count(*) FROM account_move_line l,account_account a
where Extract(year FROM l.date) = Extract(year FROM DATE(NOW())) AND
L.account_id=a.id AND l.full_reconcile_id IS NULL AND
l.account_id=a.id AND l.full_reconcile_id IS NULL AND
l.balance != 0 AND a.reconcile IS TRUE
AND l.%s
AND l.company_id in ''' + str(tuple(company_id)) + '''
@ -1018,6 +1009,308 @@ class DashBoard(models.Model):
record = self._cr.dictfetchall()
return record
@api.model
def click_expense_month(self, *post):
company_id = self.get_current_company_value()
states_arg = ""
if post != ('posted',):
states_arg = """ parent_state in ('posted', 'draft')"""
else:
states_arg = """ parent_state = 'posted'"""
self._cr.execute((''' select account_move_line.id from account_account, account_move_line where
account_move_line.account_id = account_account.id AND account_account.internal_group = 'expense' AND
%s
AND Extract(month FROM account_move_line.date) = Extract(month FROM DATE(NOW()))
AND Extract(year FROM account_move_line.date) = Extract(year FROM DATE(NOW()))
AND account_move_line.company_id in ''' + str(tuple(company_id)) + '''
''') % (states_arg))
record = [row[0] for row in self._cr.fetchall()]
return record
@api.model
def click_expense_year(self, *post):
company_id = self.get_current_company_value()
states_arg = ""
if post != ('posted',):
states_arg = """ parent_state in ('posted', 'draft')"""
else:
states_arg = """ parent_state = 'posted'"""
self._cr.execute((''' select account_move_line.id from account_account, account_move_line where
account_move_line.account_id = account_account.id AND account_account.internal_group = 'expense' AND
%s
AND Extract(YEAR FROM account_move_line.date) = Extract(YEAR FROM DATE(NOW()))
AND account_move_line.company_id in ''' + str(tuple(company_id)) + '''
''') % (states_arg))
record = [row[0] for row in self._cr.fetchall()]
return record
@api.model
def click_total_income_month(self, *post):
company_id = self.get_current_company_value()
states_arg = ""
if post != ('posted',):
states_arg = """ parent_state in ('posted', 'draft')"""
else:
states_arg = """ parent_state = 'posted'"""
self._cr.execute(('''select account_move_line.id from account_account, account_move_line where
account_move_line.account_id = account_account.id AND account_account.internal_group = 'income'
AND %s
AND Extract(month FROM account_move_line.date) = Extract(month FROM DATE(NOW()))
AND Extract(year FROM account_move_line.date) = Extract(year FROM DATE(NOW()))
AND account_move_line.company_id in ''' + str(tuple(company_id)) + '''
''') % (states_arg))
record = [row[0] for row in self._cr.fetchall()]
return record
@api.model
def click_total_income_year(self, *post):
company_id = self.get_current_company_value()
states_arg = ""
if post != ('posted',):
states_arg = """ parent_state in ('posted', 'draft')"""
else:
states_arg = """ parent_state = 'posted'"""
self._cr.execute((''' select account_move_line.id from account_account, account_move_line where
account_move_line.account_id = account_account.id AND account_account.internal_group = 'income'
AND %s
AND Extract(YEAR FROM account_move_line.date) = Extract(YEAR FROM DATE(NOW()))
AND account_move_line.company_id in ''' + str(tuple(company_id)) + '''
''') % (states_arg))
record = [row[0] for row in self._cr.fetchall()]
return record
@api.model
def click_profit_income_month(self, *post):
company_id = self.get_current_company_value()
states_arg = ""
if post != ('posted',):
states_arg = """ parent_state in ('posted', 'draft')"""
else:
states_arg = """ parent_state = 'posted'"""
self._cr.execute(('''select account_move_line.id from account_account, account_move_line where
account_move_line.account_id = account_account.id AND
%s AND
(account_account.internal_group = 'income' or
account_account.internal_group = 'expense' )
AND Extract(month FROM account_move_line.date) = Extract(month FROM DATE(NOW()))
AND Extract(year FROM account_move_line.date) = Extract(year FROM DATE(NOW()))
AND account_move_line.company_id in ''' + str(tuple(company_id)) + '''
''') % (states_arg))
profit = [row[0] for row in self._cr.fetchall()]
return profit
@api.model
def click_profit_income_year(self, *post):
company_id = self.get_current_company_value()
states_arg = ""
if post != ('posted',):
states_arg = """ parent_state in ('posted', 'draft')"""
else:
states_arg = """ parent_state = 'posted'"""
self._cr.execute(('''select account_move_line.id from account_account, account_move_line where
account_move_line.account_id = account_account.id AND
%s AND
(account_account.internal_group = 'income' or
account_account.internal_group = 'expense' )
AND Extract(year FROM account_move_line.date) = Extract(year FROM DATE(NOW()))
AND account_move_line.company_id in ''' + str(tuple(company_id)) + '''
''') % (states_arg))
profit = [row[0] for row in self._cr.fetchall()]
return profit
@api.model
def click_bill_year(self, *post):
company_id = self.get_current_company_value()
states_arg = ""
if post != ('posted',):
states_arg = """ state in ('posted', 'draft')"""
else:
states_arg = """ state = 'posted'"""
self._cr.execute(('''select account_move.id from account_move where type ='in_invoice'
AND %s
AND Extract(YEAR FROM account_move.date) = Extract(YEAR FROM DATE(NOW()))
AND account_move.company_id in ''' + str(tuple(company_id)) + '''
''') % (states_arg))
record_supplier_current_year = [row[0] for row in self._cr.fetchall()]
return record_supplier_current_year
@api.model
def click_bill_year_paid(self, *post):
company_id = self.get_current_company_value()
states_arg = ""
if post != ('posted',):
states_arg = """ state in ('posted', 'draft')"""
else:
states_arg = """ state = 'posted'"""
self._cr.execute(('''select account_move.id from account_move where type ='in_invoice'
AND %s
AND invoice_payment_state = 'paid'
AND Extract(YEAR FROM account_move.date) = Extract(YEAR FROM DATE(NOW()))
AND account_move.company_id in ''' + str(tuple(company_id)) + '''
''') % (states_arg))
result_paid_supplier_invoice_current_year = [row[0] for row in self._cr.fetchall()]
return result_paid_supplier_invoice_current_year
@api.model
def click_invoice_year_paid(self, *post):
company_id = self.get_current_company_value()
states_arg = ""
if post != ('posted',):
states_arg = """ state in ('posted', 'draft')"""
else:
states_arg = """ state = 'posted'"""
self._cr.execute(('''select account_move.id from account_move where type ='out_invoice'
AND %s
AND invoice_payment_state = 'paid'
AND Extract(YEAR FROM account_move.date) = Extract(YEAR FROM DATE(NOW()))
AND account_move.company_id in ''' + str(tuple(company_id)) + '''
''') % (states_arg))
record_paid_customer_invoice_current_year = [row[0] for row in self._cr.fetchall()]
return record_paid_customer_invoice_current_year
@api.model
def click_invoice_year(self, *post):
company_id = self.get_current_company_value()
states_arg = ""
if post != ('posted',):
states_arg = """ state in ('posted', 'draft')"""
else:
states_arg = """ state = 'posted'"""
self._cr.execute(('''select account_move.id from account_move where type ='out_invoice'
AND %s
AND Extract(YEAR FROM account_move.date) = Extract(YEAR FROM DATE(NOW()))
AND account_move.company_id in ''' + str(tuple(company_id)) + '''
''') % (states_arg))
record_customer_current_year = [row[0] for row in self._cr.fetchall()]
return record_customer_current_year
@api.model
def click_bill_month(self, *post):
company_id = self.get_current_company_value()
states_arg = ""
if post != ('posted',):
states_arg = """ state in ('posted', 'draft')"""
else:
states_arg = """ state = 'posted'"""
self._cr.execute(('''select account_move.id from account_move where type ='in_invoice'
AND %s
AND Extract(month FROM account_move.date) = Extract(month FROM DATE(NOW()))
AND Extract(YEAR FROM account_move.date) = Extract(YEAR FROM DATE(NOW()))
AND account_move.company_id in ''' + str(tuple(company_id)) + '''
''') % (states_arg))
bill_month = [row[0] for row in self._cr.fetchall()]
return bill_month
@api.model
def click_bill_month_paid(self, *post):
company_id = self.get_current_company_value()
states_arg = ""
if post != ('posted',):
states_arg = """ state in ('posted', 'draft')"""
else:
states_arg = """ state = 'posted'"""
self._cr.execute(('''select account_move.id from account_move where type ='in_invoice'
AND %s
AND Extract(month FROM account_move.date) = Extract(month FROM DATE(NOW()))
AND Extract(YEAR FROM account_move.date) = Extract(YEAR FROM DATE(NOW()))
AND invoice_payment_state = 'paid'
AND account_move.company_id in ''' + str(tuple(company_id)) + '''
''') % (states_arg))
result_paid_supplier_invoice_current_month = [row[0] for row in self._cr.fetchall()]
return result_paid_supplier_invoice_current_month
@api.model
def click_invoice_month_paid(self, *post):
company_id = self.get_current_company_value()
states_arg = ""
if post != ('posted',):
states_arg = """ state in ('posted', 'draft')"""
else:
states_arg = """ state = 'posted'"""
self._cr.execute(('''select account_move.id from account_move where type ='out_invoice'
AND %s
AND Extract(month FROM account_move.date) = Extract(month FROM DATE(NOW()))
AND Extract(YEAR FROM account_move.date) = Extract(YEAR FROM DATE(NOW()))
AND invoice_payment_state = 'paid'
AND account_move.company_id in ''' + str(tuple(company_id)) + '''
''') % (states_arg))
record_paid_customer_invoice_current_month = [row[0] for row in self._cr.fetchall()]
return record_paid_customer_invoice_current_month
@api.model
def click_invoice_month(self, *post):
company_id = self.get_current_company_value()
states_arg = ""
if post != ('posted',):
states_arg = """ state in ('posted', 'draft')"""
else:
states_arg = """ state = 'posted'"""
self._cr.execute(('''select account_move.id from account_move where type ='out_invoice'
AND %s
AND Extract(month FROM account_move.date) = Extract(month FROM DATE(NOW()))
AND Extract(YEAR FROM account_move.date) = Extract(YEAR FROM DATE(NOW()))
AND account_move.company_id in ''' + str(tuple(company_id)) + '''
''') % (states_arg))
record_customer_current_month = [row[0] for row in self._cr.fetchall()]
return record_customer_current_month
@api.model
def click_unreconcile_month(self, *post):
company_id = self.get_current_company_value()
states_arg = ""
if post != ('posted',):
states_arg = """ parent_state in ('posted', 'draft')"""
else:
states_arg = """ parent_state = 'posted'"""
qry = ''' select count(*) FROM account_move_line l,account_account a
where Extract(month FROM l.date) = Extract(month FROM DATE(NOW())) AND
Extract(YEAR FROM l.date) = Extract(YEAR FROM DATE(NOW())) AND
L.account_id=a.id AND l.full_reconcile_id IS NULL AND
l.balance != 0 AND a.reconcile IS F
AND l.''' + states_arg + '''
AND l.company_id in ''' + str(tuple(company_id)) + '''
'''
self._cr.execute((''' select l.id FROM account_move_line l,account_account a
where Extract(month FROM l.date) = Extract(month FROM DATE(NOW())) AND
Extract(YEAR FROM l.date) = Extract(YEAR FROM DATE(NOW())) AND
L.account_id=a.id AND l.full_reconcile_id IS NULL AND
l.balance != 0 AND a.reconcile IS TRUE
AND l.%s
AND l.company_id in ''' + str(tuple(company_id)) + '''
''') % (states_arg))
record = [row[0] for row in self._cr.fetchall()]
return record
@api.model
def click_unreconcile_year(self, *post):
company_id = self.get_current_company_value()
states_arg = ""
if post != ('posted',):
states_arg = """ parent_state in ('posted', 'draft')"""
else:
states_arg = """ parent_state = 'posted'"""
self._cr.execute((''' select l.id FROM account_move_line l,account_account a
where Extract(year FROM l.date) = Extract(year FROM DATE(NOW())) AND
L.account_id=a.id AND l.full_reconcile_id IS NULL AND
l.balance != 0 AND a.reconcile IS TRUE
AND l.%s
AND l.company_id in ''' + str(tuple(company_id)) + '''
''') % (states_arg))
record = [row[0] for row in self._cr.fetchall()]
return record
# function to get unreconcile items last year
@api.model
@ -1048,7 +1341,6 @@ class DashBoard(models.Model):
@api.model
def month_income_this_month(self, *post):
company_id = self.get_current_company_value()
states_arg = ""
@ -1303,7 +1595,8 @@ class DashBoard(models.Model):
else:
states_arg = """ parent_state in ('posted', 'draft')"""
self._cr.execute((''' select account_account.name as name, sum(balance) as balance from account_move_line left join
self._cr.execute((''' select account_account.name as name, sum(balance) as balance,
min(account_account.id) as id from account_move_line left join
account_account on account_account.id = account_move_line.account_id join
account_account_type on account_account_type.id = account_account.user_type_id
where account_account_type.name = 'Bank and Cash'
@ -1319,9 +1612,12 @@ class DashBoard(models.Model):
banking = [item['balance'] for item in record]
bank_ids = [item['id'] for item in record]
records = {
'banks': banks,
'banking': banking,
'bank_ids': bank_ids
}
return records

362
base_accounting_kit/static/src/js/account_dashboard.js

@ -10,10 +10,7 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) {
var self = this;
var currency;
var ActionMenu = AbstractAction.extend({
template: 'Invoicedashboard',
events: {
'click .invoice_dashboard': 'onclick_dashboard',
'click #prog_bar': 'onclick_prog_bar',
@ -59,16 +56,325 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) {
this.onclick_top_10_month(this.$('#top_10_customer_value').val());
},
'change #toggle-two': 'onclick_toggle_two',
'click #unreconciled_counts_this_year': 'unreconciled_year',
'click #unreconciled_items_': 'unreconciled_month',
'click #total_customer_invoice_paid_current_month': 'invoice_month_paid',
'click #total_customer_invoice_current_month': 'invoice_month',
'click #total_supplier_invoice_paid_current_month': 'bill_month_paid',
'click #total_supplier_invoice_current_month': 'bill_month',
'click #total_customer_invoice_paid_current_year': 'invoice_year_paid',
'click #total_customer_invoice_current_year': 'invoice_year',
'click #total_supplier_invoice_paid_current_year': 'bill_year_paid',
'click #total_supplier_invoice_current_year': 'bill_year',
'click #net_profit_current_year': 'profit_income_year',
'click #net_profit_current_months': 'profit_income_month',
'click #total_incomes_this_year': 'total_income_year',
'click #total_incomes_': 'total_income_month',
'click #total_expense_this_year': 'expense_year',
'click #total_expenses_': 'expense_month',
},
profit_income_year: function (ev){
var posted = false;
var self = this;
rpc.query({
model: "account.move",
method: "click_profit_income_year",
args: [posted],
}).then(function (result) {
self.do_action({
res_model: 'account.move.line',
name: _t('Net Profit or Loss'),
views: [[false, 'list'], [false, 'form']],
type: 'ir.actions.act_window',
domain: [['id', 'in', result]],
});
})
},
profit_income_month: function (ev){
var posted = false;
var self = this;
rpc.query({
model: "account.move",
method: "click_profit_income_month",
args: [posted],
}).then(function (result) {
self.do_action({
res_model: 'account.move.line',
name: _t('Net Profit or Loss'),
views: [[false, 'list'], [false, 'form']],
type: 'ir.actions.act_window',
domain: [['id', 'in', result]],
});
})
},
total_income_year: function (ev){
var posted = false;
var self = this;
rpc.query({
model: "account.move",
method: "click_total_income_year",
args: [posted],
}).then(function (result) {
self.do_action({
res_model: 'account.move.line',
name: _t('Total Income'),
views: [[false, 'list'], [false, 'form']],
type: 'ir.actions.act_window',
domain: [['id', 'in', result]],
});
})
},
total_income_month: function (ev){
var posted = false;
var self = this;
rpc.query({
model: "account.move",
method: "click_total_income_month",
args: [posted],
}).then(function (result) {
self.do_action({
res_model: 'account.move.line',
name: _t('Total Income'),
views: [[false, 'list'], [false, 'form']],
type: 'ir.actions.act_window',
domain: [['id', 'in', result]],
});
})
},
expense_year: function (ev){
var posted = false;
var self = this;
rpc.query({
model: "account.move",
method: "click_expense_year",
args: [posted],
}).then(function (result) {
self.do_action({
res_model: 'account.move.line',
name: _t('Total Expenses'),
views: [[false, 'list'], [false, 'form']],
type: 'ir.actions.act_window',
domain: [['id', 'in', result]],
});
})
},
expense_month: function (ev){
var posted = false;
var self = this;
rpc.query({
model: "account.move",
method: "click_expense_month",
args: [posted],
}).then(function (result) {
self.do_action({
res_model: 'account.move.line',
name: _t('Total Expenses'),
views: [[false, 'list'], [false, 'form']],
type: 'ir.actions.act_window',
domain: [['id', 'in', result]],
});
})
},
unreconciled_year: function (ev) {
var posted = false;
var self = this;
rpc.query({
model: "account.move",
method: "click_unreconcile_year",
args: [posted],
}).then(function (result) {
self.do_action({
res_model: 'account.move.line',
name: _t('Unreconciled'),
views: [[false, 'list'], [false, 'form']],
type: 'ir.actions.act_window',
domain: [['id', 'in', result]],
});
})
},
unreconciled_month: function (ev) {
var posted = false;
var self = this;
rpc.query({
model: "account.move",
method: "click_unreconcile_month",
args: [posted],
}).then(function (result) {
self.do_action({
res_model: 'account.move.line',
name: _t('Unreconciled'),
views: [[false, 'list'], [false, 'form']],
type: 'ir.actions.act_window',
domain: [['id', 'in', result]],
});
})
},
invoice_month_paid: function (ev) {
var posted = false;
if ($('#toggle-two')[0].checked == true) {
posted = "posted"
}
var self = this;
rpc.query({
model: "account.move",
method: "click_invoice_month_paid",
args: [posted],
}).then(function (result) {
self.do_action({
res_model: 'account.move',
name: _t('Paid'),
views: [[false, 'list'], [false, 'form']],
type: 'ir.actions.act_window',
domain: [['id', 'in', result]],
});
})
},
invoice_month: function (ev) {
var posted = false;
if ($('#toggle-two')[0].checked == true) {
posted = "posted"
}
var self = this;
rpc.query({
model: "account.move",
method: "click_invoice_month",
args: [posted],
}).then(function (result) {
self.do_action({
res_model: 'account.move',
name: _t('Invoice'),
views: [[false, 'list'], [false, 'form']],
type: 'ir.actions.act_window',
domain: [['id', 'in', result]],
});
})
},
bill_month_paid: function (ev) {
var posted = false;
if ($('#toggle-two')[0].checked == true) {
posted = "posted"
}
var self = this;
rpc.query({
model: "account.move",
method: "click_bill_month_paid",
args: [posted],
}).then(function (result) {
self.do_action({
res_model: 'account.move',
name: _t('Paid'),
views: [[false, 'list'], [false, 'form']],
type: 'ir.actions.act_window',
domain: [['id', 'in', result]],
});
})
},
bill_month: function (ev) {
var posted = false;
if ($('#toggle-two')[0].checked == true) {
posted = "posted"
}
var self = this;
rpc.query({
model: "account.move",
method: "click_bill_month",
args: [posted],
}).then(function (result) {
self.do_action({
res_model: 'account.move',
name: _t('Invoice'),
views: [[false, 'list'], [false, 'form']],
type: 'ir.actions.act_window',
domain: [['id', 'in', result]],
});
})
},
bill_year: function (ev) {
var posted = false;
if ($('#toggle-two')[0].checked == true) {
posted = "posted"
}
var self = this;
rpc.query({
model: "account.move",
method: "click_bill_year",
args: [posted],
}).then(function (result) {
self.do_action({
res_model: 'account.move',
name: _t('Invoice'),
views: [[false, 'list'], [false, 'form']],
type: 'ir.actions.act_window',
domain: [['id', 'in', result]],
});
})
},
bill_year_paid: function (ev) {
var posted = false;
if ($('#toggle-two')[0].checked == true) {
posted = "posted"
}
var self = this;
rpc.query({
model: "account.move",
method: "click_bill_year_paid",
args: [posted],
}).then(function (result) {
self.do_action({
res_model: 'account.move',
name: _t('Paid'),
views: [[false, 'list'], [false, 'form']],
type: 'ir.actions.act_window',
domain: [['id', 'in', result]],
});
})
},
invoice_year: function (ev) {
var posted = false;
if ($('#toggle-two')[0].checked == true) {
posted = "posted"
}
var self = this;
rpc.query({
model: "account.move",
method: "click_invoice_year",
args: [posted],
}).then(function (result) {
self.do_action({
res_model: 'account.move',
name: _t('Invoice'),
views: [[false, 'list'], [false, 'form']],
type: 'ir.actions.act_window',
domain: [['id', 'in', result]],
});
})
},
invoice_year_paid: function (ev) {
var posted = false;
if ($('#toggle-two')[0].checked == true) {
posted = "posted"
}
var self = this;
rpc.query({
model: "account.move",
method: "click_invoice_year_paid",
args: [posted],
}).then(function (result) {
self.do_action({
res_model: 'account.move',
name: _t('Paid'),
views: [[false, 'list'], [false, 'form']],
type: 'ir.actions.act_window',
domain: [['id', 'in', result]],
});
})
},
onclick_toggle_two: function (ev) {
onclick_toggle_two: function (ev) {
this.onclick_aged_payable(this.$('#aged_receivable_values').val());
this.onclick_aged_receivable(this.$('#aged_payable_value').val());
this.onclick_invoice_this_year(ev);
this.onclick_invoice_this_month(ev);
this.onclick_income_this_month(ev);
this.onclick_income_last_month(ev);
this.onclick_income_last_year(ev);
@ -107,8 +413,18 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) {
due_count++;
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>');
$('#line_'+ x.parent).on("click", function () {
self.do_action({
res_model: 'res.partner',
name: _t('Partner'),
views: [[false, 'form']],
type: 'ir.actions.act_window',
res_id: x.parent,
});
});
});
})
},
@ -190,7 +506,6 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) {
})
},
onclick_income_last_month: function (ev) {
ev.preventDefault();
var selected = $('.btn.btn-tool.income');
@ -349,8 +664,6 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) {
})
},
onclick_invoice_this_year: function (ev) {
ev.preventDefault();
var selected = $('.btn.btn-tool.selected');
@ -517,7 +830,6 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) {
})
},
onclick_income_this_month: function (ev) {
ev.preventDefault();
var selected = $('.btn.btn-tool.income');
@ -593,7 +905,6 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) {
})
},
onclick_aged_payable: function (f) {
// ev.preventDefault();
@ -662,8 +973,6 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) {
})
},
onclick_aged_receivable: function (f) {
var selected = $('.btn.btn-tool.expense');
var data = $(selected[0]).data();
@ -1055,6 +1364,15 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) {
due_count++;
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>');
$('#line_'+ x.parent).on("click", function () {
self.do_action({
res_model: 'res.partner',
name: _t('Partner'),
views: [[false, 'form']],
type: 'ir.actions.act_window',
res_id: x.parent,
});
});
});
})
@ -1067,12 +1385,22 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) {
var banks = result['banks'];
var amount;
var balance = result['banking'];
var bnk_ids = result['bank_ids'];
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>' );
$('#current_bank_balance').append('<li><div>' + banks[k] + '</div><div>' + amount + '</div></li>');
$('#current_bank_balance').append('<li><div val="'+bnk_ids[k]+'"id="b_'+bnk_ids[k]+'">' + 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>' );
$('#drop_charts_balance').append('<li>' + balance[k].toFixed(2) + '</li>');
$('#b_'+ bnk_ids[k]).on("click", function (ev) {
self.do_action({
res_model: 'account.account',
name: _t('Account'),
views: [[false, 'form']],
type: 'ir.actions.act_window',
res_id: parseInt(this.id.replace('b_', '')),
});
});
}
})
@ -1367,7 +1695,6 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) {
})
});
},
format_currency: function(currency, amount){
if (typeof(amount) != 'number'){
amount = parseFloat(amount);
@ -1379,7 +1706,6 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) {
return currency.symbol + ' ' + formatted_value;
}
},
willStart: function () {
var self = this;
self.drpdn_show = false;

Loading…
Cancel
Save