[IMP] click on nothing to reconcile button skip current parnter

bzr revid: rgaopenerp-20120706093039-842mld92j582sals
This commit is contained in:
RGA(OpenERP)
2012-07-06 15:00:39 +05:30
parent 82362ebf05
commit 092a646c66
3 changed files with 55 additions and 20 deletions
+26 -14
View File
@@ -44,34 +44,46 @@ class account_move_partner_info(osv.osv):
res_all[id] = res
return res_all
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
ids = super(account_move_partner_info, self).search(cr, uid, args, offset, limit, order, context, count)
res = []
for l in self.browse(cr, uid, ids, context=context):
if (not l.partner_move_count) or (l.move_lines_count >l.partner_move_count):
res.append(l.id)
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')
'reconciliation_progress': fields.function(_rec_progress, string='Progress (%)', type='float'),
'move_lines_count':fields.integer('Move Count'),
'partner_move_count':fields.integer('Partner move line count'),
}
def skip_partner(self, cr, uid, ids, context):
res_partner = self.pool.get('res.partner')
for line in self.browse(cr, uid, ids, context=context):
res_partner.write(cr, uid, [line.id] ,{'partner_move_count':line.move_lines_count})
def init(self, cr):
tools.drop_view_if_exists(cr, 'account_move_partner_info')
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.date) as latest_date,
count(l.id) as move_lines_count,
max(p.partner_move_count) as partner_move_count
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
class res_partner(osv.osv):
_inherit = 'res.partner'
_columns = {
'partner_move_count': fields.integer('Partner move line count')
}
res_partner()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -19,7 +19,7 @@
</div>
<div class="oe_button_container">
<button string="Reconcile" name="%(action_view_account_move_line_reconcile)d" widget="list_button" type="action"/>
<button string="Nothing to Reconcile" name="%(action_account_unreconcile)d" widget="list_button" type="action"/>
<button string="Nothing to Reconcile" name="skip_partner" widget="btn_extend" type="object"/>
<field name="reconciliation_progress" widget="progressbar"/>
</div>
</form>
+28 -5
View File
@@ -3,6 +3,7 @@ var _t = instance.web._t,
_lt = instance.web._lt;
instance.web.views.add('form_clone', 'instance.account.extend_form_view');
instance.web.form.tags.add('list_button','instance.account.list_button')
instance.web.form.tags.add('btn_extend','instance.account.btn_extend')
instance.web.form.widgets.add('many2one_pager','instance.account.many2one_pager')
instance.account.extend_actionmanager = instance.web.ActionManager.include({
ir_actions_act_window: function (action, on_close) {
@@ -53,7 +54,7 @@ instance.account.extend_viewmanager = instance.web.ViewManagerAction.extend({
},
start : function(){
this._super()
this.setup_exended_list_view(this)
this.setup_exended_form_view(this)
},
on_mode_switch: function (view_type, no_store, options) {
self = this
@@ -61,7 +62,7 @@ instance.account.extend_viewmanager = instance.web.ViewManagerAction.extend({
self.list_view = self.views['list']
})
},
setup_exended_list_view: function(parent){
setup_exended_form_view: function(parent){
var self = this,
from_view,
obj_from_view;
@@ -106,8 +107,8 @@ instance.account.extend_form_view = instance.web.FormView.extend({
viewmanager.action.domain = (viewmanager.action.domain || []).concat([["partner_id", "=", id]])
viewmanager.searchview.do_search()
})
}
})
},
})
instance.account.many2one_pager = instance.web.form.FieldMany2One.extend({
template: "FieldMany2One_Pager",
display_string: function(str) {
@@ -132,7 +133,30 @@ instance.account.many2one_pager = instance.web.form.FieldMany2One.extend({
}
},
})
instance.account.btn_extend = instance.web.form.WidgetButton.extend({
on_confirmed: function() {
var self = this;
var context = this.node.attrs.context;
if (context && context.__ref) {
context = new instance.web.CompoundContext(context);
context.set_eval_context(this._build_eval_context());
}
return this.view.do_execute_action(
_.extend({}, this.node.attrs, {context: context}),
this.view.dataset, this.view.datarecord.id, function () {
$.when(self.view.dataset.read_slice()).then(function() {
if (!_.isEmpty(self.view.dataset.ids)){
self.view.reload();
//reload list view
self.view.on_pager_action()
}
})
});
},
})
instance.account.list_button = instance.web.form.WidgetButton.extend({
on_click: function() {
@@ -162,7 +186,6 @@ instance.account.list_button = instance.web.form.WidgetButton.extend({
self.getParent().reload()
});
});
}
})