summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Ledoux dle@openerp.com <>2012-11-05 09:41:52 +0100
committerDenis Ledoux dle@openerp.com <>2012-11-05 09:41:52 +0100
commit9e56b3b6a8a761e02099146b338225d29dbc8c8a (patch)
tree295d0a6092852f4ae1b94a77bbb648fb80c50751
parent848cb19302613bfdf332721eb4346ffbad23381e (diff)
[ADD]QuickAdd Move Line View
bzr revid: dle@openerp.com-20121105084152-35bvurqkvuv4k0ow
-rw-r--r--addons/account/__openerp__.py2
-rw-r--r--addons/account/account_move_line.py8
-rw-r--r--addons/account/account_view.xml40
-rw-r--r--addons/account/static/src/js/account_move_reconciliation.js61
4 files changed, 111 insertions, 0 deletions
diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py
index c538614fd0f..39feb2cd546 100644
--- a/addons/account/__openerp__.py
+++ b/addons/account/__openerp__.py
@@ -128,9 +128,11 @@ for a particular financial year and for preparation of vouchers there is a modul
],
'js': [
'static/src/js/account_move_reconciliation.js',
+
],
'qweb' : [
"static/src/xml/account_move_reconciliation.xml",
+ "static/src/xml/account_move_line_quickadd.xml",
],
'css':['static/src/css/account_move_reconciliation.css'
],
diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py
index 67a55d8f451..373f8e89c29 100644
--- a/addons/account/account_move_line.py
+++ b/addons/account/account_move_line.py
@@ -1383,6 +1383,14 @@ class account_move_line(osv.osv):
move_obj.button_validate(cr,uid, [vals['move_id']], context)
return result
+ def list_periods(self, cr, uid, context=None):
+ ids = self.pool.get('account.period').search(cr,uid,[])
+ return self.pool.get('account.period').name_get(cr, uid, ids, context=context)
+
+ def list_journals(self, cr, uid, context=None):
+ ids = self.pool.get('account.journal').search(cr,uid,[])
+ return self.pool.get('account.journal').name_get(cr, uid, ids, context=context)
+
account_move_line()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 63d7e891437..a639228aeea 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -1055,6 +1055,30 @@
</field>
</record>
+ <record id="view_move_line_quickadd_tree" model="ir.ui.view">
+ <field name="model">account.move.line</field>
+ <field eval="24" name="priority"/>
+ <field name="arch" type="xml">
+ <tree_account_move_line_quickadd colors="red:state == 'draft';black:state == 'valid'" string="Journal Items to Reconcile" create="false" version="7.0">
+ <field name="date"/>
+ <field name="move_id"/>
+ <field name="ref"/>
+ <field name="invoice"/>
+ <field name="name"/>
+ <field name="partner_id"/>
+ <field name="account_id"/>
+ <field name="reconcile_partial_id"/>
+ <field name="debit" sum="Total debit"/>
+ <field name="credit" sum="Total credit"/>
+ <field name="account_tax_id"/>
+ <field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('parent_id','!=',False)]"/>
+ <field name="state" invisible="1"/>
+ <field name="amount_currency" attrs="{'readonly':[('state','=','valid')]}"/>
+ <field name="currency_id" attrs="{'readonly':[('state','=','valid')]}" groups="base.group_multi_currency"/>
+ </tree_account_move_line_quickadd>
+ </field>
+ </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>
@@ -1549,6 +1573,22 @@
</p>
</field>
</record>
+
+ <record id="action_account_manual_account_move_line_quickadd" model="ir.actions.act_window">
+ <field name="context">{'search_default_unreconciled': 1,'view_mode':True}</field>
+ <field name="name">Quick Journal Items</field>
+ <field name="res_model">account.move.line</field>
+ <field name="view_id" ref="view_move_line_quickadd_tree"/>
+ <field name="view_mode">tree_account_move_line_quickadd</field>
+ </record>
+
+ <menuitem
+ name="Quick Journal Items"
+ action="action_account_manual_account_move_line_quickadd"
+ id="menu_manual_account_move_line_quickadd"
+ sequence="20"
+ parent="account.menu_finance_bank_and_cash"/>
+
<menuitem
name="Journal Items to Reconcile"
action="action_account_manual_reconcile"
diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js
index 8e72e24eb22..c0d97fc554b 100644
--- a/addons/account/static/src/js/account_move_reconciliation.js
+++ b/addons/account/static/src/js/account_move_reconciliation.js
@@ -126,4 +126,65 @@ openerp.account = function (instance) {
},
});
+ instance.web.views.add('tree_account_move_line_quickadd', 'instance.web.account.QuickAddListView');
+ instance.web.account.QuickAddListView = instance.web.ListView.extend({
+ init: function() {
+ this._super.apply(this, arguments);
+ var self = this;
+ this.current_journal = null;
+ this.current_period = null;
+ },
+ load_list: function() {
+ var self = this;
+ var tmp = this._super.apply(this, arguments);
+ if (this.journals) {
+ this.$el.prepend(QWeb.render("AccountMoveLineQuickAdd", {widget: this}));
+ }
+ return tmp;
+ },
+ do_search: function(domain, context, group_by) {
+ var self = this;
+ this.last_domain = domain;
+ this.last_context = context;
+ this.last_group_by = group_by;
+ this.old_search = _.bind(this._super, this);
+ var mod = new instance.web.Model("account.move.line", context, domain);
+ return mod.call("list_journals", []).pipe(function(result) {
+ var current = self.current_journal !== null ? self.journals[self.current_journal][0] : null;
+ self.journals = result;
+ var index = _.find(_.range(self.journals.length), function(el) {
+ if (current === self.journals[el][0])
+ return true;
+ });
+ if (index !== undefined)
+ self.current_journal = index;
+ else
+ self.current_journal = self.journals.length == 0 ? null : 0;
+ self.search_by_journal();
+ });
+ },
+ search_by_journal: function() {
+ var self = this;
+ var fct = function() {
+ return self.old_search(new instance.web.CompoundDomain(self.last_domain,
+ [["journal_id", "in", self.current_journal === null ? [] :
+ [self.journals[self.current_journal][0]] ]]), self.last_context, self.last_group_by);
+ };
+ return fct();
+ },
+ search_by_period: function() {
+ var self = this;
+ var fct = function() {
+ return self.old_search(new instance.web.CompoundDomain(self.last_domain,
+ [["period_id", "in", self.current_period === null ? [] :
+ [self.periods[self.current_period][0]] ]]), self.last_context, self.last_group_by);
+ };
+ return fct();
+ },
+ do_select: function (ids, records) {
+ this.trigger('record_selected')
+ this._super.apply(this, arguments);
+ },
+ });
+
};