From 4647ff5b8fc155b06af19c95b468bc2ca5be52f3 Mon Sep 17 00:00:00 2001 From: "RGA(OpenERP)" <> Date: Wed, 27 Jun 2012 18:35:29 +0530 Subject: [PATCH] [IMP] create sql view(model) to fecth appropriate data from various tables, improve view as per mock-up specification bzr revid: rgaopenerp-20120627130529-5jonfjm2fkoh61vu --- addons/account/__init__.py | 1 + addons/account/__openerp__.py | 1 + addons/account/account_move_line_extended.py | 69 +++++++++++++++++++ addons/account/account_move_line_extended.xml | 31 +++++++++ addons/account/account_view.xml | 5 +- addons/account/static/src/css/account.css | 38 ++++++++++ addons/account/static/src/js/account.js | 5 +- addons/account/static/src/xml/account.xml | 13 +++- 8 files changed, 155 insertions(+), 8 deletions(-) create mode 100644 addons/account/account_move_line_extended.py create mode 100644 addons/account/account_move_line_extended.xml create mode 100644 addons/account/static/src/css/account.css diff --git a/addons/account/__init__.py b/addons/account/__init__.py index 90fbdb83980..3a2273379da 100644 --- a/addons/account/__init__.py +++ b/addons/account/__init__.py @@ -38,5 +38,6 @@ import company import res_currency import edi import res_config +import account_move_line_extended # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py index aecc326f39c..59abf719a3c 100644 --- a/addons/account/__openerp__.py +++ b/addons/account/__openerp__.py @@ -68,6 +68,7 @@ module named account_voucher. 'wizard/account_period_close_view.xml', 'wizard/account_reconcile_view.xml', 'wizard/account_unreconcile_view.xml', + 'account_move_line_extended.xml', 'account_view.xml', 'account_report.xml', 'account_financial_report_data.xml', diff --git a/addons/account/account_move_line_extended.py b/addons/account/account_move_line_extended.py new file mode 100644 index 00000000000..b04d86284b6 --- /dev/null +++ b/addons/account/account_move_line_extended.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +import tools +from osv import fields,osv + + +class account_move_partner_info(osv.osv): + _name = "account.move.partner.info" + _description = "All partner info related account move line" + _auto = False + + def _rec_progress(self, cr, uid, ids, prop, unknow_none, context=None): + #ToDo + res = {} + for id in ids: + res[id] = 50 + return res + + _columns = { + 'partner_id':fields.many2one('res.partner', 'Partner'), + 'last_reconciliation_date':fields.datetime('Last Reconciliation'), + 'latest_date' :fields.date('Latest Entry'), + 'followup_date': fields.date('Latest Follow-up'), + 'reconciliation_progress': fields.function(_rec_progress, string='Progress (%)', type='float') + + } + def init(self, cr): + tools.drop_view_if_exists(cr, 'analytic_entries_report') + cr.execute(""" + create or replace view account_move_partner_info as ( + SELECT p.id, p.id as partner_id, + max(p.last_reconciliation_date) as last_reconciliation_date, + max(l.date) as latest_date, + max(l.followup_date) as followup_date + FROM account_move_line as l INNER JOIN res_partner AS p ON (l.partner_id = p.id) + group by p.id + ) + """) +account_move_partner_info() + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + + + +#SELECT p.id as partner_id, +# max(p.last_reconciliation_date) as last_reconciliation_date, +# max(l.date) as latest_date, +# max(l.followup_date) as followup_date +#From account_move_line as l INNER JOIN res_partner AS p ON (l.partner_id = p.id) +#group by p.id \ No newline at end of file diff --git a/addons/account/account_move_line_extended.xml b/addons/account/account_move_line_extended.xml new file mode 100644 index 00000000000..911c0d43f81 --- /dev/null +++ b/addons/account/account_move_line_extended.xml @@ -0,0 +1,31 @@ + + + + + account.move.partner.info.form + account.move.partner.info + form + + +
+

+ +

+
+
+
+
+
+
+
+
+
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 8c754533024..686d0a51e40 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -974,7 +974,7 @@ - + account.move.line.tree account.move.line diff --git a/addons/account/static/src/css/account.css b/addons/account/static/src/css/account.css new file mode 100644 index 00000000000..963c4391595 --- /dev/null +++ b/addons/account/static/src/css/account.css @@ -0,0 +1,38 @@ + +.openerp .oe_extended_form_view .oe_formview { + background-color: #eeeeee; + -webkit-border-radius: 10px; + -moz-border-radius: 10px; + border-radius: 10px; + border:2px solid; + } + +.openerp .oe_pager_m2o li { + display: inline-block; + height: 24px; + line-height: 24px; + padding: 0; + float: left; +} + +.openerp .oe_pager_m2o a { + padding: 0 8px; +} + +.openerp .oe_extended_form_view .oe_form_field:empty { + display: inline-block ; +} + +.openerp .oe_extended_form_view button { + margin-right: 10px +} + +.openerp .oe_extended_form_view .oe_button_container .oe_form_field{ + width: auto; + margin: 0px 10px 0px 10px; +} +.openerp .oe_extended_form_view .oe_button_container{ + display: inline-block ; + width:100%; + margin: 10px; +} \ No newline at end of file diff --git a/addons/account/static/src/js/account.js b/addons/account/static/src/js/account.js index a08866613d9..e4ca9ada55f 100644 --- a/addons/account/static/src/js/account.js +++ b/addons/account/static/src/js/account.js @@ -48,7 +48,8 @@ instance.account.extend_actionmanager = instance.web.ActionManager.include({ instance.account.extend_viewmanager = instance.web.ViewManagerAction.extend({ init: function(parent, action) { this._super.apply(this,arguments); - this.dataset_form = new instance.web.DataSetSearch(this, action.res_model, action.context, action.domain); + //Fix me: pass hard coded model name, find the way to fetch it from server + this.dataset_form = new instance.web.DataSetSearch(this, 'account.move.partner.info', action.context, action.domain); }, start : function(){ this._super() @@ -66,9 +67,7 @@ instance.account.extend_viewmanager = instance.web.ViewManagerAction.extend({ obj_from_view; view_id = this.action.extended_form_view_id[0] from_view = this.registry.get_object('form_clone'); - this.dataset_form.context.extended_from = true this.dataset_loaded = this.dataset_form.read_slice() - this.dataset_form.context.extended_from = false obj_from_view = new from_view(self, this.dataset_form, view_id, options={}); obj_from_view.template = 'ExtendedFormView' view_promise = obj_from_view.appendTo(this.$element.find('.oe_extended_form_view')) diff --git a/addons/account/static/src/xml/account.xml b/addons/account/static/src/xml/account.xml index 506d2c862dc..dba545b219a 100644 --- a/addons/account/static/src/xml/account.xml +++ b/addons/account/static/src/xml/account.xml @@ -14,7 +14,8 @@ - + + - + +