Merge lp:~openerp-dev/openobject-addons/trunk-journal-dashboard-tpa into lp:openobject-addons
- trunk-journal-dashboard-tpa
- Merge into trunk
Status: | Work in progress |
---|---|
Proposed branch: | lp:~openerp-dev/openobject-addons/trunk-journal-dashboard-tpa |
Merge into: | lp:openobject-addons |
Diff against target: |
774 lines (+578/-9) 16 files modified
account/__init__.py (+1/-0) account/__openerp__.py (+3/-1) account/account.py (+1/-1) account/account_invoice.py (+7/-4) account/account_invoice_view.xml (+1/-0) account/account_journal_dashboard.py (+246/-0) account/account_journal_view.xml (+181/-0) account/account_view.xml (+3/-1) account/company.py (+9/-1) account/static/src/css/Makefile (+2/-0) account/static/src/css/account_journal.css (+26/-0) account/static/src/css/account_journal.sass (+22/-0) account/static/src/js/account_journal.js (+47/-0) account/static/src/js/account_move_reconciliation.js (+1/-0) account_followup/__openerp__.py (+1/-1) account_followup/account_followup_customers.xml (+27/-0) |
To merge this branch: | bzr merge lp:~openerp-dev/openobject-addons/trunk-journal-dashboard-tpa |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Thibault Delavallée (OpenERP) (community) | technical | Needs Fixing | |
Mustufa Rangwala (Open ERP) (community) | Needs Fixing | ||
Turkesh Patel (openERP) (community) | Needs Resubmitting | ||
Atul Patel(OpenERP) (community) | Needs Fixing | ||
Harry (OpenERP) (community) | Needs Fixing | ||
Review via email: mp+162951@code.launchpad.net |
Commit message
Description of the change
Create kanban view for Journals.
- 8679. By Turkesh Patel (openERP)
-
[IMP] remove spakline library
- 8680. By Turkesh Patel (openERP)
-
[MRG] lp:~openerp-dev/openobject-addons/trunk-journal-dashboard-tpa-graph-aja
- 8681. By Turkesh Patel (openERP)
-
[IMP] use single function in all fuction fields using multi.
- 8682. By Turkesh Patel (openERP)
-
[MRG] lp:~openerp-dev/openobject-addons/trunk-journal-dashboard-tpa-graph-aja
- 8683. By Turkesh Patel (openERP)
-
[MRG] merge with lp:~openerp-dev/openobject-addons/trunk-journal-dashboard-tpa-graph-aja
- 8684. By Turkesh Patel (openERP)
-
[MRG] improved code and merge with lp:~openerp-dev/openobject-addons/trunk-journal-dashboard-tpa-graph-aja
- 8685. By Turkesh Patel (openERP)
-
[IMP] show last bank statement date and mount in kanban
- 8686. By Turkesh Patel (openERP)
-
[MRG] improved code to add bank in jouranls.
- 8687. By Turkesh Patel (openERP)
-
[MRG] Merge with lp:openobject-addons
- 8688. By Turkesh Patel (openERP)
-
[IMP] improved code to not show general and situation type journals in kanban
- 8689. By Turkesh Patel (openERP)
-
[IMP] improved code
Atul Patel(OpenERP) (atp-openerp) wrote : | # |
Hello Turkesh,
Following things need to improve.
- use proper variable name .
For example : instead of 'tot' use 'total'
- correct typo in doc string 'passed domain' instead of 'paased domain'.
- In _get_currency_
you can directly get currency symbol.
see >
if journal.currency:
no type='string' return type value of function field.. use type='char'
correct this 'symbol': fields.
- Remove unused function def get_vouchers() which simply return {}.
- In journal Dashboard kanban view instead of <newline/>
use alternative solution may be you can use <br/>
- _get_last_
may be pass order='create_date desc'
- Improve function _get_inv_data(). define def get_data() as different function(common function) outside of _get_inv_data() and call it
inside function _get_inv_data() based on field_name we get .
for examlple
if name == 'inv_draft':
domain = [('state', '=', 'draft')]
total = self.get_data(id, domain, to_pay=False, context=None)
- 8690. By Turkesh Patel (openERP)
-
[IMP] improved code as per suggetion
- 8691. By Turkesh Patel (openERP)
-
[IMP] improved code.
Turkesh Patel (openERP) (turkesh-tinyerp) wrote : | # |
Hello sir,
Improved code as per your suggestion.
- 8692. By Turkesh Patel (openERP)
-
[IMP] remove code from account_journal and put in account module.
- 8693. By Turkesh Patel (openERP)
-
[IMP] add doc strings inthe function
- 8694. By Turkesh Patel (openERP)
-
[IMP] improve qry as per suggetion
- 8695. By Turkesh Patel (openERP)
-
[IMP] improved view by showing underline below the links and improved code
- 8696. By Turkesh Patel (openERP)
-
[IMP] lead to invoicing settings view from help of the journal kanban, improved view and css
- 8697. By Turkesh Patel (openERP)
-
[MRG] merge with lp:openobject-addons
- 8698. By Turkesh Patel (openERP)
-
[IMP] improved typo.
- 8699. By Turkesh Patel (openERP)
-
[MRG] merge with lp:openobject-addons
- 8700. By Turkesh Patel (openERP)
-
[IMP] improved typo for link in cash type journal
- 8701. By Turkesh Patel (openERP)
-
[MRG] merge with lp:openobject-addons
Mustufa Rangwala (Open ERP) (mra-tinyerp) wrote : | # |
Do not add bank reference on accounting journal.
Regards,
- 8702. By Turkesh Patel (openERP)
-
[IMP] improved help and domain to calculate overdue amount
- 8703. By Turkesh Patel (openERP)
-
[RMV] remove bank_id from journal
- 8704. By Turkesh Patel (openERP)
-
[ADD] show graph of bank statements in kanban of type bank and cash journals insted of voucher entries.
- 8705. By Turkesh Patel (openERP)
-
[IMP] add situation type journal in kanban and improved code
- 8706. By Turkesh Patel (openERP)
-
[IMP] Improved typo and code
- 8707. By Turkesh Patel (openERP)
-
[IMP] remove invoice_ids and bank_statement_ids use directly search method
- 8708. By Turkesh Patel (openERP)
-
[IMP] improved typo and veriable name
- 8709. By Turkesh Patel (openERP)
-
[ADD] add removed line.
- 8710. By Turkesh Patel (openERP)
-
[MRG] merge with lp:openobject-addons
- 8711. By Turkesh Patel (openERP)
-
[IMP] improved code to fix xaxis error
- 8712. By Turkesh Patel (openERP)
-
[IMP] improved code to show graph in cash and bank type journal based on 'journal entries' insted of bank statements,removed kanban box for type situation journal and related code
- 8713. By Turkesh Patel (openERP)
-
[MRG] merge with lp:openobject-addons
- 8714. By Turkesh Patel (openERP)
-
[IMP] improve query to get data from directly account_move_line insted of account_move
- 8715. By Turkesh Patel (openERP)
-
[MRG] merge with lp:openobject-addons
- 8716. By Turkesh Patel (openERP)
-
[IMP] improved code.
- 8717. By Turkesh Patel (openERP)
-
[IMP] improved code to oprn cashregisters form and show only data of related journal not all
- 8718. By Turkesh Patel (openERP)
-
[MRG] merge with lp:openobject-addons
- 8719. By Niko (OpenERP)
-
[IMP] Change layout for the journal dashboard
- 8720. By Niko (OpenERP)
-
[IMP] add padding-bottom for oe_journals_details tag
- 8721. By Turkesh Patel (openERP)
-
[FIX] improved code to set defaut value of journal in account.invoice
- 8722. By Turkesh Patel (openERP)
-
[IMP] improved code.
- 8723. By Turkesh Patel (openERP)
-
[MRG] merge with lp:openobject-addons
- 8724. By Turkesh Patel (openERP)
-
[FIX] give different id names
- 8725. By Turkesh Patel (openERP)
-
[FIX] changed code to avoid effect of default compny on othe objects
- 8726. By Turkesh Patel (openERP)
-
[IMP] improved graph size and kanban box
- 8727. By Turkesh Patel (openERP)
-
[IMP] improve size of graph and code
- 8728. By Turkesh Patel (openERP)
-
[MRG] merge with lp:openobject-addons
- 8729. By Turkesh Patel (openERP)
-
[IMP] improved view, show action on top right corner and left bottom corner,show current month if no data in graph,show point in line graph
- 8730. By Turkesh Patel (openERP)
-
[MRG] merge with lp:openobject-addons
- 8731. By Turkesh Patel (openERP)
-
[IMP] improved code to fix lenth error.
- 8732. By Turkesh Patel (openERP)
-
[IMP] calculate pro-forma and pro-forma2 state as draft state
- 8733. By Turkesh Patel (openERP)
-
[IMP] improved code to show overdue amount which remain to pay only
- 8734. By Mustufa Rangwala (Open ERP)
-
[MERGE] Merge child branch
- 8735. By Turkesh Patel (openERP)
-
[MRG] merge with lp:openobject-addons
- 8736. By Turkesh Patel (openERP)
-
[IMP] improved comment of function.
- 8737. By Turkesh Patel (openERP)
-
[IMP]improved code: show all months if not data in graph,improved help,show date as per the date format of language.
- 8738. By Turkesh Patel (openERP)
-
[MRG] merge with lp:openobejct-addons
- 8739. By Turkesh Patel (openERP)
-
[IMP] improved strings for refunds
- 8740. By Turkesh Patel (openERP)
-
[MRG] merge with lp:openobject-addons
- 8741. By Turkesh Patel (openERP)
-
[MRG] merge with lp:openobject-addons
- 8742. By Turkesh Patel (openERP)
-
[MRG] merge with lp:openobject-addons
- 8743. By Turkesh Patel (openERP)
-
[IMP] improved strings.
- 8744. By Turkesh Patel (openERP)
-
[MRG] merge with lp:openobject-addons
- 8745. By Turkesh Patel (openERP)
-
[MRG] merge with lp:openobject-addons
- 8746. By Turkesh Patel (openERP)
-
[IMP] improved code to open proper customer invoice form view from link
- 8747. By Turkesh Patel (openERP)
-
[IMP] Added empty menu tip on action added help on actions
- 8748. By Turkesh Patel (openERP)
-
[MRG] merge with lp:openobject-addons
- 8749. By Turkesh Patel (openERP)
-
[MRG] merge with lp:openobject-addons
- 8750. By Turkesh Patel (openERP)
-
[IMP] improved code to show values in graph based on moves insted of invoices
- 8751. By Turkesh Patel (openERP)
-
[IMP] improved code of calculation of item to reconcile.
- 8752. By Turkesh Patel (openERP)
-
[MRG] merge with lp:openobject-addons
- 8753. By Turkesh Patel (openERP)
-
[MRG] merge with lp:openobject-addons
- 8754. By Turkesh Patel (openERP)
-
[MRG] merge with lp:openobject-addons
- 8755. By Turkesh Patel (openERP)
-
[MRG] merge with lp;openobject-
addons - 8756. By Turkesh Patel (openERP)
-
[IMP] improved code to use NVD3 library insead of Flotr2
- 8757. By Turkesh Patel (openERP)
-
[MRG] merge with lp:openobject-addons
- 8758. By Turkesh Patel (openERP)
-
[IMP] improved view by setting parameters and css
- 8759. By Turkesh Patel (openERP)
-
[MRG] merge with lp:openobject-addons
- 8760. By Turkesh Patel (openERP)
-
[IMP] remove use of createElementNS as it is not compitable in FF.
- 8761. By Turkesh Patel (openERP)
-
[MRG] merge with lp:openobject-addons
- 8762. By Turkesh Patel (openERP)
-
[ADD] added sass file.
- 8763. By Turkesh Patel (openERP)
-
[IMP] improved code to set title of graph and improved css.
- 8764. By Turkesh Patel (openERP)
-
[IMP] add seprate file of css for account journal.
- 8765. By Turkesh Patel (openERP)
-
[IMP] improved code to show dates in graph as per date formate.
- 8766. By Turkesh Patel (openERP)
-
[MRG] merge with lp:openobject-addons
- 8767. By Thibault Delavallée (OpenERP)
-
[MERGE] Sync with upstream
Thibault Delavallée (OpenERP) (tde-openerp) wrote : | # |
Hello,
About the kanban view: try to simplify and lessen it: too many actions defined in account_
- you should have only 1 action defined
- then for each "case" (each action in the current implementation), the link should be a button that returns action. This way you define several methods that take the base action to open account.invoice, and tweak some values
About account.journal:
- shouldn't the invoice data be limited to the current year ?
- the current implementation is well cut, but I fear there will be too many search / reads
--> maybe perform first a search on invoice, with journal_id in journal_ids and date > beginning of the year
--> then browse them and compute a dictionary according to journal_id and the various conditions
- in _get_last_
About the custom javascript: isn't it possible to create one or two small kanban widgets on some fields instead of doing that in javascript by adding a call ? The widget could have a dictionary or a structure you will define to be rendered, as a line of multibar.
- 8768. By Chirag Dodiya(OpenERP)
-
[MRG]Merge lp:~openerp-dev/openobject-addons/trunk-journal-dashboard-tpa-imp2-cod
- 8769. By Chirag Dodiya(OpenERP)
-
[MRG]Merge with trunk
- 8770. By Chirag Dodiya(OpenERP)
-
[IMP]Improved typo
- 8771. By Chirag Dodiya(OpenERP)
-
[IMP]Improved code for overdue amount and improved typo
- 8772. By Paramjit Singh Sahota(OpenERP)
-
[FIX] The graph in the kanban view of account is not shown completely itz cutted-off from the bottom.
- 8773. By Chirag Dodiya(OpenERP)
-
[IMP]Improved typo
- 8774. By Chirag Dodiya(OpenERP)
-
[FIX]Fixed traceback when click on menu journal items and manualreconcile
- 8775. By Chirag Dodiya(OpenERP)
-
[IMP]Improved code to show overdue invoices till today and till this month
- 8776. By Chirag Dodiya(OpenERP)
-
[IMP]Improved code to open action with proper journal
- 8777. By Chirag Dodiya(OpenERP)
-
[IMP]Set icon to display overdue amount today and this month and set context to open only draft refund on refund to validate
- 8778. By Chirag Dodiya(OpenERP)
-
[IMP]set color and margin on icon
- 8779. By Chirag Dodiya(OpenERP)
-
[IMP]Improved typo
- 8780. By Chirag Dodiya(OpenERP)
-
[IMP]Improved code for graph
- 8781. By Chirag Dodiya(OpenERP)
-
[IMP]Improved code to solve kanban view issue
- 8782. By Chirag Dodiya(OpenERP)
-
[MRG]Merge with lp:openobject-addons
- 8783. By Chirag Dodiya(OpenERP)
-
[IMP]Improved code to get invoices
- 8784. By Chirag Dodiya(OpenERP)
-
[IMP]Improved view of kanban
- 8785. By Chirag Dodiya(OpenERP)
-
[IMP]Improved code for graph data
- 8786. By Chirag Dodiya(OpenERP)
-
[IMP]Improved code
Unmerged revisions
- 8786. By Chirag Dodiya(OpenERP)
-
[IMP]Improved code
- 8785. By Chirag Dodiya(OpenERP)
-
[IMP]Improved code for graph data
- 8784. By Chirag Dodiya(OpenERP)
-
[IMP]Improved view of kanban
- 8783. By Chirag Dodiya(OpenERP)
-
[IMP]Improved code to get invoices
- 8782. By Chirag Dodiya(OpenERP)
-
[MRG]Merge with lp:openobject-addons
- 8781. By Chirag Dodiya(OpenERP)
-
[IMP]Improved code to solve kanban view issue
- 8780. By Chirag Dodiya(OpenERP)
-
[IMP]Improved code for graph
- 8779. By Chirag Dodiya(OpenERP)
-
[IMP]Improved typo
- 8778. By Chirag Dodiya(OpenERP)
-
[IMP]set color and margin on icon
- 8777. By Chirag Dodiya(OpenERP)
-
[IMP]Set icon to display overdue amount today and this month and set context to open only draft refund on refund to validate
Preview Diff
1 | === modified file 'account/__init__.py' |
2 | --- account/__init__.py 2012-11-29 22:26:45 +0000 |
3 | +++ account/__init__.py 2014-03-10 10:51:38 +0000 |
4 | @@ -38,5 +38,6 @@ |
5 | import res_currency |
6 | import edi |
7 | import res_config |
8 | +import account_journal_dashboard |
9 | |
10 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
11 | |
12 | === modified file 'account/__openerp__.py' |
13 | --- account/__openerp__.py 2014-02-13 17:39:10 +0000 |
14 | +++ account/__openerp__.py 2014-03-10 10:51:38 +0000 |
15 | @@ -124,12 +124,13 @@ |
16 | 'account_bank_view.xml', |
17 | 'res_config_view.xml', |
18 | 'account_pre_install.yml', |
19 | - |
20 | + 'account_journal_view.xml', |
21 | 'views/report_vat.xml', |
22 | ], |
23 | 'js': [ |
24 | 'static/src/js/account_move_reconciliation.js', |
25 | 'static/src/js/account_move_line_quickadd.js', |
26 | + 'static/src/js/account_journal.js', |
27 | ], |
28 | 'qweb' : [ |
29 | "static/src/xml/account_move_reconciliation.xml", |
30 | @@ -139,6 +140,7 @@ |
31 | 'static/src/css/account_move_reconciliation.css', |
32 | 'static/src/css/account_move_line_quickadd.css', |
33 | 'static/src/css/account_bank_and_cash.css', |
34 | + 'static/src/css/account_journal.css', |
35 | ], |
36 | 'demo': [ |
37 | 'demo/account_demo.xml', |
38 | |
39 | === modified file 'account/account.py' |
40 | --- account/account.py 2014-02-10 05:26:55 +0000 |
41 | +++ account/account.py 2014-03-10 10:51:38 +0000 |
42 | @@ -761,7 +761,7 @@ |
43 | _constraints = [ |
44 | (_check_currency, 'Configuration error!\nThe currency chosen should be shared by the default accounts too.', ['currency','default_debit_account_id','default_credit_account_id']), |
45 | ] |
46 | - |
47 | + |
48 | def copy(self, cr, uid, id, default=None, context=None, done_list=None, local=False): |
49 | default = {} if default is None else default.copy() |
50 | if done_list is None: |
51 | |
52 | === modified file 'account/account_invoice.py' |
53 | --- account/account_invoice.py 2014-02-12 17:51:41 +0000 |
54 | +++ account/account_invoice.py 2014-03-10 10:51:38 +0000 |
55 | @@ -20,6 +20,7 @@ |
56 | ############################################################################## |
57 | |
58 | import time |
59 | +from datetime import datetime, date, timedelta |
60 | from lxml import etree |
61 | import openerp.addons.decimal_precision as dp |
62 | import openerp.exceptions |
63 | @@ -46,6 +47,8 @@ |
64 | def _get_journal(self, cr, uid, context=None): |
65 | if context is None: |
66 | context = {} |
67 | + if context.get('default_journal_id'): |
68 | + return context.get('default_journal_id') |
69 | type_inv = context.get('type', 'out_invoice') |
70 | user = self.pool.get('res.users').browse(cr, uid, uid, context=context) |
71 | company_id = context.get('company_id', user.company_id.id) |
72 | @@ -340,9 +343,6 @@ |
73 | ('number_uniq', 'unique(number, company_id, journal_id, type)', 'Invoice Number must be unique per Company!'), |
74 | ] |
75 | |
76 | - |
77 | - |
78 | - |
79 | def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False): |
80 | journal_obj = self.pool.get('account.journal') |
81 | if context is None: |
82 | @@ -587,7 +587,8 @@ |
83 | def onchange_company_id(self, cr, uid, ids, company_id, part_id, type, invoice_line, currency_id, context=None): |
84 | #TODO: add the missing context parameter when forward-porting in trunk so we can remove |
85 | # this hack! |
86 | - context = self.pool['res.users'].context_get(cr, uid) |
87 | + if not context: |
88 | + context = self.pool['res.users'].context_get(cr, uid) |
89 | |
90 | val = {} |
91 | dom = {} |
92 | @@ -655,6 +656,8 @@ |
93 | journal_ids = obj_journal.search(cr, uid, [('company_id','=',company_id), ('type', '=', journal_type)]) |
94 | if journal_ids: |
95 | val['journal_id'] = journal_ids[0] |
96 | + if context.get('default_journal_id') in journal_ids: |
97 | + val['journal_id'] = context.get('default_journal_id') |
98 | ir_values_obj = self.pool.get('ir.values') |
99 | res_journal_default = ir_values_obj.get(cr, uid, 'default', 'type=%s' % (type), ['account.invoice']) |
100 | for r in res_journal_default: |
101 | |
102 | === modified file 'account/account_invoice_view.xml' |
103 | --- account/account_invoice_view.xml 2014-02-10 05:26:55 +0000 |
104 | +++ account/account_invoice_view.xml 2014-03-10 10:51:38 +0000 |
105 | @@ -460,6 +460,7 @@ |
106 | <field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"/> |
107 | <field name="user_id" string="Salesperson"/> |
108 | <field name="period_id" string="Period"/> |
109 | + <field name="state"/> |
110 | <separator/> |
111 | <filter domain="[('user_id','=',uid)]" help="My Invoices"/> |
112 | <group expand="0" string="Group By..."> |
113 | |
114 | === added file 'account/account_journal_dashboard.py' |
115 | --- account/account_journal_dashboard.py 1970-01-01 00:00:00 +0000 |
116 | +++ account/account_journal_dashboard.py 2014-03-10 10:51:38 +0000 |
117 | @@ -0,0 +1,246 @@ |
118 | +# -*- coding: utf-8 -*- |
119 | +############################################################################## |
120 | +# |
121 | +# OpenERP, Open Source Management Solution |
122 | +# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). |
123 | +# |
124 | +# This program is free software: you can redistribute it and/or modify |
125 | +# it under the terms of the GNU Affero General Public License as |
126 | +# published by the Free Software Foundation, either version 3 of the |
127 | +# License, or (at your option) any later version. |
128 | +# |
129 | +# This program is distributed in the hope that it will be useful, |
130 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
131 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
132 | +# GNU Affero General Public License for more details. |
133 | +# |
134 | +# You should have received a copy of the GNU Affero General Public License |
135 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
136 | +# |
137 | +######################################################################### |
138 | + |
139 | +from datetime import datetime, date, timedelta |
140 | + |
141 | +from openerp.osv import fields, osv |
142 | +from dateutil.relativedelta import relativedelta |
143 | + |
144 | +class account_invoice(osv.osv): |
145 | + _inherit = "account.invoice" |
146 | + |
147 | + def _prepare_where_clause_dashboard(self, cr, uid, journal_id, context=None): |
148 | + if context is None: |
149 | + context = {} |
150 | + where_clause = "journal_id = %s" % (journal_id) |
151 | + fiscalyear_id = self.pool.get('account.fiscalyear').find(cr, uid, context=context) |
152 | + if context.get('company_id', False): |
153 | + company_id = context['company_id'] |
154 | + else: |
155 | + company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id |
156 | + if company_id: |
157 | + where_clause += " AND company_id = %s" % (company_id) |
158 | + if fiscalyear_id: |
159 | + where_clause += " AND period_id in (SELECT account_period.id from account_period WHERE account_period.fiscalyear_id = %s)" % (fiscalyear_id) |
160 | + return where_clause |
161 | + |
162 | + def _get_remaining_payment_stats(self, cr, uid, journal_id, context=None): |
163 | + where_clause = self._prepare_where_clause_dashboard(cr, uid, journal_id, context=context) |
164 | + where_clause += " AND state = 'open'" |
165 | + cr.execute("SELECT date_due, sum(residual) FROM account_invoice WHERE %s GROUP BY date_due" % where_clause); |
166 | + residual_values = cr.fetchall() |
167 | + todo_payment_amount, overdue_amount_today, overdue_amount_month = 0,0,0 |
168 | + |
169 | + overdue_today_date = date.today() |
170 | + overdue_month_end_date = date.today() + relativedelta(day=1, months=+1, days=-1) |
171 | + for date_due, overdue_invoice_amount in residual_values: |
172 | + todo_payment_amount += overdue_invoice_amount |
173 | + due_date = datetime.strptime(date_due,"%Y-%m-%d").date() |
174 | + if due_date <= overdue_today_date: |
175 | + overdue_amount_today += overdue_invoice_amount |
176 | + if due_date <= overdue_month_end_date: |
177 | + overdue_amount_month += overdue_invoice_amount |
178 | + |
179 | + res = { |
180 | + 'overdue_invoice_amount' : overdue_amount_today, |
181 | + 'overdue_invoice_amount_month': overdue_amount_month, |
182 | + 'todo_payment_amount': todo_payment_amount |
183 | + } |
184 | + |
185 | + return res |
186 | + |
187 | + def get_stats(self, cr, uid, journal_id, context=None): |
188 | + where_clause = self._prepare_where_clause_dashboard(cr, uid, journal_id, context=context) |
189 | + cr.execute('SELECT state, sum(amount_total) FROM account_invoice WHERE %s GROUP BY state' % (where_clause)); |
190 | + invoice_stats = cr.fetchall() |
191 | + res = {} |
192 | + for state, amount_total in invoice_stats: |
193 | + if state in ('draft', 'proforma', 'proforma2'): |
194 | + res['draft_invoice_amount'] = amount_total |
195 | + elif state == 'open': |
196 | + res['open_invoice_amount'] = amount_total |
197 | + elif state == 'paid': |
198 | + res['paid_invoice_amount'] = amount_total |
199 | + |
200 | + remaining_payment_stats = self._get_remaining_payment_stats(cr, uid, journal_id, context=context) |
201 | + res.update(remaining_payment_stats) |
202 | + return res |
203 | + |
204 | +class account_journal(osv.osv): |
205 | + _inherit = "account.journal" |
206 | + |
207 | + def _kanban_dashboard(self, cr, uid, ids, name, arg, context=None): |
208 | + res = {} |
209 | + for journal_id in ids: |
210 | + res[journal_id] = self.get_journal_dashboard_datas(cr, uid, journal_id, context=context) |
211 | + return res |
212 | + def _kanban_graph(self, cr, uid, ids, name, arg, context=None): |
213 | + res = {} |
214 | + for journal_id in ids: |
215 | + res[journal_id] = self._prepare_graph_data(cr, uid, journal_id, context=context) |
216 | + return res |
217 | + |
218 | + _columns = { |
219 | + 'kanban_dashboard':fields.function(_kanban_dashboard, type="text"), |
220 | + 'kanban_graph':fields.function(_kanban_graph, type="text"), |
221 | + } |
222 | + |
223 | + def get_journal_dashboard_datas(self, cr, uid, journal_id, context=None): |
224 | + invoice_obj = self.pool['account.invoice'] |
225 | + move_line_obj = self.pool['account.move.line'] |
226 | + |
227 | + journal = self.browse(cr, uid, journal_id ,context=context) |
228 | + |
229 | + balance, date = self._get_last_statement(cr, uid, journal_id, context=context) |
230 | + values = invoice_obj.get_stats(cr, uid, journal_id, context=context) |
231 | + |
232 | + currency_symbol = journal.company_id.currency_id.symbol |
233 | + if journal.currency: |
234 | + currency_symbol = journal.currency.symbol |
235 | + |
236 | + fiscalyear_id = self.pool.get('account.fiscalyear').find(cr, uid, context=context) |
237 | + total_reconcile_amount = move_line_obj.search(cr, uid, [('journal_id', '=', journal_id), ('period_id.fiscalyear_id', '=', fiscalyear_id), ('reconcile_partial_id','!=',False)], count=True ,context=context) |
238 | + |
239 | + values.update({ |
240 | + 'currency_symbol' : currency_symbol, |
241 | + 'last_statement_amount' : balance, |
242 | + 'last_statement_date' : date, |
243 | + 'total_reconcile_amount' : total_reconcile_amount, |
244 | + 'credit_account_name': journal.default_credit_account_id.name, |
245 | + 'credit_account_balance' : journal.default_credit_account_id.balance, |
246 | + }) |
247 | + return values |
248 | + |
249 | + |
250 | + def _get_last_statement(self, cr, uid, journal_id, context=None): |
251 | + """Get last bank statement amount and date.""" |
252 | + balance = False |
253 | + date = False |
254 | + statement_obj = self.pool['account.bank.statement'] |
255 | + date_format = self.pool['res.lang'].search_read(cr, uid, [('code','=', context.get('lang', 'en_US'))], ['date_format'], context=context)[0]['date_format'] |
256 | + statement_ids = statement_obj.search(cr, uid, [('journal_id', '=', journal_id)], order='create_date desc', limit=1, context=context) |
257 | + if statement_ids: |
258 | + statement = statement_obj.browse(cr, uid, statement_ids[0], context=context) |
259 | + if statement.journal_id.type == 'cash': |
260 | + balance = statement.balance_end |
261 | + elif statement.journal_id.type == 'bank': |
262 | + balance = statement.balance_end_real |
263 | + date = datetime.strptime(str(statement.date), '%Y-%m-%d').date().strftime(date_format) |
264 | + return (balance , date) |
265 | + |
266 | + def _prepare_graph_data(self, cr, uid, journal_id, context=None): |
267 | + """Prepare data to show graph in kanban of journals which will be called from the js""" |
268 | + res = False |
269 | + journal = self.browse(cr, uid, journal_id, context=context) |
270 | + if journal.type in ['general','situation']: |
271 | + return res |
272 | + if journal.type in ['cash','bank']: |
273 | + res = self._get_moves_per_day(cr, uid, journal, context=context) |
274 | + else: |
275 | + res = self._get_moves_per_month(cr, uid, journal, context=context) |
276 | + return res |
277 | + |
278 | + def _get_moves_per_month(self, cr, uid, journal, context=None): |
279 | + """Get amount of moves related to the perticular journals per month""" |
280 | + total = {} |
281 | + fiscalyear_pool = self.pool.get('account.fiscalyear') |
282 | + fiscalyear_id = fiscalyear_pool.find(cr, uid, context=context) |
283 | + fiscalyear = fiscalyear_pool.browse(cr, uid, fiscalyear_id, context=context) |
284 | + months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] |
285 | + state = ['posted'] if journal.type=='sale' else ['draft','posted'] |
286 | + |
287 | + |
288 | + cr.execute("SELECT to_char(line.date, 'MM') as month, SUM(line.debit) as amount\ |
289 | + FROM account_move_line AS line LEFT JOIN account_move AS move ON line.move_id=move.id\ |
290 | + WHERE line.journal_id = %s AND line.period_id in (SELECT account_period.id from account_period WHERE account_period.fiscalyear_id = %s) \ |
291 | + AND move.state in %s\ |
292 | + GROUP BY to_char(line.date, 'MM') \ |
293 | + ORDER BY to_char(line.date, 'MM')", (journal.id, fiscalyear_id, tuple(state))) |
294 | + |
295 | + values = [] |
296 | + for month, amount in cr.fetchall(): |
297 | + values.append({ |
298 | + 'x': months[int(month) - 1], |
299 | + 'y': amount |
300 | + }) |
301 | + data = { |
302 | + 'values': [], |
303 | + 'bar': True, |
304 | + 'key': fiscalyear.name |
305 | + } |
306 | + for month in months: |
307 | + amount = 0 |
308 | + for value in values: |
309 | + if month == value['x']: |
310 | + amount = value['y'] |
311 | + data['values'].append({'x': month, 'y': amount}) |
312 | + return data |
313 | + |
314 | + def _get_moves_per_day(self, cr, uid, journal, context=None): |
315 | + """Get total transactions per day for related journals""" |
316 | + data = {'values': [], 'key': 'Total'} |
317 | + date_format = self.pool['res.lang'].search_read(cr, uid, [('code', '=', context.get('lang', 'en_US'))], ['date_format'], context=context)[0]['date_format'] |
318 | + move_date = date.today()-timedelta(days=14) |
319 | + fiscalyear_id = self.pool.get('account.fiscalyear').find(cr, uid, context=context) |
320 | + #left join on account_move if we want only posted entries then we can use. |
321 | + cr.execute("SELECT SUM(line.debit), line.date\ |
322 | + FROM account_move_line AS line LEFT JOIN account_move AS move ON line.move_id=move.id\ |
323 | + WHERE line.journal_id = %s AND line.period_id in (SELECT account_period.id from account_period WHERE account_period.fiscalyear_id = %s) \ |
324 | + AND line.date >= %s\ |
325 | + GROUP BY line.date \ |
326 | + ORDER BY line.date",(journal.id, fiscalyear_id, move_date)) |
327 | + for value in cr.dictfetchall(): |
328 | + data['values'].append({ |
329 | + 'x': datetime.strptime(str(value['date']), '%Y-%m-%d').date().strftime(date_format), |
330 | + 'y': value['sum'] |
331 | + }) |
332 | + if not data['values']: |
333 | + data['values'].append({'x': datetime.strptime(str(date.today()), '%Y-%m-%d').date().strftime(date_format), 'y': 0}) |
334 | + return data |
335 | + |
336 | + def open_action(self, cr, uid, ids, context=None): |
337 | + if context is None: |
338 | + context = {} |
339 | + ir_model_obj = self.pool.get('ir.model.data') |
340 | + rec = self.browse(cr, uid, ids[0], context=context) |
341 | + if rec.type == 'bank': |
342 | + action_name = 'action_bank_statement_tree' |
343 | + elif rec.type == 'cash': |
344 | + action_name = 'action_view_bank_statement_tree' |
345 | + elif rec.type == 'sale': |
346 | + action_name = 'action_invoice_tree1' |
347 | + elif rec.type == 'purchase': |
348 | + action_name = 'action_invoice_tree2' |
349 | + elif rec.type == 'sale_refund': |
350 | + action_name = 'action_invoice_tree3' |
351 | + elif rec.type == 'purchase_refund': |
352 | + action_name = 'action_invoice_tree4' |
353 | + action_name = context.get('action_name',action_name) |
354 | + ctx = context.copy() |
355 | + _journal_invoice_type_map = {'sale': 'out_invoice', 'purchase': 'in_invoice', 'sale_refund': 'out_refund', 'purchase_refund': 'in_refund', 'bank': 'bank', 'cash': 'cash'} |
356 | + invoice_type = _journal_invoice_type_map[rec.type] |
357 | + ctx.update({'journal_type': rec.type,'default_journal_id': rec.id,'search_default_journal_id': rec.id,'default_type': invoice_type,'type': invoice_type}) |
358 | + domain = [('journal_id.type', '=', rec.type),('journal_id', '=', rec.id)] |
359 | + model, action_id = ir_model_obj.get_object_reference(cr, uid, 'account', action_name) |
360 | + action = self.pool.get(model).read(cr, uid, action_id, context=context) |
361 | + action['context'] = ctx |
362 | + action['domain'] = domain |
363 | + return action |
364 | |
365 | === added file 'account/account_journal_view.xml' |
366 | --- account/account_journal_view.xml 1970-01-01 00:00:00 +0000 |
367 | +++ account/account_journal_view.xml 2014-03-10 10:51:38 +0000 |
368 | @@ -0,0 +1,181 @@ |
369 | +<openerp> |
370 | + <data> |
371 | + <!--account.journal kanban view--> |
372 | + <record id="view_account_journal_kanban_view" model="ir.ui.view"> |
373 | + <field name="name">account.journal.dashboard.kanban</field> |
374 | + <field name="model">account.journal</field> |
375 | + <field name="arch" type="xml"> |
376 | + <kanban create="false"> |
377 | + <field name="name"/> |
378 | + <field name="type"/> |
379 | + <field name="kanban_graph"/> |
380 | + <field name="kanban_dashboard"/> |
381 | + <templates> |
382 | + <t t-name="kanban-box"> |
383 | + <t t-value="record.kanban_dashboard.raw_value" t-set="dashboard"/> |
384 | + <t t-value="record.type.raw_value" t-set="journal_type"/> |
385 | + <t t-value="dashboard.draft_invoice_amount or dashboard.overdue_invoice_amount or dashboard.todo_payment_amount or dashboard.paid_invoice_amount" t-set="is_invoice_stats"/> |
386 | + <div class="oe_kanban_vignette oe_semantic_html_override oe_kanban_card oe_journal_card"> |
387 | + <div class="row"> |
388 | + <t t-call="JournalTop" /> |
389 | + </div> |
390 | + <div class="row"> |
391 | + <t t-call="JournalDetails"/> |
392 | + </div> |
393 | + <div class="row"> |
394 | + <t t-call="JournalBottom"/> |
395 | + </div> |
396 | + </div> |
397 | + </t> |
398 | + <t t-name="JournalTop"> |
399 | + |
400 | + <div class="col-md-6 oe_journal_card_title"> |
401 | + <a class="mt0" style="font-size: 16px;" t-att-title="record.name.raw_value"><strong><field name="name"/></strong></a> |
402 | + </div> |
403 | + <div class="col-md-6"> |
404 | + <div class="pull-right"> |
405 | + <div t-if="is_invoice_stats"> |
406 | + <a t-if="journal_type == 'sale' or journal_type == 'purchase'" type="object" name="open_action">All Invoices</a> |
407 | + <a t-if="journal_type == 'purchase_refund' or journal_type == 'sale_refund'" type="object" name="open_action">All Refunds</a> |
408 | + <t t-if="dashboard.draft_invoice_amount"> |
409 | + <a> | </a> |
410 | + <a t-if="journal_type == 'sale'" type="object" name="open_action" context="{'search_default_state':'draft','action_name':'action_invoice_tree'}">Invoices to Validate</a> |
411 | + <a t-if="journal_type == 'purchase'" type="object" name="open_action" context="{'search_default_state':'draft','action_name':'action_invoice_tree'}">Control Invoices</a> |
412 | + <a t-if="journal_type == 'sale_refund'" type="object" name="open_action" context="{'search_default_state':'draft'}">Refunds to Validate</a> |
413 | + <a t-if="journal_type == 'purchase_refund'" type="object" name="open_action" context="{'search_default_state':'draft'}">Control Refunds</a> |
414 | + </t> |
415 | + </div> |
416 | + <div t-if="!is_invoice_stats"> |
417 | + <a t-if="journal_type == 'sale' or journal_type == 'purchase'" type="object" name="open_action">No Invoices yet, click to create.</a> |
418 | + <a t-if="journal_type == 'purchase_refund' or journal_type == 'sale_refund'" type="object" name="open_action">No Refunds yet, click to create.</a> |
419 | + </div> |
420 | + </div> |
421 | + <div t-if="dashboard.last_statement_amount" class="pull-right"> |
422 | + <a t-if="journal_type == 'bank' or journal_type == 'cash'" type="object" name="open_action">Statements</a> |
423 | + </div> |
424 | + <div t-if="dashboard.last_statement_amount == 0" class="pull-right"> |
425 | + <a t-if="journal_type == 'bank' or journal_type == 'cash'" type="object" name="open_action">No Statements yet, click to create.</a> |
426 | + </div> |
427 | + </div> |
428 | + </t> |
429 | + <t t-name="JournalDetails"> |
430 | + <div class="col-md-4"> |
431 | + <div t-if="dashboard.draft_invoice_amount"> |
432 | + <div class="oe_journal_title"> |
433 | + <h4 t-if="journal_type == 'sale' or journal_type == 'purchase'">Draft Invoices</h4> |
434 | + <h4 t-if="journal_type == 'sale_refund' or journal_type == 'purchase_refund'">Draft Refunds</h4> |
435 | + </div> |
436 | + <div class="oe_journal_data"> |
437 | + <span t-esc="dashboard.draft_invoice_amount"/> |
438 | + <p t-esc="dashboard.currency_symbol"/> |
439 | + </div> |
440 | + </div> |
441 | + <div t-if="dashboard.todo_payment_amount"> |
442 | + <div class="oe_journal_title"> |
443 | + <h4 t-if="journal_type == 'sale'">Receivable</h4> |
444 | + <h4 t-if="journal_type == 'sale_refund'">Refunds to Pay</h4> |
445 | + <h4 t-if="journal_type == 'purchase'">Payable</h4> |
446 | + <h4 t-if="journal_type == 'purchase_refund'">Refunds to Receive</h4> |
447 | + </div> |
448 | + <div class="oe_journal_data"> |
449 | + <span t-esc="dashboard.todo_payment_amount"/> |
450 | + <p t-esc="dashboard.currency_symbol"/> |
451 | + </div> |
452 | + </div> |
453 | + <div t-if="dashboard.paid_invoice_amount"> |
454 | + <div class="oe_journal_title"> |
455 | + <h4 t-if="journal_type == 'sale' or journal_type == 'purchase'">Paid Invoices</h4> |
456 | + <h4 t-if="journal_type == 'sale_refund' or journal_type == 'purchase_refund'">Paid Refunds</h4> |
457 | + </div> |
458 | + <div class="oe_journal_data"> |
459 | + <span t-esc="dashboard.paid_invoice_amount"/> |
460 | + <p t-esc="dashboard.currency_symbol"/> |
461 | + </div> |
462 | + </div> |
463 | + <div t-if="dashboard.overdue_invoice_amount or dashboard.overdue_invoice_amount_month"> |
464 | + <div class="oe_journal_title"> |
465 | + <h4 t-if="journal_type == 'sale' or journal_type == 'purchase'">Overdue Invoices</h4> |
466 | + <h4 t-if="journal_type == 'sale_refund' or journal_type == 'purchase_refund'">Overdue Refunds</h4> |
467 | + </div> |
468 | + <div class="oe_journal_data"> |
469 | + <i class="fa fa-clock-o" title="Overdue Invoices till today" style="color:red"> |
470 | + <span t-esc="dashboard.overdue_invoice_amount"/> |
471 | + <p t-esc="dashboard.currency_symbol"/> |
472 | + </i> |
473 | + <i class="fa fa-clock-o" title="Overdue Invoices till the end of this month" style="color:#ee7700;"> |
474 | + <span t-esc="dashboard.overdue_invoice_amount_month"/> |
475 | + <p t-esc="dashboard.currency_symbol"/> |
476 | + </i> |
477 | + </div> |
478 | + </div> |
479 | + <div t-if="journal_type == 'cash' or journal_type == 'bank'"> |
480 | + <div t-if="dashboard.last_statement_amount"> |
481 | + <div class="oe_journal_title"> |
482 | + <h4 t-if="dashboard.last_statement_date">Last Statement, <div t-esc='dashboard.last_statement_date'/></h4> |
483 | + </div> |
484 | + <div class="oe_journal_data"> |
485 | + <span t-esc="dashboard.last_statement_amount"/> |
486 | + <p t-esc="dashboard.currency_symbol"/> |
487 | + </div> |
488 | + </div> |
489 | + <div t-att-class="dashboard.credit_account_balance == dashboard.last_statement_amount ? 'oe_amount' : ''" t-if="dashboard.credit_account_balance"> |
490 | + <div class="oe_journal_title"> |
491 | + <h4>Account <div t-esc="dashboard.credit_account_name"/></h4> |
492 | + </div> |
493 | + <div class="oe_journal_data"> |
494 | + <span t-esc="dashboard.credit_account_balance"/> |
495 | + <p t-esc="dashboard.currency_symbol"/> |
496 | + </div> |
497 | + </div> |
498 | + </div> |
499 | + </div> |
500 | + <div class="col-md-8"> |
501 | + <div class="text-center"> |
502 | + <h4 t-if="journal_type == 'bank'"> Bank Payments </h4> |
503 | + <h4 t-if="journal_type == 'cash'"> Cash Payments </h4> |
504 | + <h4 t-if="journal_type == 'sale'"> Aged Balance </h4> |
505 | + <h4 t-if="journal_type == 'purchase'"> Invoices Per Month </h4> |
506 | + <h4 t-if="journal_type == 'sale_refund' or journal_type == 'purchase_refund'"> Refunds Per Month </h4> |
507 | + </div> |
508 | + <div class="oe_graph"> |
509 | + <field name="kanban_graph" t-att-journal_type="journal_type" widget="journal_dashboard_graph"></field> |
510 | + </div> |
511 | + </div> |
512 | + </t> |
513 | + <t t-name="JournalBottom"> |
514 | + <div class="col-md-12"> |
515 | + <div t-if="journal_type == 'sale'" name="sale_journal_bottom"> |
516 | + </div> |
517 | + <div t-if="journal_type == 'purchase'"> |
518 | + <a t-attf-href="{dashboard.open_action}" type="object" name="open_action" context="{'search_default_state':'open'}">Invoices to Pay</a> |
519 | + </div> |
520 | + <div t-if="journal_type == 'bank' or journal_type == 'cash' and dashboard.total_reconcile_amount gt 0"> |
521 | + <a t-if="dashboard.total_reconcile_amount == 1" type="object" name="open_action" context="{'search_default_unreconciled':1,'view_mode':1,'action_name':'action_account_manual_reconcile'}" t-esc="dashboard.total_reconcile_amount"> Item to Reconcile</a> |
522 | + <a t-if="dashboard.total_reconcile_amount gt 1" type="object" name="open_action" context="{'search_default_unreconciled':1,'view_mode':1,'action_name':'action_account_manual_reconcile'}" t-esc="dashboard.total_reconcile_amount"> Items to Reconcile</a> |
523 | + </div> |
524 | + </div> |
525 | + </t> |
526 | + </templates> |
527 | + </kanban> |
528 | + </field> |
529 | + </record> |
530 | + |
531 | + <record id="open_account_journal_kanban" model="ir.actions.act_window"> |
532 | + <field name="name">Journals</field> |
533 | + <field name="res_model">account.journal</field> |
534 | + <field name="view_type">form</field> |
535 | + <field name="view_mode">kanban</field> |
536 | + <field name="usage">menu</field> |
537 | + <field name="domain">[('type','not in',['general','situation'])]</field> |
538 | + <field name="help" type="html"> |
539 | + <p style="margin-left: -90px;"> |
540 | + To track activities in your bank accounts and analyse your sales and purchase journals, install the <a type="action" name="%(account.open_account_charts_modules)d" class="oe_link">chart of account matching your country</a> or <a type="action" name="%(account.action_account_configuration_installer)d" class="oe_link">configure the custom chart of accounts.</a> |
541 | + </p> |
542 | + </field> |
543 | + </record> |
544 | + |
545 | + <menuitem id="menu_finance_journal_board" name="Journals" parent="menu_finance" sequence="1"/> |
546 | + <menuitem id="menu_board_journal_1" name="Dashboard" action="open_account_journal_kanban" parent="menu_finance_journal_board" sequence="1"/> |
547 | + |
548 | + </data> |
549 | +</openerp> |
550 | |
551 | === modified file 'account/account_view.xml' |
552 | --- account/account_view.xml 2014-02-20 16:38:15 +0000 |
553 | +++ account/account_view.xml 2014-03-10 10:51:38 +0000 |
554 | @@ -376,9 +376,10 @@ |
555 | <field name="arch" type="xml"> |
556 | <search string="Search Account Journal"> |
557 | <field name="name" filter_domain="['|', ('name','ilike',self), ('code','ilike',self)]" string="Journal"/> |
558 | + <field name="company_id" groups="base.group_multi_company"/> |
559 | <filter domain="['|', ('type', '=', 'sale'), ('type', '=', 'sale_refund')]" string="Sale" icon="terp-camera_test"/> |
560 | <filter domain="['|', ('type', '=', 'purchase'), ('type', '=', 'purchase_refund')]" string="Purchase" icon="terp-purchase"/> |
561 | - <filter domain="['|', ('type', '=', 'cash'), ('type', '=', 'bank')]" string="Liquidity" icon="terp-dolar"/> |
562 | + <filter domain="['|', ('type', '=', 'cash'), ('type', '=', 'bank')]" string="Bank & Cash" icon="terp-dolar"/> |
563 | <filter domain="['|', ('type', '=', 'general'), ('type', '=', 'situation')]" string="Others" icon="terp-stock"/> |
564 | <field name="user_id"/> |
565 | <group expand="0" string="Group By..."> |
566 | @@ -2400,6 +2401,7 @@ |
567 | </field> |
568 | </record> |
569 | |
570 | + |
571 | <record model="ir.actions.act_window.view" id="act_cash_statement1_all"> |
572 | <field name="sequence" eval="1"/> |
573 | <field name="view_mode">tree</field> |
574 | |
575 | === modified file 'account/company.py' |
576 | --- account/company.py 2013-10-27 12:31:04 +0000 |
577 | +++ account/company.py 2014-03-10 10:51:38 +0000 |
578 | @@ -47,5 +47,13 @@ |
579 | Best Regards,''' |
580 | } |
581 | |
582 | - |
583 | + def _company_default_get(self, cr, uid, object=False, field=False, context=None): |
584 | + """ Check if the default_journal_id sent in the context to set default value of journal then |
585 | + avoid to set default company as it will set company_id from onchange_journal_id """ |
586 | + if not context: |
587 | + context = {} |
588 | + company_id = super(res_company, self)._company_default_get(cr, uid, object=object, field=field, context=context) |
589 | + if context.get('default_journal_id') and object == 'account.invoice': |
590 | + company_id = False |
591 | + return company_id |
592 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
593 | |
594 | === added file 'account/static/src/css/Makefile' |
595 | --- account/static/src/css/Makefile 1970-01-01 00:00:00 +0000 |
596 | +++ account/static/src/css/Makefile 2014-03-10 10:51:38 +0000 |
597 | @@ -0,0 +1,2 @@ |
598 | +sass: |
599 | + sass -t expanded --compass --unix-newlines --watch account_journal.sass:account_journal.css& |
600 | \ No newline at end of file |
601 | |
602 | === added file 'account/static/src/css/account_journal.css' |
603 | --- account/static/src/css/account_journal.css 1970-01-01 00:00:00 +0000 |
604 | +++ account/static/src/css/account_journal.css 2014-03-10 10:51:38 +0000 |
605 | @@ -0,0 +1,26 @@ |
606 | +.openerp .oe_kanban_view .oe_journal_card { |
607 | + width: 500px; |
608 | +} |
609 | +.openerp .oe_kanban_view .oe_journal_title { |
610 | + -webkit-border-radius: 3px; |
611 | + -moz-border-radius: 3px; |
612 | + border-radius: 3px; |
613 | + padding: 5px; |
614 | + background: #f0eeee; |
615 | + color: #666666; |
616 | +} |
617 | +.openerp .oe_kanban_view .oe_journal_data { |
618 | + margin-left:10px; |
619 | +} |
620 | +.openerp .oe_kanban_view .oe_graph { |
621 | + float: right; |
622 | + width: 325px; |
623 | +} |
624 | +.openerp .oe_kanban_view .oe_graph > div { |
625 | + height: 224px; |
626 | +} |
627 | +.openerp .oe_kanban_view .oe_journal_card_title { |
628 | + overflow: hidden; |
629 | + white-space: nowrap; |
630 | + text-overflow: ellipsis; |
631 | +} |
632 | |
633 | === added file 'account/static/src/css/account_journal.sass' |
634 | --- account/static/src/css/account_journal.sass 1970-01-01 00:00:00 +0000 |
635 | +++ account/static/src/css/account_journal.sass 2014-03-10 10:51:38 +0000 |
636 | @@ -0,0 +1,22 @@ |
637 | +.openerp |
638 | + .oe_kanban_view |
639 | + .oe_journal_card |
640 | + width: 500px |
641 | + .oe_journal_title |
642 | + -webkit-border-radius: 3px |
643 | + -moz-border-radius: 3px |
644 | + border-radius: 3px |
645 | + padding: 5px |
646 | + background: #f0eeee |
647 | + color: #666666 |
648 | + .oe_journal_data |
649 | + margin-left:10px; |
650 | + .oe_graph |
651 | + float: right |
652 | + width: 325px |
653 | + > div |
654 | + height: 224px |
655 | + .oe_journal_card_title |
656 | + overflow: hidden |
657 | + white-space: nowrap |
658 | + text-overflow: ellipsis |
659 | |
660 | === added file 'account/static/src/js/account_journal.js' |
661 | --- account/static/src/js/account_journal.js 1970-01-01 00:00:00 +0000 |
662 | +++ account/static/src/js/account_journal.js 2014-03-10 10:51:38 +0000 |
663 | @@ -0,0 +1,47 @@ |
664 | +openerp.account.graph_kanban = function (instance) |
665 | +{ |
666 | + var _t = instance.web._t, |
667 | + _lt = instance.web._lt; |
668 | + instance.web_kanban.JournalDashboardGraph = instance.web_kanban.AbstractField.extend({ |
669 | + start: function() { |
670 | + var self = this; |
671 | + self.journal_type = self.$node.attr('journal_type') |
672 | + self.display_graph(self.field.raw_value); |
673 | + }, |
674 | + display_graph : function(data) { |
675 | + var self = this; |
676 | + nv.addGraph(function () { |
677 | + self.$el.append('<svg>'); |
678 | + if (self.journal_type === 'cash' || self.journal_type === 'bank') { |
679 | + var chart = nv.models.lineChart() |
680 | + .x(function (d,u) { return u }) |
681 | + .forceY([0, 100]) |
682 | + .width(300) |
683 | + .height(225); |
684 | + chart.xAxis |
685 | + .tickFormat(function(d) { |
686 | + return data.values[d] && data.values[d].x || ''; |
687 | + }) |
688 | + .rotateLabels(35) |
689 | + .showMaxMin(false); |
690 | + |
691 | + } else { |
692 | + var chart = nv.models.multiBarChart() |
693 | + .width(335) |
694 | + .height(240) |
695 | + .showControls(false) |
696 | + .rotateLabels(35) |
697 | + .forceY([0, 100]) |
698 | + .reduceXTicks(false); |
699 | + } |
700 | + self.svg = self.$el.find('svg')[0]; |
701 | + d3.select(self.svg) |
702 | + .datum([data]) |
703 | + .transition().duration(1200) |
704 | + .call(chart); |
705 | + nv.utils.windowResize(function() { d3.select(self.svg).call(chart) }); |
706 | + }); |
707 | + }, |
708 | + }); |
709 | + instance.web_kanban.fields_registry.add("journal_dashboard_graph", "instance.web_kanban.JournalDashboardGraph"); |
710 | +}; |
711 | |
712 | === modified file 'account/static/src/js/account_move_reconciliation.js' |
713 | --- account/static/src/js/account_move_reconciliation.js 2013-10-27 12:31:04 +0000 |
714 | +++ account/static/src/js/account_move_reconciliation.js 2014-03-10 10:51:38 +0000 |
715 | @@ -1,5 +1,6 @@ |
716 | openerp.account = function (instance) { |
717 | openerp.account.quickadd(instance); |
718 | + openerp.account.graph_kanban(instance); |
719 | var _t = instance.web._t, |
720 | _lt = instance.web._lt; |
721 | var QWeb = instance.web.qweb; |
722 | |
723 | === modified file 'account_followup/__openerp__.py' |
724 | --- account_followup/__openerp__.py 2012-12-09 10:55:27 +0000 |
725 | +++ account_followup/__openerp__.py 2014-03-10 10:51:38 +0000 |
726 | @@ -51,10 +51,10 @@ |
727 | 'security/account_followup_security.xml', |
728 | 'security/ir.model.access.csv', |
729 | 'report/account_followup_report.xml', |
730 | + 'wizard/account_followup_print_view.xml', |
731 | 'account_followup_data.xml', |
732 | 'account_followup_view.xml', |
733 | 'account_followup_customers.xml', |
734 | - 'wizard/account_followup_print_view.xml', |
735 | ], |
736 | 'demo': ['account_followup_demo.xml'], |
737 | 'test': [ |
738 | |
739 | === modified file 'account_followup/account_followup_customers.xml' |
740 | --- account_followup/account_followup_customers.xml 2013-11-27 15:32:57 +0000 |
741 | +++ account_followup/account_followup_customers.xml 2014-03-10 10:51:38 +0000 |
742 | @@ -159,5 +159,32 @@ |
743 | <menuitem id="base.menu_sales_followup" parent="base.menu_base_partner" name="Payment Follow-up" groups="account.group_account_invoice" sequence="2"/> |
744 | <menuitem id="menu_sale_followup" parent="base.menu_sales_followup" sequence="10" |
745 | action="action_customer_my_followup" groups="account.group_account_invoice"/> |
746 | + |
747 | + <!--account.journal kanban view--> |
748 | + |
749 | + <record id="action_customer_followup" model="ir.actions.act_window"> |
750 | + <field name="name">Follow-Ups</field> |
751 | + <field name="view_id" ref="customer_followup_tree"/> |
752 | + <field name="res_model">res.partner</field> |
753 | + <field name="view_type">form</field> |
754 | + <field name="view_mode">tree,form</field> |
755 | + <field name="domain">[('payment_amount_due', '>', 0.0)]</field> |
756 | + <field name="context">{'Followupfirst':True, 'search_default_todo': True} </field> |
757 | + <field name="search_view_id" ref="customer_followup_search_view"/> |
758 | + </record> |
759 | + |
760 | + <record id="view_account_journal_kanban_view_followup" model="ir.ui.view"> |
761 | + <field name="name">account.journal.dashboard.kanban.followup</field> |
762 | + <field name="model">account.journal</field> |
763 | + <field name="inherit_id" ref="account.view_account_journal_kanban_view"/> |
764 | + <field name="arch" type="xml"> |
765 | + <xpath expr="//div[@name='sale_journal_bottom']" position="inside"> |
766 | + <a type='action' name='%(account_followup.action_account_followup_print)d'>Automated Follow-Ups</a> |
767 | + <a> | </a> |
768 | + <a type='action' name='%(action_customer_followup)d'>Manual Follow-Ups</a> |
769 | + </xpath> |
770 | + </field> |
771 | + </record> |
772 | + |
773 | </data> |
774 | </openerp> |
Hello turkesh,
Please use 'multi' in function fields of account.journal.
Thanks