[IMP] create sql view(model) to fecth appropriate data from various tables, improve view as per mock-up specification

bzr revid: rgaopenerp-20120627130529-5jonfjm2fkoh61vu
This commit is contained in:
RGA(OpenERP) 2012-06-27 18:35:29 +05:30
parent 7ab3d99621
commit 4647ff5b8f
8 changed files with 155 additions and 8 deletions

View File

@ -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:

View File

@ -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',

View File

@ -0,0 +1,69 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
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

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_move_line_extended_form_view" model="ir.ui.view">
<field name="name">account.move.partner.info.form</field>
<field name="model">account.move.partner.info</field>
<field name="type">form</field>
<field eval="2" name="priority"/>
<field name="arch" type="xml">
<form string="Journal Item" layout="manual" version="7.0">
<h3>
<field name="partner_id" widget="many2one_pager"/>
</h3>
<div class="oe_right">
<label for="last_reconciliation_date"/>
<field name="last_reconciliation_date"/>
<label for="latest_date"/>
<field name="latest_date" />
</div>
<div class="oe_button_container">
<button string="Reconcile" name="170" widget="list_button" type="action"/>
<button string="Nothing to Reconcile" name="171" widget="list_button" type="action"/>
<field name="reconciliation_progress" widget="progressbar"/>
<label for="followup_date"/>
<field name="followup_date"/>
</div>
</form>
</field>
</record>
</data>
</openerp>

View File

@ -974,7 +974,7 @@
<!--
Entries lines
-->
<record id="view_move_line_extended_form_view" model="ir.ui.view">
<!-- <record id="view_move_line_extended_form_view" model="ir.ui.view">
<field name="name">account.move.line.form</field>
<field name="model">account.move.line</field>
<field name="type">form</field>
@ -992,8 +992,7 @@
</group>
</form>
</field>
</record>
</record> -->
<record id="view_move_line_tree" model="ir.ui.view">
<field name="name">account.move.line.tree</field>
<field name="model">account.move.line</field>

View File

@ -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;
}

View File

@ -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'))

View File

@ -14,7 +14,8 @@
</div>
</t>
<t t-name="FieldMany2One_Pager">
<span class="oe_form_field oe_form_field_many2one oe_form_field_with_button">
<span class="oe_form_field_many2one oe_form_field_with_button">
<ul class="oe_pager_group">
<li>
<a type="button" data-pager-action="previous">Previous</a>
@ -23,8 +24,15 @@
<a type="button" data-pager-action="next">Next</a>
</li>
</ul>
<a t-if="widget.get('effective_readonly')" href="#" class="oe_form_uri"/>
<ul class="oe_pager_m2o">
<li>
<a t-if="widget.get('effective_readonly')" href="#" class="oe_form_uri"/>
</li>
<li>
(<span class="oe_pager_index_extend">0</span><span class="oe_pager_separator"> / </span><span class="oe_pager_count_extend">0</span>)
</li>
</ul>
<t t-if="!widget.get('effective_readonly')">
<button class="oe_button oe-m2o-cm-button" title="Open Resource">
<img t-att-src='_s + "/web/static/src/img/icons/terp-folder-yellow.png"'/>
@ -42,6 +50,7 @@
</div>
</t>
</span>
</t>
</templates>