From 9e56b3b6a8a761e02099146b338225d29dbc8c8a Mon Sep 17 00:00:00 2001 From: "Denis Ledoux dle@openerp.com" <> Date: Mon, 5 Nov 2012 09:41:52 +0100 Subject: [PATCH 01/18] [ADD]QuickAdd Move Line View bzr revid: dle@openerp.com-20121105084152-35bvurqkvuv4k0ow --- addons/account/__openerp__.py | 2 + addons/account/account_move_line.py | 8 +++ addons/account/account_view.xml | 40 ++++++++++++ .../src/js/account_move_reconciliation.js | 61 +++++++++++++++++++ 4 files changed, 111 insertions(+) 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 @@ + + account.move.line + + + + + + + + + + + + + + + + + + + + + + account.move.line.tree account.move.line @@ -1549,6 +1573,22 @@

+ + + {'search_default_unreconciled': 1,'view_mode':True} + Quick Journal Items + account.move.line + + tree_account_move_line_quickadd + + + + Date: Fri, 9 Nov 2012 13:34:23 +0100 Subject: [PATCH 02/18] [ADD]Changes of context bzr revid: dle@openerp.com-20121109123423-3tkugord76afa2r9 --- addons/account/__openerp__.py | 1 + addons/account/account_view.xml | 4 +- .../src/js/account_move_reconciliation.js | 65 ------------------- 3 files changed, 3 insertions(+), 67 deletions(-) diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py index 39feb2cd546..2641367edb3 100644 --- a/addons/account/__openerp__.py +++ b/addons/account/__openerp__.py @@ -128,6 +128,7 @@ for a particular financial year and for preparation of vouchers there is a modul ], 'js': [ 'static/src/js/account_move_reconciliation.js', + 'static/src/js/account_move_line_quickadd.js', ], 'qweb' : [ diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 6dbab2cd5e9..73980aecbd9 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -1059,9 +1059,9 @@ account.move.line - + - + diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js index d1ad07b8a5f..eed56632808 100644 --- a/addons/account/static/src/js/account_move_reconciliation.js +++ b/addons/account/static/src/js/account_move_reconciliation.js @@ -125,69 +125,4 @@ openerp.account = function (instance) { this._super.apply(this, arguments); }, }); - - instance.web.views.add('tree_account_move_line_quickadd', 'instance.web.account.QuickAddListView'); - instance.web.account.QuickAddListView = instance.web.ListView.extend({ - init: function() { - var self = this; - this._super.apply(this, arguments); - this.journals = []; - this.periods = []; - this.current_journal = null; - this.current_period = null; - }, - load_list: function() { - var self = this; - var tmp = this._super.apply(this, arguments); - - this.$el.prepend(QWeb.render("AccountMoveLineQuickAdd", {widget: this})); - - this.$("#oe_account_select_journal").change(function() { - self.current_journal = parseInt(this.value); - self.do_search(self.last_domain, self.last_context, self.last_group_by); - }); - this.$("#oe_account_select_period").change(function() { - self.current_period = parseInt(this.value); - self.do_search(self.last_domain, self.last_context, self.last_group_by); - }); - - 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); - var getarray = []; - getarray.push(mod.call("list_journals", []).pipe(function(result) { - self.journals = result; - })); - getarray.push(mod.call("list_periods", []).pipe(function(result) { - self.periods = result; - })); - $.when.apply($, getarray).done(function () { - self.search_by_journal_period(); - }); - }, - search_by_journal_period: function() { - var self = this; - var fct = function() { - compoundDomain = new instance.web.CompoundDomain(self.last_domain, - [ - ["journal_id", "=", self.current_journal === null ? self.journals[0][0] : self.current_journal], - ["period_id", "=", self.current_period === null ? self.journals[0][0] :self.current_period] - ]); - return self.old_search(compoundDomain, self.last_context, self.last_group_by); - }; - return fct(); - }, - - do_select: function (ids, records) { - this.trigger('record_selected') - this._super.apply(this, arguments); - }, - }); - }; From 3f034c27a43ef6cd2560dcf2790494bda99e58d4 Mon Sep 17 00:00:00 2001 From: "Denis Ledoux dle@openerp.com" <> Date: Fri, 9 Nov 2012 13:38:08 +0100 Subject: [PATCH 03/18] [ADD]Missing files bzr revid: dle@openerp.com-20121109123808-9a6n4mn5dh6vidkb --- .../src/js/account_move_line_quickadd.js | 81 +++++++++++++++++++ .../src/xml/account_move_line_quickadd.xml | 34 ++++++++ 2 files changed, 115 insertions(+) create mode 100644 addons/account/static/src/js/account_move_line_quickadd.js create mode 100644 addons/account/static/src/xml/account_move_line_quickadd.xml diff --git a/addons/account/static/src/js/account_move_line_quickadd.js b/addons/account/static/src/js/account_move_line_quickadd.js new file mode 100644 index 00000000000..91a725fce82 --- /dev/null +++ b/addons/account/static/src/js/account_move_line_quickadd.js @@ -0,0 +1,81 @@ +openerp.account = function (instance) { + var _t = instance.web._t, + _lt = instance.web._lt; + var QWeb = instance.web.qweb; + + instance.web.account = {}; + + instance.web.views.add('tree_account_move_line_quickadd', 'instance.web.account.QuickAddListView'); + instance.web.account.QuickAddListView = instance.web.ListView.extend({ + _template: 'ListView', + + init: function() { + var self = this; + this._super.apply(this, arguments); + this.journals = []; + this.periods = []; + this.current_journal = null; + this.current_period = null; + }, + load_list: function() { + var self = this; + var tmp = this._super.apply(this, arguments); + + this.$el.prepend(QWeb.render("AccountMoveLineQuickAdd", {widget: this})); + + this.$("#oe_account_select_journal").change(function() { + self.current_journal = parseInt(this.value); + self.do_search(self.last_domain, self.last_context, self.last_group_by); + }); + this.$("#oe_account_select_period").change(function() { + self.current_period = parseInt(this.value); + self.do_search(self.last_domain, self.last_context, self.last_group_by); + }); + 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); + var getarray = []; + getarray.push(mod.call("list_journals", []).then(function(result) { + self.journals = result; + })); + getarray.push(mod.call("list_periods", []).then(function(result) { + self.periods = result; + })); + $.when.apply($, getarray).done(function () { + self.current_journal = self.current_journal === null ? self.journals[0][0] : self.current_journal; + self.current_period = self.current_period === null ? self.periods[0][0] :self.current_period; + var tmp = self.search_by_journal_period(); + }); + }, + search_by_journal_period: function() { + var self = this; + + compoundDomain = new instance.web.CompoundDomain(self.last_domain, + [ + ["journal_id", "=", self.current_journal], + ["period_id", "=", self.current_period] + ]); + self.last_context["journal_id"] = self.current_journal; + self.last_context["period_id"] = self.current_period; + return self.old_search(compoundDomain, self.last_context, self.last_group_by); + }, + _next: function (next_record, options) { + next_record = next_record || 'succ'; + var self = this; + return this.save_edition().then(function (saveInfo) { + if (saveInfo.created || self.records.at(self.records.length-1).get("id") === saveInfo.record.get("id")) { + return self.start_edition(); + } + var record = self.records[next_record]( + saveInfo.record, {wraparound: true}); + return self.start_edition(record, options); + }); + }, + }); +}; diff --git a/addons/account/static/src/xml/account_move_line_quickadd.xml b/addons/account/static/src/xml/account_move_line_quickadd.xml new file mode 100644 index 00000000000..e43c3b4e76a --- /dev/null +++ b/addons/account/static/src/xml/account_move_line_quickadd.xml @@ -0,0 +1,34 @@ + + + + + + + + + From 4c7f0a9e060d2c14e3d448472163b4412941dc50 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Fri, 9 Nov 2012 13:56:18 +0100 Subject: [PATCH 04/18] Small corrections bzr revid: nicolas.vanhoren@openerp.com-20121109125618-kdj4w7dv88dmepi1 --- .../static/src/js/account_move_line_quickadd.js | 12 +++++------- .../static/src/xml/account_move_line_quickadd.xml | 4 ++-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/addons/account/static/src/js/account_move_line_quickadd.js b/addons/account/static/src/js/account_move_line_quickadd.js index 91a725fce82..cee3142d436 100644 --- a/addons/account/static/src/js/account_move_line_quickadd.js +++ b/addons/account/static/src/js/account_move_line_quickadd.js @@ -40,17 +40,15 @@ openerp.account = function (instance) { this.last_group_by = group_by; this.old_search = _.bind(this._super, this); var mod = new instance.web.Model("account.move.line", context, domain); - var getarray = []; - getarray.push(mod.call("list_journals", []).then(function(result) { + return new instance.web.Model("account.move.line", context, domain); + $.when(mod.call("list_journals", []).then(function(result) { self.journals = result; - })); - getarray.push(mod.call("list_periods", []).then(function(result) { + }),mod.call("list_periods", []).then(function(result) { self.periods = result; - })); - $.when.apply($, getarray).done(function () { + })).then(function () { self.current_journal = self.current_journal === null ? self.journals[0][0] : self.current_journal; self.current_period = self.current_period === null ? self.periods[0][0] :self.current_period; - var tmp = self.search_by_journal_period(); + return self.search_by_journal_period(); }); }, search_by_journal_period: function() { diff --git a/addons/account/static/src/xml/account_move_line_quickadd.xml b/addons/account/static/src/xml/account_move_line_quickadd.xml index e43c3b4e76a..8023ff42210 100644 --- a/addons/account/static/src/xml/account_move_line_quickadd.xml +++ b/addons/account/static/src/xml/account_move_line_quickadd.xml @@ -8,7 +8,7 @@ Journal : -