Nicolas (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-manual-reconciliation-rga into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-manual-reconciliation-rga/+merge/123945
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-manual-reconciliation-rga/+merge/123945
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-manual-reconciliation-rga.
=== modified file 'account/__init__.py'
--- account/__init__.py	2012-08-10 10:27:43 +0000
+++ account/__init__.py	2012-09-12 12:31:34 +0000
@@ -38,5 +38,6 @@
 import res_currency
 import edi
 import res_config
+import account_move_reconciliation
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'account/__openerp__.py'
--- account/__openerp__.py	2012-08-22 07:14:45 +0000
+++ account/__openerp__.py	2012-09-12 12:31:34 +0000
@@ -63,6 +63,9 @@
         'wizard/account_use_model_view.xml',
         'account_installer.xml',
         'wizard/account_period_close_view.xml',
+        'wizard/account_reconcile_view.xml',
+        'wizard/account_unreconcile_view.xml',
+        'account_move_reconciliation.xml',
         'account_view.xml',
         'account_report.xml',
         'account_financial_report_data.xml',
@@ -85,14 +88,12 @@
         'wizard/account_journal_select_view.xml',
         'wizard/account_change_currency_view.xml',
         'wizard/account_validate_move_view.xml',
-        'wizard/account_unreconcile_view.xml',
         'wizard/account_report_general_ledger_view.xml',
         'wizard/account_invoice_state_view.xml',
         'wizard/account_report_partner_balance_view.xml',
         'wizard/account_report_account_balance_view.xml',
         'wizard/account_report_aged_partner_balance_view.xml',
         'wizard/account_report_partner_ledger_view.xml',
-        'wizard/account_reconcile_view.xml',
         'wizard/account_reconcile_partner_process_view.xml',
         'wizard/account_automatic_reconcile_view.xml',
         'wizard/account_financial_report_view.xml',
@@ -126,7 +127,15 @@
         'res_config_view.xml',
         'account_pre_install.yml'
     ],
-    'demo': [
+    'js': [
+        'static/src/js/account_move_reconciliation.js',
+    ],
+    'qweb' : [
+        "static/src/xml/account_move_reconciliation.xml",
+    ],
+    'css':['static/src/css/account_move_reconciliation.css'
+    ],
+    'demo_xml': [
         'demo/account_demo.xml',
         'project/project_demo.xml',
         'project/analytic_account_demo.xml',

=== modified file 'account/account_move_line.py'
--- account/account_move_line.py	2012-08-07 11:34:14 +0000
+++ account/account_move_line.py	2012-09-12 12:31:34 +0000
@@ -701,6 +701,8 @@
     def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
         if context is None:
             context = {}
+        if context and context.get('account_type', False):
+            args.append(('account_id.type', '=', context.get('account_type', False)))
         if context and context.get('next_partner_only', False):
             if not context.get('partner_id', False):
                 partner = self.get_next_partner_only(cr, uid, offset, context)

=== added file 'account/account_move_reconciliation.py'
--- account/account_move_reconciliation.py	1970-01-01 00:00:00 +0000
+++ account/account_move_reconciliation.py	2012-09-12 12:31:34 +0000
@@ -0,0 +1,138 @@
+# -*- 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 time
+
+import tools
+from osv import fields,osv
+
+class account_move_line(osv.osv):
+    _inherit = "account.move.line"
+    
+    def get_unreconcile_entry(self, cr, uid, ids, context=None):
+        return self.search(cr, uid, [('id', 'in', ids), ('reconcile_id', '=', False)], context=context)
+
+account_move_line();
+
+
+class account_move_reconciliation(osv.osv):
+    _name = "account.move.reconciliation"
+    _description = "partner info related account move line"
+    _auto = False
+    _order = 'last_reconciliation_date'
+
+    def search(self, cr, uid, args, offset=0, limit=None, order=None,
+            context=None, count=False):
+        if context is None:
+            context = {}
+        account_type = context.get('account_type', False)
+        if account_type:
+            args += [('type','=', account_type)]
+        return super(account_move_reconciliation, self).search(cr, uid, args, offset, limit,
+                order, context=context, count=count)
+
+
+    def _get_to_reconcile_partners(self, cr, uid, context=None):
+        if context is None:
+            context = {}
+        ctx = dict(context)
+        ctx['next_partner_only'] = False
+        move_line_obj = self.pool.get("account.move.line")
+        to_reconcile_ids = move_line_obj.search(cr, uid, [
+                    ('reconcile_id','=',False), 
+                    ('account_id.reconcile','=',True), 
+                    ('state','!=', 'draft'), 
+                    ('partner_id','!=', False), 
+                    '|', ('partner_id.last_reconciliation_date', '=', False),('partner_id.last_reconciliation_date','<',time.strftime('%Y-%m-%d 00:00:00')),
+                    '|', ('debit', '>' ,0), ('credit', '>' ,0)
+                    ], 
+                context=ctx)
+        partner_ids = []
+        for move_line in move_line_obj.browse(cr, uid, to_reconcile_ids, context=ctx):
+            partner = move_line.partner_id
+            if move_line.date > partner.last_reconciliation_date and partner.id not in partner_ids:
+                partner_ids.append(partner.id)
+        return len(partner_ids)
+
+    def _get_today_reconciled_partners(self, cr, uid, context=None):
+        if context is None:
+            context = {}
+        account_type = context.get("account_type", False)
+        supplier = False
+        customer = False
+        if account_type == 'payable':
+            supplier = True
+        else:
+            customer = True
+        today_reconciled_ids = self.pool.get('res.partner').search(cr, uid, [
+                ('last_reconciliation_date','>=',time.strftime('%Y-%m-%d 00:00:00')),
+                ('last_reconciliation_date','<=',time.strftime('%Y-%m-%d 23:59:59')),
+                '|', ('supplier','=',supplier), ('customer','=',customer)
+            ], context=context)
+        return today_reconciled_ids and len(today_reconciled_ids) or 0
+        
+    def _rec_progress(self, cr, uid, ids, prop, unknow_none, context=None):
+        res = {}
+        to_reconcile = self._get_to_reconcile_partners(cr, uid, context=context)
+        today_reconciled = self._get_today_reconciled_partners(cr, uid, context=context)
+        if to_reconcile < 0:
+            reconciliation_progress = 100
+        else:
+            reconciliation_progress = (100 / (float( to_reconcile + today_reconciled) or 1.0)) * today_reconciled
+        for id in ids:
+            res[id] = reconciliation_progress
+        return res
+  
+        
+    def skip_partner(self, cr, uid, ids, context):
+        self.pool.get('res.partner').write(cr, uid, ids ,{'last_reconciliation_date':time.strftime("%Y-%m-%d")}, context)
+            
+    _columns = {
+        'partner_id':fields.many2one('res.partner', 'Partner'),
+        'last_reconciliation_date':fields.related('partner_id', 'last_reconciliation_date' ,type='datetime', relation='res.partner', string='Last Reconciliation'),
+        'latest_date' :fields.date('Latest Entry'),
+        'type': fields.char('Type', size=156),
+        'supplier': fields.related('partner_id', 'supplier' ,type='boolean', string='Supplier'),
+        'customer': fields.related('partner_id', 'customer' ,type='boolean', string='Customer'),
+        'reconciliation_progress': fields.function(_rec_progress, string='Progress (%)',  type='float'),
+    }
+    
+    def init(self, cr):
+        tools.drop_view_if_exists(cr, 'account_move_reconciliation')
+        cr.execute("""
+            CREATE or REPLACE VIEW account_move_reconciliation as (
+                SELECT move_line.partner_id AS id, a.type AS type, move_line.partner_id AS partner_id, 
+                        SUM(move_line.debit) AS debit, 
+                        SUM(move_line.credit) AS credit, 
+                        MAX(move_line.date) AS latest_date,
+                        MIN(partner.last_reconciliation_date) AS last_reconciliation_date
+                FROM account_move_line move_line
+                LEFT JOIN account_account a ON (a.id = move_line.account_id)
+                LEFT JOIN res_partner partner ON (move_line.partner_id = partner.id)
+                WHERE a.reconcile IS TRUE
+                    AND move_line.reconcile_id IS NULL
+                    AND (partner.last_reconciliation_date IS NULL OR move_line.date > partner.last_reconciliation_date)
+                    AND move_line.state <> 'draft'
+                GROUP BY move_line.partner_id, a.type
+             )
+        """)
+account_move_reconciliation()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'account/account_move_reconciliation.xml'
--- account/account_move_reconciliation.xml	1970-01-01 00:00:00 +0000
+++ account/account_move_reconciliation.xml	2012-09-12 12:31:34 +0000
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+        <!-- Extended View of Reconciliation Entry -->
+         <record id="view_account_move_reconciliation_form_view" model="ir.ui.view">
+            <field name="name">account.move.reconciliation.form</field>
+            <field name="model">account.move.reconciliation</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">
+                    <group>
+                        <h3>
+                            <a type="button" class="oe_pager_button" data-pager-action="previous">Previous</a>
+                            <a type="button" class="oe_pager_button" data-pager-action="next">Next</a>
+                            <field name="partner_id"/>
+                            (<span class="oe_pager_index_extend">0</span><span class="oe_pager_separator"> / </span><span class="oe_pager_count_extend">0</span>)
+                        </h3>
+                        <div>
+                            <label for="last_reconciliation_date"/>
+                            <field name="last_reconciliation_date"  widget="date"/>
+                            <label for="latest_date"/>
+                            <field name="latest_date"/>
+                        </div>
+                        <div  class="oe_reconcile_row">
+                            <a type="button" class="oe_reconcile  oe_reconcile_button" name="%(action_view_account_move_line_reconcile)d">Reconcile</a>
+                            <a type="button" class="oe_nothing_to_reconcile  oe_reconcile_button" name="skip_partner">Nothing to Reconcile</a>
+                            <field name="reconciliation_progress" widget="progressbar"/>
+                        </div>         
+                        <div name="grp_followup"  class="oe_reconcile_row">
+                        </div>
+                    </group>
+                </form>
+            </field>
+        </record>
+
+        <!-- Menu and Action -->
+        <record id="action_account_receivable_manual_reconcile" model="ir.actions.act_window">
+            <field name="name">Reconcile Customer Entries</field>
+            <field name="res_model">account.move.line</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">tree,form</field>
+            <field eval="False" name="auto_search"/>
+            <field name="context" eval="{'account_type':'receivable','view_mode':True,'extended_model':'account.move.reconciliation','extended_view_id': ref('view_account_move_reconciliation_form_view'), 'search_default_unreconciled': 1}"></field>
+        </record>
+        
+        <record id="action_account_payable_manual_reconcile" model="ir.actions.act_window">
+            <field name="name">Reconcile Supplier Entries</field>
+            <field name="res_model">account.move.line</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">tree,form</field>
+            <field eval="False" name="auto_search"/>
+            <field name="context" eval="{'account_type':'payable','view_mode':True,'extended_model':'account.move.reconciliation','extended_view_id': ref('view_account_move_reconciliation_form_view'), 'search_default_unreconciled': 1}"></field>
+        </record>
+
+        <menuitem
+             name="Manual Reconciliation" icon="STOCK_EXECUTE"
+             id="menu_manual_reconcile"
+             parent="account.periodical_processing_reconciliation"/>
+
+        <menuitem id="receivable_manual_reconcile" name="Reconcile Customer Entries"
+         action="action_account_receivable_manual_reconcile"
+         parent="account.menu_manual_reconcile"/>
+
+        <menuitem id="payable_manual_reconcile" name="Reconcile Supplier Entries"
+         action="action_account_payable_manual_reconcile"
+         parent="account.menu_manual_reconcile"/>
+
+    </data>
+</openerp>

=== modified file 'account/account_view.xml'
--- account/account_view.xml	2012-09-11 08:42:15 +0000
+++ account/account_view.xml	2012-09-12 12:31:34 +0000
@@ -1047,20 +1047,19 @@
         <!--
     Entries lines
     -->
-
         <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>
             <field eval="4" name="priority"/>
             <field name="arch" type="xml">
-                <tree colors="red:state == 'draft';black:state == 'valid'" string="Journal Items" editable="top" on_write="on_create_write">
+                <tree colors="red:state == 'draft';black:state == 'valid'" string="Journal Items" editable="top" on_write="on_create_write" default_selection="get_unreconcile_entry">
                     <field name="date"/>
-                    <field name="period_id"/>
+                    <field name="period_id"  invisible="1"/>
                     <field name="move_id"/>
                     <field name="ref"/>
-                    <field name="invoice"/>
-                    <field name="name"/>
-                    <field name="partner_id" on_change="onchange_partner_id(move_id, partner_id, account_id, debit, credit, date, journal_id)"/>
+                    <field name="invoice" invisible="1"/>
+                    <field name="name" invisible="1" />
+                    <field name="partner_id" invisible="1" on_change="onchange_partner_id(move_id, partner_id, account_id, debit, credit, date, journal_id)"/>
                     <field name="account_id" domain="[('journal_id','=',journal_id), ('company_id', '=', company_id)]"/>
                     <field name="journal_id"/>
                     <field name="debit" sum="Total debit"/>
@@ -1542,20 +1541,6 @@
         </record>
 
         <act_window
-            context="{'search_default_next_partner':1,'view_mode':True}"
-            id="action_account_manual_reconcile" name="Journal Items"
-            res_model="account.move.line"
-            view_id="view_move_line_tree"/>
-
-
-        <menuitem
-             name="Manual Reconciliation" icon="STOCK_EXECUTE"
-             action="action_account_manual_reconcile"
-             id="menu_manual_reconcile"
-             parent="account.periodical_processing_reconciliation"/>
-
-
-        <act_window
             id="act_account_acount_move_line_open"
             name="Entries"
             context="{'search_default_account_id':[active_id], 'search_default_unreconciled':0, 'default_account_id': active_id}"
@@ -1958,7 +1943,7 @@
             <field name="model">account.move.line</field>
             <field eval="4" name="priority"/>
             <field name="arch" type="xml">
-                <tree colors="red:state == 'draft';black:state == 'valid'" string="Journal Items">
+                <tree colors="red:state == 'draft';black:state == 'valid'" string="Journal Items" default_selection="get_unreconcile_entry">
                     <field name="date"/>
                     <field name="move_id"/>
                     <field name="statement_id" string="St."/>

=== added directory 'account/static'
=== added directory 'account/static/src'
=== added directory 'account/static/src/css'
=== added file 'account/static/src/css/account_move_reconciliation.css'
--- account/static/src/css/account_move_reconciliation.css	1970-01-01 00:00:00 +0000
+++ account/static/src/css/account_move_reconciliation.css	2012-09-12 12:31:34 +0000
@@ -0,0 +1,99 @@
+
+.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_extended_form_view .oe_form_nosheet {
+  margin: 2px;
+}
+
+.openerp .oe_pager_button {
+  float: left;
+  height: 22px;
+  line-height: 24px;
+  display: inline-block;
+  border: 1px solid #ababab;
+  color: #4c4c4c;
+  cursor: pointer;
+  -moz-border-radius: 5px;
+  -webkit-border-radius: 5px;
+  border-radius: 5px;
+  padding: 0 5px 0 5px;
+  margin: 0 2px 0 2px;
+  float: left;
+}
+.openerp .oe_pager_button:hover{
+  text-decoration:none !important;
+}
+
+.openerp .oe_reconcile_button {
+  float: left;
+  display: inline-block;
+  background-color: #EFEFEF;
+  background-image: -moz-linear-gradient(center top , #EFEFEF, #D8D8D8);
+  border: 1px solid #ABABAB;
+  border-radius: 3px 3px 3px 3px;
+  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset;
+  color: #4C4C4C !important;
+  display: inline-block;
+  font-size: 13px;
+  margin: 0 3px 0 3px;
+  padding: 3px 12px;
+  cursor: pointer;
+  text-align: center;
+  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
+}
+ 
+.openerp .oe_reconcile_button:hover {
+  text-decoration:none !important;
+  background-color: #E3E3E3;
+  background-image: -moz-linear-gradient(center top , #E3E3E3, #F6F6F6);
+  box-shadow: none;
+}
+
+.openerp .oe_reconcile_button a:hover {
+  text-decoration: none
+}
+.openerp .oe_extended_form_view .oe_form_field:empty {
+  display: inline-block !important;
+}
+
+.openerp .oe_extended_form_view .oe_datepicker_root {
+  display: inline-block;
+  min-width: 100px;
+}
+.openerp .oe_extended_form_view .oe_form_field {
+  width: auto;
+}
+ 
+.openerp .oe_extended_form_view  .oe_form_field_progressbar.ui-progressbar {
+  width: 200px !important;
+}
+.openerp .oe_extended_form_view  div.oe_reconcile_row{
+    margin-top:7px; 
+}
+.openerp .oe_list_content > tbody > tr > td > button.reconcile_btn {
+  color: white;
+  background-color: #8a89ba;
+  background-image: -webkit-gradient(linear, left top, left bottom, from(#8a89ba), to(#807fb4));
+  background-image: -webkit-linear-gradient(top, #8a89ba, #807fb4);
+  background-image: -moz-linear-gradient(top, #8a89ba, #807fb4);
+  background-image: -ms-linear-gradient(top, #8a89ba, #807fb4);
+  background-image: -o-linear-gradient(top, #8a89ba, #807fb4);
+  background-image: linear-gradient(to bottom, #8a89ba, #807fb4);
+  padding: 0 5px 0 5px;
+}
+.openerp .oe_list_content > tbody > tr > td > button.reconcile_btn:hover  {
+  color: white;
+  background-color: #807fb4;
+  background-image: -webkit-gradient(linear, left top, left bottom, from(#807fb4), to(#8a89ba));
+  background-image: -webkit-linear-gradient(top, #807fb4, #8a89ba);
+  background-image: -moz-linear-gradient(top, #807fb4, #8a89ba);
+  background-image: -ms-linear-gradient(top, #807fb4, #8a89ba);
+  background-image: -o-linear-gradient(top, #807fb4, #8a89ba);
+  background-image: linear-gradient(to bottom, #807fb4, #8a89ba);
+}
\ No newline at end of file

=== added directory 'account/static/src/img'
=== added directory 'account/static/src/js'
=== added file 'account/static/src/js/account_move_reconciliation.js'
--- account/static/src/js/account_move_reconciliation.js	1970-01-01 00:00:00 +0000
+++ account/static/src/js/account_move_reconciliation.js	2012-09-12 12:31:34 +0000
@@ -0,0 +1,118 @@
+openerp.account = function(instance) {
+var _t = instance.web._t,
+   _lt = instance.web._lt;
+instance.web.views.add('form_clone', 'instance.account.extend_form_view');
+ 
+instance.account.extend_viewmanager = instance.web.ViewManagerAction.include({
+    start : function(){
+        this._super()
+        if(this.action.context && this.action.context.extended_view_id && this.action.context.extended_model)
+            this.setup_exended_form_view(this.action.context.extended_model, this.action.context.extended_view_id);
+    }, 
+    setup_exended_form_view: function(view_model, view_id){
+        var self = this;
+        from_view = this.registry.get_object('form_clone');
+        this.dataset_form = new instance.web.DataSetSearch(this, view_model, this.action.context, this.action.domain);
+        this.dataset_loaded  = this.dataset_form.read_slice();
+        obj_from_view = new from_view(self, self.dataset_form, view_id, options={});
+        obj_from_view.template = 'ExtendedFormView';
+        view_form = obj_from_view.appendTo(self.$el.find('.oe_extended_form_view'));
+        $.when(view_form, this.dataset_loaded).then(function() {
+                obj_from_view.on_pager_action('first');
+        });
+    } 
+    
+})
+instance.account.extend_form_view = instance.web.FormView.extend({
+    on_loaded: function(data) {
+         this._super.apply(this,arguments);
+         var self = this
+         this.$el.find(".oe_reconcile").on('click', this.do_reconcilation)
+         this.$el.find(".oe_nothing_to_reconcile").on('click', this.do_nothing_to_reconcile)
+         this.$el.on('click','a[data-pager-action]',function() {
+            var action = $(this).data('pager-action');
+            self.on_pager_action(action);
+        });
+    },
+    do_reconcilation:function(event){
+        var self = this
+        if (!self.datarecord.id){
+            return false;
+        }
+        var list_view = this.getParent().views['list'].controller
+        ids = list_view.get_selected_ids()
+        if (ids.length == 0) {
+            instance.web.dialog($("<div />").text(_t("You must choose at least one record.")), { title: _t("Warning"), modal: true });
+            return false;
+        }
+        var additional_context = _.extend({
+            active_id: ids[0],
+            active_ids: ids,
+            active_model: list_view.dataset.model
+        });
+        self.rpc("/web/action/load", {
+            action_id: py.eval(event.target.name),
+            context: additional_context
+            }, function(result) {
+                result.result.context = _.extend(result.result.context || {},
+                    additional_context);
+                result.result.flags = result.result.flags || {};
+                result.result.flags.new_window = true;
+                self.do_action(result.result, function () {
+                    self.dataset.read_slice().done(function(){
+                        self.on_pager_action('next');
+                    });
+            });
+        });
+    },
+
+        
+    do_nothing_to_reconcile:function(){
+        var self = this;
+        if (!self.datarecord.id){
+            return false;
+        }
+        this.dataset.call(event.target.name, [[self.datarecord.id], self.dataset.context]).then(function() {
+            self.dataset.read_slice().done(function(){
+                self.on_pager_action('next');
+            });
+        });
+    },
+    
+    do_update_pager: function(hide_index) {
+        var index = this.dataset.index + 1
+        if (this.dataset.ids.length == 0)
+            index = 0;
+        index = hide_index ? '-' : index;
+        this.$el.find('span.oe_pager_index_extend').html(index).end()
+                   .find('span.oe_pager_count_extend').html(this.dataset.ids.length);
+    },
+
+    do_search_move_line: function(partner_ids){
+        var viewmanager = this.getParent();
+        viewmanager.action.context.next_partner_only = true;
+        viewmanager.action.context.partner_id = partner_ids;
+        viewmanager.searchview.do_search();
+    },
+    
+    on_pager_action: function(action) {
+        var self = this
+        
+        if (this.dataset.ids.length == 0){
+            self.datarecord = {}
+            _(this.fields).each(function (field, f) {
+                field.set_value(self.datarecord[f] || false);
+            });
+            self.do_update_pager();
+            self.do_search_move_line([]);
+        }
+        else{        
+            $.when(this._super(action)).then(function() {
+                var id = self.get_fields_values().partner_id;
+                self.do_search_move_line([id]);
+            });
+        }
+    },
+  })
+
+}

=== added directory 'account/static/src/xml'
=== added file 'account/static/src/xml/account_move_reconciliation.xml'
--- account/static/src/xml/account_move_reconciliation.xml	1970-01-01 00:00:00 +0000
+++ account/static/src/xml/account_move_reconciliation.xml	2012-09-12 12:31:34 +0000
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vim:fdl=1:
+-->
+<templates id="template" xml:space="preserve">
+
+    <t t-extend="ViewManagerAction">
+          <t t-jquery=".oe_view_manager_header" t-operation="after">
+          <div class='oe_extended_form_view'></div>
+          </t>
+    </t>
+    <t t-name="ExtendedFormView">
+        <div class="oe_formview">
+            <div class="oe_form_container"/>
+       </div>
+   </t>
+
+</templates>

=== modified file 'account/wizard/account_reconcile.py'
--- account/wizard/account_reconcile.py	2011-11-03 09:56:12 +0000
+++ account/wizard/account_reconcile.py	2012-09-12 12:31:34 +0000
@@ -97,7 +97,7 @@
                     debit_ml_ids.remove(ml_id)
                 if ml_id in credit_ml_ids:
                     credit_ml_ids.remove(ml_id)
-            if not debit_ml_ids and credit_ml_ids:
+            if not debit_ml_ids and not credit_ml_ids:
                 context.update({'stop_reconcile': True})
         account_move_line_obj.reconcile(cr, uid, context['active_ids'], 'manual', account_id,
                                         period_id, journal_id, context=context)

=== modified file 'account/wizard/account_reconcile_view.xml'
--- account/wizard/account_reconcile_view.xml	2012-08-08 10:59:07 +0000
+++ account/wizard/account_reconcile_view.xml	2012-09-12 12:31:34 +0000
@@ -7,18 +7,15 @@
             <field name="model">account.move.line.reconcile</field>
             <field name="arch" type="xml">
                 <form string="Reconciliation" version="7.0">
-                    <group col="4" string="Reconciliation Transactions">
-                        <field name="trans_nbr"/>
-                        <newline/>
+                    <group col="2" string="Reconciliation Transactions">
                         <field name="credit"/>
                         <field name="debit"/>
-                    </group><group string="Write-Off">
                         <field name="writeoff"/>
                     </group>
                     <footer>
-                        <button string="Reconcile" name="trans_rec_reconcile_full" type="object" default_focus="1" attrs="{'invisible':[('writeoff','!=',0)]}" class="oe_highlight"/>
-                        <button string="Reconcile With Write-Off" name="trans_rec_addendum_writeoff" type="object" attrs="{'invisible':[('writeoff','==',0)]}" class="oe_highlight"/>
-                        <button string="Partial Reconcile" name="trans_rec_reconcile_partial_reconcile" type="object" attrs="{'invisible':[('writeoff','==',0)]}" class="oe_highlight"/>
+                        <button string="Reconcile" name="trans_rec_reconcile_full" type="object"   default_focus="1" attrs="{'invisible':[('writeoff','!=',0)]}" class="oe_highlight"/>
+                        <button string="Reconcile With Write-Off" name="trans_rec_addendum_writeoff"    type="object" attrs="{'invisible':[('writeoff','==',0)]}" class="oe_highlight"/>
+                        <button string="Partial Reconcile" name="trans_rec_reconcile_partial_reconcile"    type="object" attrs="{'invisible':[('writeoff','==',0)]}" class="oe_highlight"/>
                         or
                         <button string="Cancel" class="oe_link" special="cancel"/>
                     </footer>

=== modified file 'account_followup/__init__.py'
--- account_followup/__init__.py	2011-01-14 00:11:01 +0000
+++ account_followup/__init__.py	2012-09-12 12:31:34 +0000
@@ -22,5 +22,6 @@
 import account_followup
 import wizard
 import report
+import account_move_reconciliation
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file

=== modified file 'account_followup/__openerp__.py'
--- account_followup/__openerp__.py	2012-08-22 07:14:45 +0000
+++ account_followup/__openerp__.py	2012-09-12 12:31:34 +0000
@@ -55,6 +55,7 @@
         'report/account_followup_report.xml',
         'account_followup_demo.xml',   # Defined by default
         'account_followup_view.xml',
+        'account_move_reconciliation.xml',
         'account_followup_data.xml',
     ],
     'demo': [],

=== modified file 'account_followup/account_followup.py'
--- account_followup/account_followup.py	2012-06-27 06:28:21 +0000
+++ account_followup/account_followup.py	2012-09-12 12:31:34 +0000
@@ -20,6 +20,7 @@
 ##############################################################################
 
 from osv import fields, osv
+import tools
 
 class followup(osv.osv):
     _name = 'account_followup.followup'

=== added file 'account_followup/account_move_reconciliation.py'
--- account_followup/account_move_reconciliation.py	1970-01-01 00:00:00 +0000
+++ account_followup/account_move_reconciliation.py	2012-09-12 12:31:34 +0000
@@ -0,0 +1,61 @@
+# -*- 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/>.
+#
+##############################################################################
+from osv import fields, osv
+import tools
+
+class account_move_reconciliation(osv.osv):
+    _inherit = 'account.move.reconciliation'
+
+    def _get_followup(self, cr, uid, ids, field_name, arg, context=None):
+        result = {}
+        move_obj = self.pool.get("account.move.line")
+        for rec in self.browse(cr, uid, ids, context=context):
+            move_line_ids = move_obj.search(cr, uid, [('partner_id','=',rec.partner_id.id),('followup_date','=',rec.followup_date)], context=context)
+            move_line = move_line_ids and move_obj.browse(cr, uid, move_line_ids[0], context=context) or False
+            result[rec.id] = move_line and move_line.followup_line_id.id or False
+        return result
+
+    _columns = {
+                'followup_date': fields.date('Latest Follow-up'),
+                'followup_id':fields.function(_get_followup, type='many2one', relation='account_followup.followup.line', string='Max Follow Up Level')
+    }
+    
+    def init(self, cr):
+        tools.drop_view_if_exists(cr, 'account_move_reconciliation')
+        cr.execute("""
+            CREATE or REPLACE VIEW account_move_reconciliation as (
+                SELECT move_line.partner_id AS id, a.type AS type, move_line.partner_id AS partner_id, 
+                    SUM(move_line.debit) AS debit, 
+                    SUM(move_line.credit) AS credit, 
+                    MAX(move_line.date) AS latest_date,
+                    MIN(partner.last_reconciliation_date) AS last_reconciliation_date,
+                    MAX(move_line.followup_date) as followup_date
+                FROM account_move_line move_line
+                LEFT JOIN account_account a ON (a.id = move_line.account_id)
+                LEFT JOIN res_partner partner ON (move_line.partner_id = partner.id)
+                WHERE a.reconcile IS TRUE
+                    AND move_line.reconcile_id IS NULL
+                    AND (partner.last_reconciliation_date IS NULL OR move_line.date > partner.last_reconciliation_date)
+                    AND move_line.state <> 'draft'
+                GROUP BY move_line.partner_id, a.type
+           )
+        """)
+account_move_reconciliation()

=== added file 'account_followup/account_move_reconciliation.xml'
--- account_followup/account_move_reconciliation.xml	1970-01-01 00:00:00 +0000
+++ account_followup/account_move_reconciliation.xml	2012-09-12 12:31:34 +0000
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+        <record id="view_move_reconciliation_followup_form" model="ir.ui.view">
+            <field name="name">account.move.reconciliation.followup</field>
+            <field name="model">account.move.reconciliation</field>
+            <field name="inherit_id" ref="account.view_account_move_reconciliation_form_view"/>
+            <field name="arch" type="xml">
+            	 <xpath expr="//div[@name='grp_followup']" position="inside">
+                    <label for="followup_date"/>
+                    <field name="followup_date"/>
+                    <field name="followup_id"/>
+                 </xpath>
+            </field>
+        </record>
+    </data>
+</openerp>

=== modified file 'account_voucher/account_voucher.py'
--- account_voucher/account_voucher.py	2012-08-21 15:09:36 +0000
+++ account_voucher/account_voucher.py	2012-09-12 12:31:34 +0000
@@ -334,9 +334,15 @@
     }
 
     def create(self, cr, uid, vals, context=None):
-        voucher =  super(account_voucher, self).create(cr, uid, vals, context=context)
-        self.create_send_note(cr, uid, [voucher], context=context)
-        return voucher
+        if context is None:
+            context = {}
+        bank_line_id = context.get('bank_statement_line_id', False)
+        bank_line_obj = self.pool.get("account.bank.statement.line")
+        voucher_id =  super(account_voucher, self).create(cr, uid, vals, context=context)
+        if bank_line_id:
+            bank_line_obj.write(cr, uid, bank_line_id, {'voucher_id': voucher_id})
+        self.create_send_note(cr, uid, [voucher_id], context=context)
+        return voucher_id
 
     def compute_tax(self, cr, uid, ids, context=None):
         tax_pool = self.pool.get('account.tax')
@@ -1494,7 +1500,37 @@
 
 class account_bank_statement_line(osv.osv):
     _inherit = 'account.bank.statement.line'
-
+   
+    def action_payment_reconcile(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
+        ctx = dict(context)
+        statement_id = ids[0]
+        statement = self.browse(cr, uid, statement_id, context=context)
+        ctx['bank_statement_line_id'] = statement.id
+        ctx.update({
+            'line_type': statement.type, 
+            'type': statement.amount > 0 and 'payment' or 'receipt', 
+            'partner_id': statement.partner_id and statement.partner_id.id or False, 
+            'journal_id': statement.statement_id.journal_id and statement.statement_id.journal_id.id or False, 
+            'amount': abs(statement.amount), 
+            'reference': statement.ref, 
+            'date': statement.date, 
+            'name': statement.name
+        })
+        voucher = statement.voucher_id or False
+        voucher_id = voucher and voucher.id or False
+        return {
+           'name': _('Payment Entry'),
+           'res_model': 'account.voucher',
+           'view_type': 'form',
+           'view_mode': 'form',
+           'target':'new',
+           'context': ctx,
+           'res_id':voucher_id,
+           'type': 'ir.actions.act_window'
+        }
+       
     def _amount_reconciled(self, cursor, user, ids, name, args, context=None):
         if not ids:
             return {}
@@ -1519,6 +1555,11 @@
     ]
 
     _columns = {
+        'voucher_state': fields.related('voucher_id', 'state', type="selection", selection= [('draft','Draft'),
+             ('cancel','Cancelled'),
+             ('proforma','Pro-forma'),
+             ('posted','Posted')
+            ], string='Voucher State'),
         'amount_reconciled': fields.function(_amount_reconciled,
             string='Amount reconciled', type='float'),
         'voucher_id': fields.many2one('account.voucher', 'Payment'),

=== modified file 'account_voucher/account_voucher_view.xml'
--- account_voucher/account_voucher_view.xml	2012-09-10 20:14:08 +0000
+++ account_voucher/account_voucher_view.xml	2012-09-12 12:31:34 +0000
@@ -213,7 +213,8 @@
             <field name="inherit_id" ref="account.view_bank_statement_form"/>
             <field name="arch" type="xml">
                 <xpath expr="//page[@name='statement_line_ids']/field[@name='line_ids']/tree/field[@name='amount']" position="after">
-                    <field name="voucher_id" context="{'line_type': type, 'default_type': amount &lt; 0 and 'payment' or 'receipt', 'type': amount &lt; 0 and 'payment' or 'receipt', 'default_partner_id': partner_id, 'default_journal_id': parent.journal_id, 'default_amount': abs(amount), 'default_reference': ref, 'default_date': date, 'default_name': name}"/>
+                    <button class="reconcile_btn" attrs="{'readonly':[('voucher_state','=','posted')]}" name="action_payment_reconcile" string="Reconcile" type="object"/>
+                     <field name="voucher_state" invisible="1"/>
                 </xpath>
             </field>
         </record>

=== modified file 'account_voucher/voucher_payment_receipt_view.xml'
--- account_voucher/voucher_payment_receipt_view.xml	2012-09-10 20:14:08 +0000
+++ account_voucher/voucher_payment_receipt_view.xml	2012-09-12 12:31:34 +0000
@@ -53,7 +53,9 @@
             <field name="arch" type="xml">
                 <form string="Bill Payment" version="7.0">
                     <group col="6">
-                        <field name="partner_id" required="1" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date, context)" string="Supplier" context="{'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1, 'invoice_currency': currency_id}"/>
+                        <field name="company_id" invisible="1" />
+                        <field name="state" invisible="1" />
+                        <field name="partner_id" required="1" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date, context)" string="Supplier" context="{'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1, 'invoice_currency': currency_id}" />
                         <field name="amount" on_change="onchange_amount(amount, payment_rate, partner_id, journal_id, currency_id, type, date, payment_rate_currency_id, company_id, context)"/>
                         <field name="journal_id"
                             domain="[('type','in',['bank', 'cash'])]"

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to