From f9c2437959fba731b808208e184d86f51f2db600 Mon Sep 17 00:00:00 2001 From: "Amit (OpenERP)" Date: Fri, 18 May 2012 16:05:41 +0530 Subject: [PATCH 001/195] [FIX] account : Add access rules for entry analysis report lp bug: https://launchpad.net/bugs/999506 fixed bzr revid: amp@tinyerp.com-20120518103541-vfp9bh4p9dqwbr18 --- addons/account/security/account_security.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/account/security/account_security.xml b/addons/account/security/account_security.xml index e1a29a6edfb..997918650a5 100644 --- a/addons/account/security/account_security.xml +++ b/addons/account/security/account_security.xml @@ -107,6 +107,13 @@ ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] + + Entries Analysis multi-company + + + ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] + + Account fiscal Mapping company rule From cf8581e99cdd711e48083f2c8806a8a548b4198a Mon Sep 17 00:00:00 2001 From: "RGA(OpenERP)" <> Date: Mon, 11 Jun 2012 12:50:42 +0530 Subject: [PATCH 002/195] [ADD] directory structure for web addons bzr revid: rgaopenerp-20120611072042-r5lj4z6p3tqsonx8 --- addons/account/__openerp__.py | 6 ++++++ addons/account/static/src/js/account.js | 1 + addons/account/static/src/xml/account.xml | 11 +++++++++++ 3 files changed, 18 insertions(+) create mode 100644 addons/account/static/src/js/account.js create mode 100644 addons/account/static/src/xml/account.xml diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py index cd19c730a3f..6657ab7c7b5 100644 --- a/addons/account/__openerp__.py +++ b/addons/account/__openerp__.py @@ -128,6 +128,12 @@ module named account_voucher. "res_config_view.xml", "account_pre_install.yml" ], + 'js': [ + 'static/src/js/account.js', + ], + 'qweb' : [ + "static/src/xml/*", + ], 'demo_xml': [ 'demo/account_demo.xml', 'project/project_demo.xml', diff --git a/addons/account/static/src/js/account.js b/addons/account/static/src/js/account.js new file mode 100644 index 00000000000..a6f266b54e1 --- /dev/null +++ b/addons/account/static/src/js/account.js @@ -0,0 +1 @@ +console.log('loading account.....') diff --git a/addons/account/static/src/xml/account.xml b/addons/account/static/src/xml/account.xml new file mode 100644 index 00000000000..2e7dbc48ff6 --- /dev/null +++ b/addons/account/static/src/xml/account.xml @@ -0,0 +1,11 @@ + + + + + + + + + + From 2b229fa7aa43f01d957c56bc60f48a6ec8cbdc57 Mon Sep 17 00:00:00 2001 From: "RGA(OpenERP)" <> Date: Mon, 11 Jun 2012 14:56:19 +0530 Subject: [PATCH 003/195] [IMP] Extend ViewManagerAction to add fromview bzr revid: rgaopenerp-20120611092619-6l8h7atm43fimeg6 --- addons/account/static/src/xml/account.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/account/static/src/xml/account.xml b/addons/account/static/src/xml/account.xml index 2e7dbc48ff6..082e875239f 100644 --- a/addons/account/static/src/xml/account.xml +++ b/addons/account/static/src/xml/account.xml @@ -3,8 +3,9 @@ --> - - + + +
From 8b2beb7975a8fae12423a88e90dc62323daa8cfe Mon Sep 17 00:00:00 2001 From: "RGA(OpenERP)" <> Date: Mon, 11 Jun 2012 15:14:44 +0530 Subject: [PATCH 004/195] [FIX] typo bzr revid: rgaopenerp-20120611094444-vhr01bggrza11hhe --- addons/account/static/src/xml/account.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/static/src/xml/account.xml b/addons/account/static/src/xml/account.xml index 082e875239f..388cd96f49b 100644 --- a/addons/account/static/src/xml/account.xml +++ b/addons/account/static/src/xml/account.xml @@ -5,7 +5,7 @@ -
+
test
From fb41245f7843bdedfea2e621698927b83c079c6b Mon Sep 17 00:00:00 2001 From: "RGA(OpenERP)" <> Date: Tue, 12 Jun 2012 12:49:58 +0530 Subject: [PATCH 005/195] [IMP] added form view at header on list view bzr revid: rgaopenerp-20120612071958-2wlk6b4gek0xjc8v --- addons/account/account_view.xml | 36 ++++++++++++++++++----- addons/account/static/src/js/account.js | 20 ++++++++++++- addons/account/static/src/xml/account.xml | 9 ++++-- 3 files changed, 54 insertions(+), 11 deletions(-) diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 274a8993dc4..0a29167fa7a 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -1139,6 +1139,22 @@
+ + + account.move.line.form + account.move.line + form + + +
+ + + +
+ + + + +
+ + + From 7ab3d9962170b7f85076b8ebf4f40a5390d4215f Mon Sep 17 00:00:00 2001 From: "RGA(OpenERP)" <> Date: Fri, 22 Jun 2012 14:47:17 +0530 Subject: [PATCH 013/195] [IMP] wizard view bzr revid: rgaopenerp-20120622091717-ryzukodk5n2irhe2 --- addons/account/account_view.xml | 2 +- addons/account/wizard/account_reconcile_view.xml | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index b02f3d211fb..8c754533024 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -982,7 +982,7 @@

- +

diff --git a/addons/account/wizard/account_reconcile_view.xml b/addons/account/wizard/account_reconcile_view.xml index 959c4ceddcf..2a8494e5923 100644 --- a/addons/account/wizard/account_reconcile_view.xml +++ b/addons/account/wizard/account_reconcile_view.xml @@ -9,17 +9,13 @@
-
- - - + - From 4647ff5b8fc155b06af19c95b468bc2ca5be52f3 Mon Sep 17 00:00:00 2001 From: "RGA(OpenERP)" <> Date: Wed, 27 Jun 2012 18:35:29 +0530 Subject: [PATCH 014/195] [IMP] create sql view(model) to fecth appropriate data from various tables, improve view as per mock-up specification bzr revid: rgaopenerp-20120627130529-5jonfjm2fkoh61vu --- addons/account/__init__.py | 1 + addons/account/__openerp__.py | 1 + addons/account/account_move_line_extended.py | 69 +++++++++++++++++++ addons/account/account_move_line_extended.xml | 31 +++++++++ addons/account/account_view.xml | 5 +- addons/account/static/src/css/account.css | 38 ++++++++++ addons/account/static/src/js/account.js | 5 +- addons/account/static/src/xml/account.xml | 13 +++- 8 files changed, 155 insertions(+), 8 deletions(-) create mode 100644 addons/account/account_move_line_extended.py create mode 100644 addons/account/account_move_line_extended.xml create mode 100644 addons/account/static/src/css/account.css diff --git a/addons/account/__init__.py b/addons/account/__init__.py index 90fbdb83980..3a2273379da 100644 --- a/addons/account/__init__.py +++ b/addons/account/__init__.py @@ -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: diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py index aecc326f39c..59abf719a3c 100644 --- a/addons/account/__openerp__.py +++ b/addons/account/__openerp__.py @@ -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', diff --git a/addons/account/account_move_line_extended.py b/addons/account/account_move_line_extended.py new file mode 100644 index 00000000000..b04d86284b6 --- /dev/null +++ b/addons/account/account_move_line_extended.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# 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 . +# +############################################################################## + +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 \ No newline at end of file diff --git a/addons/account/account_move_line_extended.xml b/addons/account/account_move_line_extended.xml new file mode 100644 index 00000000000..911c0d43f81 --- /dev/null +++ b/addons/account/account_move_line_extended.xml @@ -0,0 +1,31 @@ + + + + + account.move.partner.info.form + account.move.partner.info + form + + +
+

+ +

+
+
+
+
+
+
+
+
+
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 8c754533024..686d0a51e40 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -974,7 +974,7 @@ - + account.move.line.tree account.move.line diff --git a/addons/account/static/src/css/account.css b/addons/account/static/src/css/account.css new file mode 100644 index 00000000000..963c4391595 --- /dev/null +++ b/addons/account/static/src/css/account.css @@ -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; +} \ No newline at end of file diff --git a/addons/account/static/src/js/account.js b/addons/account/static/src/js/account.js index a08866613d9..e4ca9ada55f 100644 --- a/addons/account/static/src/js/account.js +++ b/addons/account/static/src/js/account.js @@ -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')) diff --git a/addons/account/static/src/xml/account.xml b/addons/account/static/src/xml/account.xml index 506d2c862dc..dba545b219a 100644 --- a/addons/account/static/src/xml/account.xml +++ b/addons/account/static/src/xml/account.xml @@ -14,7 +14,8 @@ - + +
- + + -
- - - - -
- - - - + + diff --git a/addons/account_followup/account_move_reconciliation.xml b/addons/account_followup/account_move_reconciliation.xml index 9759acc0c47..f27bf9207eb 100644 --- a/addons/account_followup/account_move_reconciliation.xml +++ b/addons/account_followup/account_move_reconciliation.xml @@ -6,11 +6,11 @@ account.move.reconciliation - +
From a567a1fc5cd67823928dbb5273ac1c74cc9dcbed Mon Sep 17 00:00:00 2001 From: "RGA(OpenERP)" <> Date: Tue, 7 Aug 2012 17:04:19 +0530 Subject: [PATCH 056/195] [FIX/IMP] fix indetantion and add css for pager button bzr revid: rgaopenerp-20120807113419-v11tltq2k1kcw66o --- .../account/account_move_reconciliation.xml | 46 ++++++++----------- addons/account/account_view.xml | 2 - .../src/css/account_move_reconciliation.css | 17 +++++++ .../src/js/account_move_reconciliation.js | 1 - 4 files changed, 37 insertions(+), 29 deletions(-) diff --git a/addons/account/account_move_reconciliation.xml b/addons/account/account_move_reconciliation.xml index bc0f1145594..96054d0548d 100644 --- a/addons/account/account_move_reconciliation.xml +++ b/addons/account/account_move_reconciliation.xml @@ -9,32 +9,26 @@
-

- Previous - Next - - (0 / 0) - -

- -
-
-
-
-
- -
- - - +

+ Previous + Next + + (0 / 0) +

+
+
+
+
+
+
+
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 3e1f2ac01cd..b6880dab90d 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -1589,7 +1589,6 @@ tree,form - {'view_mode':True} @@ -1599,7 +1598,6 @@ form tree,form - [('partner_id.customer','=',True)] diff --git a/addons/account/static/src/css/account_move_reconciliation.css b/addons/account/static/src/css/account_move_reconciliation.css index a60d7c24788..2757227ac2d 100644 --- a/addons/account/static/src/css/account_move_reconciliation.css +++ b/addons/account/static/src/css/account_move_reconciliation.css @@ -11,6 +11,23 @@ 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; + border-right: 1px solid #ababab; +} + .openerp .oe_pager_m2o li { display: inline-block; height: 24px; diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js index f6204c2e0d2..53d1b27f820 100644 --- a/addons/account/static/src/js/account_move_reconciliation.js +++ b/addons/account/static/src/js/account_move_reconciliation.js @@ -4,7 +4,6 @@ var _t = instance.web._t, 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_viewmanager = instance.web.ViewManagerAction.include({ start : function(){ From 512f5a1bc5aa945877772352675f33a56b8e6ce4 Mon Sep 17 00:00:00 2001 From: "RGA(OpenERP)" <> Date: Tue, 7 Aug 2012 19:04:27 +0530 Subject: [PATCH 057/195] [REM] remove button widget bzr revid: rgaopenerp-20120807133427-kskuv8gtf72fdlwe --- .../account/account_move_reconciliation.xml | 4 +- .../src/js/account_move_reconciliation.js | 78 ++++++------------- .../account/wizard/account_reconcile_view.xml | 6 +- 3 files changed, 30 insertions(+), 58 deletions(-) diff --git a/addons/account/account_move_reconciliation.xml b/addons/account/account_move_reconciliation.xml index 96054d0548d..d98f929d05b 100644 --- a/addons/account/account_move_reconciliation.xml +++ b/addons/account/account_move_reconciliation.xml @@ -22,8 +22,8 @@
-
diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js index 53d1b27f820..8e21bb6e84d 100644 --- a/addons/account/static/src/js/account_move_reconciliation.js +++ b/addons/account/static/src/js/account_move_reconciliation.js @@ -2,8 +2,6 @@ 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.web.form.tags.add('list_button','instance.account.list_button') -instance.web.form.tags.add('btn_extend','instance.account.btn_extend') instance.account.extend_viewmanager = instance.web.ViewManagerAction.include({ start : function(){ @@ -11,13 +9,6 @@ instance.account.extend_viewmanager = instance.web.ViewManagerAction.include({ if(this.action.context && this.action.context.extended_form_view_id) this.setup_exended_form_view(this) }, - on_mode_switch: function (view_type, no_store, options) { - self = this - self.list_loaded = $.when(this._super.apply(this, arguments)).then(function () { - if(self.action.context && self.action.context.extended_form_view_id) - self.list_view = self.views['list'] - }) - }, setup_exended_form_view: function(parent){ var self = this, from_view, @@ -45,51 +36,15 @@ instance.account.extend_form_view = instance.web.FormView.extend({ on_loaded: function(data) { this._super.apply(this,arguments); var self = this + this.$element.find(".oe_reconcile").on('click', this.do_reconcilation) this.$element.on('click','a[data-pager-action]',function() { var action = $(this).data('pager-action'); self.on_pager_action(action); }); }, - do_update_pager: function(hide_index) { - var index = hide_index ? '-' : this.dataset.index + 1; - this.$element.find('span.oe_pager_index_extend').html(index).end() - .find('span.oe_pager_count_extend').html(this.dataset.ids.length); - }, - on_pager_action: function(action) { + do_reconcilation:function(event){ var self = this - var viewmanager = self.getParent(); - viewmanager.action.domain = this.original_domain - $.when(this._super(action)).then(function() { - var id = self.get_fields_values().partner_id; - // apply domain on list - viewmanager.action.domain = (viewmanager.action.domain || []).concat([["partner_id", "=", id]]) - viewmanager.searchview.do_search() - }) - }, - }) - -instance.account.btn_extend = instance.web.form.WidgetButton.extend({ - on_click: function() { - var self = this; - this.force_disabled = true; - this.check_disable(); - this.execute_action().always(function() { - self.force_disabled = false; - self.check_disable(); - self.reload_view(); - }); - - }, - reload_view :function(){ - viewmanager = this.view.getParent().getParent() - viewmanager.inner_widget.list_view.controller.reload_content(); - }, -}) - -instance.account.list_button = instance.web.form.WidgetButton.extend({ - on_click: function() { - var self = this - var list_view = this.view.getParent().list_view.controller + var list_view = this.getParent().views['list'].controller ids = list_view.get_selected_ids() if (ids.length == 0) { instance.web.dialog($("
").text(_t("You must choose at least one record.")), { title: _t("Warning"), modal: true }); @@ -101,7 +56,7 @@ instance.account.list_button = instance.web.form.WidgetButton.extend({ active_model: list_view.dataset.model }); self.rpc("/web/action/load", { - action_id: py.eval(this.node.attrs.name), + action_id: py.eval(event.target.name), context: additional_context }, function(result) { result.result.context = _.extend(result.result.context || {}, @@ -111,10 +66,27 @@ instance.account.list_button = instance.web.form.WidgetButton.extend({ self.do_action(result.result, function () { // reload view list_view.reload(); - self.getParent().reload() }); }); - } -}) - + + }, + do_update_pager: function(hide_index) { + var index = hide_index ? '-' : this.dataset.index + 1; + this.$element.find('span.oe_pager_index_extend').html(index).end() + .find('span.oe_pager_count_extend').html(this.dataset.ids.length); + }, + + on_pager_action: function(action) { + var self = this + var viewmanager = self.getParent(); + viewmanager.action.domain = this.original_domain + $.when(this._super(action)).then(function() { + var id = self.get_fields_values().partner_id; + // apply domain on list + viewmanager.action.domain = (viewmanager.action.domain || []).concat([["partner_id", "=", id]]) + viewmanager.searchview.do_search(); + }) + }, + }) + } diff --git a/addons/account/wizard/account_reconcile_view.xml b/addons/account/wizard/account_reconcile_view.xml index 426eeeb4514..1b36394a7e0 100644 --- a/addons/account/wizard/account_reconcile_view.xml +++ b/addons/account/wizard/account_reconcile_view.xml @@ -14,9 +14,9 @@
-
From 085e20a23d85f749a765767ff53531c72a4c2842 Mon Sep 17 00:00:00 2001 From: "RGA(OpenERP)" <> Date: Wed, 8 Aug 2012 11:04:42 +0530 Subject: [PATCH 058/195] [REM/IMP] remove button from form view and improve css bzr revid: rgaopenerp-20120808053442-ljzf2wy1lmxsdslt --- .../account/account_move_reconciliation.xml | 4 +- .../src/css/account_move_reconciliation.css | 51 ++++++++++--------- .../src/js/account_move_reconciliation.js | 12 ++++- 3 files changed, 39 insertions(+), 28 deletions(-) diff --git a/addons/account/account_move_reconciliation.xml b/addons/account/account_move_reconciliation.xml index d98f929d05b..62ae504ab89 100644 --- a/addons/account/account_move_reconciliation.xml +++ b/addons/account/account_move_reconciliation.xml @@ -22,8 +22,8 @@
diff --git a/addons/account/static/src/css/account_move_reconciliation.css b/addons/account/static/src/css/account_move_reconciliation.css index 2757227ac2d..c087cde296e 100644 --- a/addons/account/static/src/css/account_move_reconciliation.css +++ b/addons/account/static/src/css/account_move_reconciliation.css @@ -25,45 +25,46 @@ padding: 0 5px 0 5px; margin: 0 2px 0 2px; float: left; - border-right: 1px solid #ababab; +} + +.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: #404040; + display: inline-block; + font-size: 13px; + margin: 0 3px 0 3px; + padding: 3px 12px; + text-align: center; + text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5); } -.openerp .oe_pager_m2o li { - display: inline-block; - height: 24px; - line-height: 24px; - padding: 0; - float: left; +.openerp .oe_reconcile_button:hover { + background-color: #E3E3E3; + background-image: -moz-linear-gradient(center top , #E3E3E3, #F6F6F6); + box-shadow: none; } -.openerp .oe_pager_m2o a { - padding: 0 8px; +.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; + display: inline-block; + min-width: 100px; } .openerp .oe_extended_form_view .oe_form_field { - width: auto; -} -.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; -} + .openerp .oe_extended_form_view .oe_form_field_progressbar.ui-progressbar { width: 200px !important; } \ No newline at end of file diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js index 8e21bb6e84d..b8435da7c9b 100644 --- a/addons/account/static/src/js/account_move_reconciliation.js +++ b/addons/account/static/src/js/account_move_reconciliation.js @@ -37,6 +37,7 @@ instance.account.extend_form_view = instance.web.FormView.extend({ this._super.apply(this,arguments); var self = this this.$element.find(".oe_reconcile").on('click', this.do_reconcilation) + this.$element.find(".oe_nothing_to_reconcile").on('click', this.do_nothing_to_reconcile) this.$element.on('click','a[data-pager-action]',function() { var action = $(this).data('pager-action'); self.on_pager_action(action); @@ -68,8 +69,17 @@ instance.account.extend_form_view = instance.web.FormView.extend({ list_view.reload(); }); }); - }, + + do_nothing_to_reconcile:function(event){ + self = this + this.dataset.call(event.target.name, [[self.datarecord.id], self.dataset.context]).then(function() { + self.dataset.read_slice().done(function(){ + self.on_pager_action(); + }); + }) + }, + do_update_pager: function(hide_index) { var index = hide_index ? '-' : this.dataset.index + 1; this.$element.find('span.oe_pager_index_extend').html(index).end() From 7b26f82778944a5955129fefe80bd675c57cff5a Mon Sep 17 00:00:00 2001 From: "RGA(OpenERP)" <> Date: Wed, 8 Aug 2012 11:36:47 +0530 Subject: [PATCH 059/195] [IMP] imporve view (CSS) bzr revid: rgaopenerp-20120808060647-9pgjic3obic4wwrg --- .../static/src/css/account_move_reconciliation.css | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/addons/account/static/src/css/account_move_reconciliation.css b/addons/account/static/src/css/account_move_reconciliation.css index c087cde296e..59861a66b68 100644 --- a/addons/account/static/src/css/account_move_reconciliation.css +++ b/addons/account/static/src/css/account_move_reconciliation.css @@ -11,7 +11,7 @@ margin: 2px; } -.openerp .oe_pager_button{ +.openerp .oe_pager_button { float: left; height: 22px; line-height: 24px; @@ -26,6 +26,9 @@ margin: 0 2px 0 2px; float: left; } +.openerp .oe_pager_button:hover{ + text-decoration:none !important; +} .openerp .oe_reconcile_button { float: left; @@ -35,16 +38,18 @@ 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: #404040; + 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; From fbddeaa021aa4d43f9b0248d73cc8722bda22e9c Mon Sep 17 00:00:00 2001 From: "RGA(OpenERP)" <> Date: Wed, 8 Aug 2012 19:27:47 +0530 Subject: [PATCH 060/195] [IMP] impromve sql view for model, remove method for nothing to reconcile button bzr revid: rgaopenerp-20120808135747-vdi2wztvi9qprsus --- addons/account/__openerp__.py | 2 +- addons/account/account_move_reconciliation.py | 57 +++++++------------ addons/account/account_view.xml | 14 +---- .../src/js/account_move_reconciliation.js | 11 ++-- 4 files changed, 27 insertions(+), 57 deletions(-) diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py index 950ee2da895..0542c9fa79e 100644 --- a/addons/account/__openerp__.py +++ b/addons/account/__openerp__.py @@ -66,8 +66,8 @@ financial year and for preparation of vouchers there is a module named account_v 'wizard/account_period_close_view.xml', 'wizard/account_reconcile_view.xml', 'wizard/account_unreconcile_view.xml', - 'account_view.xml', 'account_move_reconciliation.xml', + 'account_view.xml', 'account_report.xml', 'account_financial_report_data.xml', 'wizard/account_report_common_view.xml', diff --git a/addons/account/account_move_reconciliation.py b/addons/account/account_move_reconciliation.py index 8dee6e98b22..f885214ec65 100644 --- a/addons/account/account_move_reconciliation.py +++ b/addons/account/account_move_reconciliation.py @@ -22,12 +22,9 @@ import tools from osv import fields,osv -class res_partner(osv.osv): - _inherit = 'res.partner' - _columns = { - 'partner_move_count': fields.integer('Partner move line count') - } -res_partner() +#1. Remove field from res.partner + +#4 remove get_unreconcile_entry method mange it with domain class account_move_line(osv.osv): _inherit = "account.move.line" @@ -49,53 +46,37 @@ class account_move_reconciliation(osv.osv): _auto = False def _rec_progress(self, cr, uid, ids, prop, unknow_none, context=None): + active_ids = context.get('active_ids', []) res = 0 - cr.execute("""SELECT partner_id, reconcile_id - FROM account_move_line WHERE state <> 'draft' - GROUP BY partner_id, reconcile_id""") - result = cr.fetchall() - partner_total = len(result) - partner_reconcile = len([ (x,y) for x, y in result if y == None ]) - if partner_total: - res = float(partner_total- partner_reconcile)/partner_total * 100 - + if active_ids: + total_records = self.search(cr, uid, [('id','in',active_ids)]) + total_reconcile = 0 + for record in self.read(cr, uid, total_records, ['reconcile_count'], context=context): + if record['reconcile_count'] > 0: + total_reconcile += 1 + res = float(total_reconcile)/len(total_records) * 100 res_all = {} for id in ids: 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_reconciliation, 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'), + 'last_reconciliation_date':fields.related('partner_id', 'last_reconciliation_date' ,type='datetime', relation='res.partner', string='Last Reconciliation'), 'latest_date' :fields.date('Latest Entry'), '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'), + 'reconcile_count':fields.integer('Reconcile 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_reconciliation') cr.execute(""" CREATE or REPLACE VIEW account_move_reconciliation as ( - SELECT p.id, p.id as partner_id, - MAX(p.last_reconciliation_date) as last_reconciliation_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 + SELECT move_line.partner_id as id, move_line.partner_id, + MAX(move_line.date) as latest_date, + (select count(reconcile.id) from account_move_line as reconcile where reconcile.reconcile_id is not null and reconcile.partner_id = move_line.partner_id) as reconcile_count + FROM account_move_line as move_line where move_line.state <> 'draft' + GROUP by move_line.partner_id ) """) account_move_reconciliation() diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index b6880dab90d..8f4089e5e2c 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -1582,16 +1582,6 @@ - - Entries To Reconcile - account.move.line - form - tree,form - - - {'view_mode':True} - - Entries To Reconcile account.move.line @@ -1599,7 +1589,7 @@ tree,form [('partner_id.customer','=',True)] - + @@ -1609,7 +1599,7 @@ tree,form [('partner_id.supplier','=',True)] - + Date: Thu, 9 Aug 2012 12:20:42 +0530 Subject: [PATCH 061/195] [IMP] progress bar and reload formon destroy of reconcile wizard bzr revid: rgaopenerp-20120809065042-bl8tyauxovr07r2v --- addons/account/account_move_reconciliation.py | 16 +++++++--------- .../static/src/js/account_move_reconciliation.js | 10 ++++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/addons/account/account_move_reconciliation.py b/addons/account/account_move_reconciliation.py index f885214ec65..eaf9d31f976 100644 --- a/addons/account/account_move_reconciliation.py +++ b/addons/account/account_move_reconciliation.py @@ -22,8 +22,6 @@ import tools from osv import fields,osv -#1. Remove field from res.partner - #4 remove get_unreconcile_entry method mange it with domain class account_move_line(osv.osv): @@ -50,11 +48,11 @@ class account_move_reconciliation(osv.osv): res = 0 if active_ids: total_records = self.search(cr, uid, [('id','in',active_ids)]) - total_reconcile = 0 - for record in self.read(cr, uid, total_records, ['reconcile_count'], context=context): - if record['reconcile_count'] > 0: - total_reconcile += 1 - res = float(total_reconcile)/len(total_records) * 100 + total_unreconcile = 0 + for record in self.read(cr, uid, total_records, ['unreconcile_count'], context=context): + if record['unreconcile_count'] > 0: + total_unreconcile += 1 + res = float(len(total_records) - total_unreconcile)/len(total_records) * 100 res_all = {} for id in ids: res_all[id] = res @@ -66,7 +64,7 @@ class account_move_reconciliation(osv.osv): 'last_reconciliation_date':fields.related('partner_id', 'last_reconciliation_date' ,type='datetime', relation='res.partner', string='Last Reconciliation'), 'latest_date' :fields.date('Latest Entry'), 'reconciliation_progress': fields.function(_rec_progress, string='Progress (%)', type='float'), - 'reconcile_count':fields.integer('Reconcile Count'), + 'unreconcile_count':fields.integer('Unreconcile Count'), } def init(self, cr): tools.drop_view_if_exists(cr, 'account_move_reconciliation') @@ -74,7 +72,7 @@ class account_move_reconciliation(osv.osv): CREATE or REPLACE VIEW account_move_reconciliation as ( SELECT move_line.partner_id as id, move_line.partner_id, MAX(move_line.date) as latest_date, - (select count(reconcile.id) from account_move_line as reconcile where reconcile.reconcile_id is not null and reconcile.partner_id = move_line.partner_id) as reconcile_count + (select count(unreconcile.id) from account_move_line as unreconcile where unreconcile.reconcile_id is null and unreconcile.partner_id = move_line.partner_id) as unreconcile_count FROM account_move_line as move_line where move_line.state <> 'draft' GROUP by move_line.partner_id ) diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js index 03a41fef8a3..765a48af13b 100644 --- a/addons/account/static/src/js/account_move_reconciliation.js +++ b/addons/account/static/src/js/account_move_reconciliation.js @@ -68,15 +68,17 @@ instance.account.extend_form_view = instance.web.FormView.extend({ self.do_action(result.result, function () { // reload view list_view.reload(); + self.reload(); }); }); }, - do_nothing_to_reconcile:function(event){ - viewmanager = this.getParent(); + do_nothing_to_reconcile:function(){ this.dataset.ids = _.without(this.dataset.ids, this.datarecord.id) - viewmanager.action.context.active_ids = viewmanager.dataset_form.ids; - this.on_pager_action(); + // viewmanager = this.getParent(); + // viewmanager.action.context.active_ids = viewmanager.dataset_form.ids; + if (!_.isEmpty(this.dataset.ids)) + this.on_pager_action('first'); }, do_update_pager: function(hide_index) { From bd79baf8b39073b73ac5b4f50a8ddb382313bb5d Mon Sep 17 00:00:00 2001 From: "RGA(OpenERP)" <> Date: Thu, 9 Aug 2012 14:47:47 +0530 Subject: [PATCH 062/195] [fix] inheretied view of account followup bzr revid: rgaopenerp-20120809091747-46o45ssfkmoh9shf --- .../account_move_reconciliation.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/addons/account_followup/account_move_reconciliation.py b/addons/account_followup/account_move_reconciliation.py index b185b9a7347..6370a4bbdca 100644 --- a/addons/account_followup/account_move_reconciliation.py +++ b/addons/account_followup/account_move_reconciliation.py @@ -12,16 +12,14 @@ class account_move_reconciliation(osv.osv): def init(self, cr): tools.drop_view_if_exists(cr, 'account_move_reconciliation') cr.execute(""" - CREATE or REPLACE VIEW account_move_reconciliation as ( - SELECT p.id, p.id as partner_id, - MAX(p.last_reconciliation_date) as last_reconciliation_date, - MAX(l.date) as latest_date, - COUNT(l.id) as move_lines_count, - MAX(p.partner_move_count) as partner_move_count, - MAX(l.followup_date) as followup_date, - MAX(l.followup_line_id) as max_followup_id - FROM account_move_line as l INNER JOIN res_partner AS p ON (l.partner_id = p.id) - GROUP by p.id + CREATE or REPLACE VIEW account_move_reconciliation as ( + SELECT move_line.partner_id as id, move_line.partner_id, + MAX(move_line.date) as latest_date, + MAX(move_line.followup_date) as followup_date, + MAX(move_line.followup_line_id) as max_followup_id, + (select count(unreconcile.id) from account_move_line as unreconcile where unreconcile.reconcile_id is null and unreconcile.partner_id = move_line.partner_id) as unreconcile_count + FROM account_move_line as move_line where move_line.state <> 'draft' + GROUP by move_line.partner_id ) """) account_move_reconciliation() \ No newline at end of file From 9825ad01c68c49ea1c6b4b28b557365aee7fcbbf Mon Sep 17 00:00:00 2001 From: "Atul Patel (OpenERP)" Date: Thu, 9 Aug 2012 23:52:14 +0530 Subject: [PATCH 063/195] [FIX]: Remove unnecessary space bzr revid: atp@tinyerp.com-20120809182214-sc0pui70bxi35qy0 --- addons/sale_stock/res_config_view.xml | 115 +++++++++++++------------- 1 file changed, 57 insertions(+), 58 deletions(-) diff --git a/addons/sale_stock/res_config_view.xml b/addons/sale_stock/res_config_view.xml index 8cb1419cbeb..24ece1673b3 100644 --- a/addons/sale_stock/res_config_view.xml +++ b/addons/sale_stock/res_config_view.xml @@ -8,67 +8,66 @@ form - - -
- -
-
- -
-
- - - -
- -
-
- - - - -
-
- -
-
-
-
- -
-
+ + +
+ +
+
+ +
+
+ + + +
+ +
+
+ + + + +
+
+ +
+
+
+
+ +
+
- -
- -
-
+ +
+ +
+
- - - - - -
-
-
- -
-
-
+ + + + +
+
+
+ +
+
+
From 72bdcb2a35116b16c04cbc53476dbeb759c94a59 Mon Sep 17 00:00:00 2001 From: "Amit (OpenERP)" Date: Mon, 13 Aug 2012 14:07:29 +0530 Subject: [PATCH 064/195] [Fix] analytic : Imporved the analytic copy method lp bug: https://launchpad.net/bugs/707359 fixed bzr revid: amp@tinyerp.com-20120813083729-ncbcl2w0d846yah4 --- addons/analytic/analytic.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/analytic/analytic.py b/addons/analytic/analytic.py index 165af37888d..9ae3e6de2ad 100644 --- a/addons/analytic/analytic.py +++ b/addons/analytic/analytic.py @@ -238,8 +238,10 @@ class account_analytic_account(osv.osv): def copy(self, cr, uid, id, default=None, context=None): if not default: default = {} + analytic = self.browse(cr, uid, id, context=context) default['code'] = False default['line_ids'] = [] + default['name'] = (analytic['name'] or '') + '(copy)' return super(account_analytic_account, self).copy(cr, uid, id, default, context=context) def on_change_company(self, cr, uid, id, company_id): From 7f38e9b7486071829535622fea8cf00e36a4036c Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Mon, 13 Aug 2012 14:16:28 +0530 Subject: [PATCH 065/195] [REVIEW] account_voucher: reconcile/unreconcile button in bank statment line bzr revid: hmo@tinyerp.com-20120813084628-ohvzyadke3knlbq0 --- addons/account_voucher/account_voucher.py | 20 +++++++++---------- .../account_voucher/account_voucher_view.xml | 8 ++++++-- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 3979796b4ed..0c5ba8cf7ce 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -1494,19 +1494,18 @@ account_bank_statement() class account_bank_statement_line(osv.osv): _inherit = 'account.bank.statement.line' - def bank_st_payment(self, cr, uid, ids, context): - record = record_id = False - for rec in self.browse(cr, uid, ids, context=context): - record_id = rec.voucher_id and rec.voucher_id .id or False - record = rec + def action_payment_reconcile(self, cr, uid, ids, context=None): + statement_id = ids[0] + statement = self.browse(cr, uid, statement_id, context=context) + voucher = statement.voucher_id or False + if voucher and voucher.state == 'posted': + return voucher.cancel_voucher(context=context) mod_obj = self.pool.get('ir.model.data') - if record and record.type == 'customer': + if voucher and voucher.type == 'customer': res = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_form') else: res = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_payment_form') view_id = res and res[1] or False - context.update({'partner_id':record.partner_id.id, 'amount':record.amount}) - return { 'name': _('Payment Entry'), 'res_model': 'account.voucher', @@ -1515,10 +1514,9 @@ class account_bank_statement_line(osv.osv): 'target':'new', 'view_id':view_id, 'context': context, - 'res_id':record_id, + 'res_id':voucher and voucher.id or False, 'type': 'ir.actions.act_window' - } - + } def _amount_reconciled(self, cursor, user, ids, name, args, context=None): if not ids: diff --git a/addons/account_voucher/account_voucher_view.xml b/addons/account_voucher/account_voucher_view.xml index be91624755e..6d0658218eb 100644 --- a/addons/account_voucher/account_voucher_view.xml +++ b/addons/account_voucher/account_voucher_view.xml @@ -219,8 +219,12 @@ - - --> -
-
+ -
+
diff --git a/addons/account/static/src/css/account_move_reconciliation.css b/addons/account/static/src/css/account_move_reconciliation.css index 0cedec95f09..f4136a79ef4 100644 --- a/addons/account/static/src/css/account_move_reconciliation.css +++ b/addons/account/static/src/css/account_move_reconciliation.css @@ -73,7 +73,9 @@ .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; diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 9a3af14f665..d91c6158d18 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -1499,8 +1499,6 @@ class account_bank_statement_line(osv.osv): statement_id = ids[0] statement = self.browse(cr, uid, statement_id, context=context) voucher = statement.voucher_id or False - if voucher and voucher.state == 'posted': - return voucher.cancel_voucher(context=context) mod_obj = self.pool.get('ir.model.data') if voucher and voucher.type == 'customer': res = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_form') @@ -1529,7 +1527,16 @@ class account_bank_statement_line(osv.osv): else: res[line.id] = 0.0 return res - + + def _is_reconciled(self, cr, uid, ids, name, args, context=None): + res = {} + for line in self.browse(cr, uid, ids, context=context): + if line.voucher_id and line.voucher_id.state == 'posted': + res[line.id] = True + else: + res[line.id] = False + return res + def _check_amount(self, cr, uid, ids, context=None): for obj in self.browse(cr, uid, ids, context=context): if obj.voucher_id: @@ -1543,6 +1550,8 @@ class account_bank_statement_line(osv.osv): ] _columns = { + 'is_reconciled': fields.function(_is_reconciled, + string='Statement is reconciled?', type='boolean'), 'amount_reconciled': fields.function(_amount_reconciled, string='Amount reconciled', type='float'), 'voucher_id': fields.many2one('account.voucher', 'Payment'), diff --git a/addons/account_voucher/account_voucher_view.xml b/addons/account_voucher/account_voucher_view.xml index ddeba22d905..30dfe527d3b 100644 --- a/addons/account_voucher/account_voucher_view.xml +++ b/addons/account_voucher/account_voucher_view.xml @@ -217,7 +217,8 @@ --> - --> -
-
+
diff --git a/addons/account_followup/account_move_reconciliation.py b/addons/account_followup/account_move_reconciliation.py index 4345c921954..00ae40f3aa8 100644 --- a/addons/account_followup/account_move_reconciliation.py +++ b/addons/account_followup/account_move_reconciliation.py @@ -23,17 +23,28 @@ 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 or False + return result + _columns = { 'followup_date': fields.date('Latest Follow-up'), - #'followup_id':fields.many2one('account_followup.followup.line', - # 'Max Follow Up Level' ) + '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, + 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 diff --git a/addons/account_followup/account_move_reconciliation.xml b/addons/account_followup/account_move_reconciliation.xml index a3b8fa0dfdb..6ec70fd18a5 100644 --- a/addons/account_followup/account_move_reconciliation.xml +++ b/addons/account_followup/account_move_reconciliation.xml @@ -6,10 +6,10 @@ account.move.reconciliation - + From 20eb0a5e882878e792c2b7f1f713d0415e740542 Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Wed, 29 Aug 2012 18:13:03 +0530 Subject: [PATCH 081/195] [FIX] account: refactor js of account_reconciliation bzr revid: hmo@tinyerp.com-20120829124303-8kw2jz4x4p2jr64u --- .../account/account_move_reconciliation.xml | 4 +- .../src/js/account_move_reconciliation.js | 59 +++++++++---------- 2 files changed, 30 insertions(+), 33 deletions(-) diff --git a/addons/account/account_move_reconciliation.xml b/addons/account/account_move_reconciliation.xml index 20e3ba1486c..e5ccb090988 100644 --- a/addons/account/account_move_reconciliation.xml +++ b/addons/account/account_move_reconciliation.xml @@ -36,7 +36,7 @@ - Entries To Reconcile + Reconcile Customer Entries account.move.line form tree,form @@ -45,7 +45,7 @@ - Entries To Reconcile + Reconcile Supplier Entries account.move.line form tree,form diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js index 03e6529ae9b..8339d7e2768 100644 --- a/addons/account/static/src/js/account_move_reconciliation.js +++ b/addons/account/static/src/js/account_move_reconciliation.js @@ -10,29 +10,20 @@ instance.account.extend_viewmanager = instance.web.ViewManagerAction.include({ 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, - obj_from_view; + 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, this.dataset_form, view_id, options={}); - obj_from_view.template = 'ExtendedFormView' - view_promise = obj_from_view.appendTo(this.$el.find('.oe_extended_form_view')) - $.when(view_promise, this.dataset_loaded).then(function() { - self.action.context.active_ids = self.dataset_form.ids; - if (!_.isEmpty(self.dataset_form.ids)) { - obj_from_view.on_pager_action('first') - } - }) + 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.post_action(); + }); } }) instance.account.extend_form_view = instance.web.FormView.extend({ - init :function(){ - this._super.apply(this,arguments); - this.original_domain = this.getParent().action.domain; - }, on_loaded: function(data) { this._super.apply(this,arguments); var self = this @@ -65,23 +56,32 @@ instance.account.extend_form_view = instance.web.FormView.extend({ result.result.flags = result.result.flags || {}; result.result.flags.new_window = true; self.do_action(result.result, function () { - // reload view - list_view.reload(); - self.reload(); + self.post_action(); }); }); }, + + post_action: function(){ + // hide if not records otherwise go next record + var self = this; + var viewmanager = this.getParent(); + this.dataset.read_slice().done(function(){ + if (_.isEmpty(self.dataset.ids)){ + self.$el.hide(); + viewmanager.action.context.next_partner_only = false; + viewmanager.searchview.do_search(); + } + else{ + self.on_pager_action('next'); + } + }); + }, do_nothing_to_reconcile:function(){ - var self = this - if (!_.isEmpty(this.dataset.ids)){ + var self = this; this.dataset.call(event.target.name, [[self.datarecord.id], self.dataset.context]).then(function() { - self.dataset.read_slice().done(function(){ - if (!_.isEmpty(self.dataset.ids)) - self.on_pager_action('first'); - }); - }) - } + self.post_action(); + }); }, do_update_pager: function(hide_index) { @@ -93,13 +93,10 @@ instance.account.extend_form_view = instance.web.FormView.extend({ on_pager_action: function(action) { var self = this var viewmanager = self.getParent(); - viewmanager.action.domain = this.original_domain $.when(this._super(action)).then(function() { var id = self.get_fields_values().partner_id; viewmanager.action.context.next_partner_only = true; viewmanager.action.context.partner_id = [id]; - // apply domain on list - //viewmanager.action.domain = (viewmanager.action.domain || []).concat([["partner_id", "=", id]]) viewmanager.searchview.do_search(); }) }, From ca603482093bd42788c7ee97e62b43272ce7f088 Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Thu, 30 Aug 2012 16:09:54 +0530 Subject: [PATCH 082/195] [FIX] account: reconciliation wizard, improve calculattion of pert. bzr revid: hmo@tinyerp.com-20120830103954-mueab873pcunqjod --- addons/account/account_move_reconciliation.py | 33 ++++++++++++++++--- .../src/js/account_move_reconciliation.js | 7 ++-- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/addons/account/account_move_reconciliation.py b/addons/account/account_move_reconciliation.py index eb3eaf31458..a3f171fae7c 100644 --- a/addons/account/account_move_reconciliation.py +++ b/addons/account/account_move_reconciliation.py @@ -50,14 +50,37 @@ class account_move_reconciliation(osv.osv): def _rec_progress(self, cr, uid, ids, prop, unknow_none, context=None): res = {} - to_reconcile_ids = self.search(cr, uid, [], context=context) - to_reconcile = to_reconcile_ids and len(to_reconcile_ids) or 0 - today_reconcile_ids = self.search(cr, uid, [('last_reconciliation_date','=',time.strftime('%Y-%m-%d'))], context=context) - today_reconcile = today_reconcile_ids and len(today_reconcile_ids) or 0 + 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(move_line.partner_id.id) + + to_reconcile = len(partner_ids) + 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')) + ], context=ctx) + today_reconciled = today_reconciled_ids and len(today_reconciled_ids) or 0 # total partners which reconciled today if to_reconcile < 0: reconciliation_progress = 100 else: - reconciliation_progress = (100 / (float( to_reconcile + today_reconcile) or 1.0)) * today_reconcile + reconciliation_progress = (100 / (float( to_reconcile + today_reconciled) or 1.0)) * today_reconciled for id in ids: res[id] = reconciliation_progress return res diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js index 8339d7e2768..0af38246f0f 100644 --- a/addons/account/static/src/js/account_move_reconciliation.js +++ b/addons/account/static/src/js/account_move_reconciliation.js @@ -67,12 +67,13 @@ instance.account.extend_form_view = instance.web.FormView.extend({ var viewmanager = this.getParent(); this.dataset.read_slice().done(function(){ if (_.isEmpty(self.dataset.ids)){ - self.$el.hide(); + viewmanager.action.context.next_partner_only = true; + /*self.$el.hide(); viewmanager.action.context.next_partner_only = false; - viewmanager.searchview.do_search(); + viewmanager.searchview.do_search();*/ } else{ - self.on_pager_action('next'); + self.on_pager_action('first'); } }); }, From 08db03bfa247a12913231216cf2d49c70dd90b5a Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Thu, 30 Aug 2012 17:40:41 +0530 Subject: [PATCH 083/195] [IMP] account: split in small functions bzr revid: hmo@tinyerp.com-20120830121041-pruspkwkav090foc --- addons/account/account_move_reconciliation.py | 31 ++++++++++++++----- .../src/js/account_move_reconciliation.js | 5 ++- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/addons/account/account_move_reconciliation.py b/addons/account/account_move_reconciliation.py index a3f171fae7c..b89dbacf623 100644 --- a/addons/account/account_move_reconciliation.py +++ b/addons/account/account_move_reconciliation.py @@ -48,14 +48,13 @@ class account_move_reconciliation(osv.osv): return super(account_move_reconciliation, self).search(cr, uid, args, offset, limit, order, context=context, count=count) - def _rec_progress(self, cr, uid, ids, prop, unknow_none, context=None): - res = {} + + 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), @@ -69,14 +68,30 @@ class account_move_reconciliation(osv.osv): 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(move_line.partner_id.id) + partner_ids.append(partner.id) + return len(partner_ids) - to_reconcile = 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')) - ], context=ctx) - today_reconciled = today_reconciled_ids and len(today_reconciled_ids) or 0 # total partners which reconciled today + ('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: diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js index 0af38246f0f..9b5aacf28bf 100644 --- a/addons/account/static/src/js/account_move_reconciliation.js +++ b/addons/account/static/src/js/account_move_reconciliation.js @@ -86,7 +86,10 @@ instance.account.extend_form_view = instance.web.FormView.extend({ }, do_update_pager: function(hide_index) { - var index = hide_index ? '-' : this.dataset.index + 1; + 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); }, From 6461c5e31f18fd1fa7352b95cb7bbf46567a94c8 Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Thu, 30 Aug 2012 18:56:29 +0530 Subject: [PATCH 084/195] [FIX] account: rector js of account reconcilation bzr revid: hmo@tinyerp.com-20120830132629-72mnqvtwespvik0b --- .../src/js/account_move_reconciliation.js | 41 +++++++++---------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js index 9b5aacf28bf..8196779fa1d 100644 --- a/addons/account/static/src/js/account_move_reconciliation.js +++ b/addons/account/static/src/js/account_move_reconciliation.js @@ -18,7 +18,7 @@ instance.account.extend_viewmanager = instance.web.ViewManagerAction.include({ 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.post_action(); + obj_from_view.on_pager_action('first'); }); } @@ -56,32 +56,20 @@ instance.account.extend_form_view = instance.web.FormView.extend({ result.result.flags = result.result.flags || {}; result.result.flags.new_window = true; self.do_action(result.result, function () { - self.post_action(); + self.dataset.read_slice().done(function(){ + self.on_pager_action('next'); + }); }); }); }, - post_action: function(){ - // hide if not records otherwise go next record - var self = this; - var viewmanager = this.getParent(); - this.dataset.read_slice().done(function(){ - if (_.isEmpty(self.dataset.ids)){ - viewmanager.action.context.next_partner_only = true; - /*self.$el.hide(); - viewmanager.action.context.next_partner_only = false; - viewmanager.searchview.do_search();*/ - } - else{ - self.on_pager_action('first'); - } - }); - }, - + do_nothing_to_reconcile:function(){ var self = this; this.dataset.call(event.target.name, [[self.datarecord.id], self.dataset.context]).then(function() { - self.post_action(); + self.dataset.read_slice().done(function(){ + self.on_pager_action('next'); + }); }); }, @@ -97,12 +85,21 @@ instance.account.extend_form_view = instance.web.FormView.extend({ on_pager_action: function(action) { var self = this var viewmanager = self.getParent(); + viewmanager.action.context.next_partner_only = true; + //TODO: if no records, than it's not working, it giving error + if (this.dataset.ids.length == 0){ + self.dataset.index = null; + viewmanager.action.context.partner_id = []; + viewmanager.searchview.do_search(); + self.reload(); + return + } + $.when(this._super(action)).then(function() { var id = self.get_fields_values().partner_id; - viewmanager.action.context.next_partner_only = true; viewmanager.action.context.partner_id = [id]; viewmanager.searchview.do_search(); - }) + }); }, }) From f577f5b990622d6713cbbcc646f9245307402e53 Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Fri, 31 Aug 2012 14:12:24 +0530 Subject: [PATCH 085/195] [FIX] account_followup: fix function of followup level bzr revid: hmo@tinyerp.com-20120831084224-y42jdzjf9arz54fh --- addons/account_followup/account_move_reconciliation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account_followup/account_move_reconciliation.py b/addons/account_followup/account_move_reconciliation.py index 00ae40f3aa8..01338ddb6eb 100644 --- a/addons/account_followup/account_move_reconciliation.py +++ b/addons/account_followup/account_move_reconciliation.py @@ -30,7 +30,7 @@ class account_move_reconciliation(osv.osv): 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 or False + result[rec.id] = move_line and move_line.followup_line_id.id or False return result _columns = { From 432601cb7ec9f30629df0b290cccddf0a5a0c1ef Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Wed, 5 Sep 2012 13:21:20 +0530 Subject: [PATCH 086/195] [FIX] account: reconciliation form , set false if not data bzr revid: hmo@tinyerp.com-20120905075120-kcf31riknnaha8v0 --- .../src/js/account_move_reconciliation.js | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js index 8196779fa1d..3d046f99312 100644 --- a/addons/account/static/src/js/account_move_reconciliation.js +++ b/addons/account/static/src/js/account_move_reconciliation.js @@ -86,20 +86,22 @@ instance.account.extend_form_view = instance.web.FormView.extend({ var self = this var viewmanager = self.getParent(); viewmanager.action.context.next_partner_only = true; - //TODO: if no records, than it's not working, it giving error if (this.dataset.ids.length == 0){ - self.dataset.index = null; + self.datarecord = {} viewmanager.action.context.partner_id = []; viewmanager.searchview.do_search(); - self.reload(); - return + _(this.fields).each(function (field, f) { + field.set_value(self.datarecord[f] || false); + }); + self.do_update_pager(); + } + else{ + $.when(this._super(action)).then(function() { + var id = self.get_fields_values().partner_id; + viewmanager.action.context.partner_id = [id]; + viewmanager.searchview.do_search(); + }); } - - $.when(this._super(action)).then(function() { - var id = self.get_fields_values().partner_id; - viewmanager.action.context.partner_id = [id]; - viewmanager.searchview.do_search(); - }); }, }) From ef06a2d41a1e7a4c5e8c0269d60abacf69fb917d Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Wed, 5 Sep 2012 13:28:20 +0530 Subject: [PATCH 087/195] [REF] account: account reconciliation JS bzr revid: hmo@tinyerp.com-20120905075820-1uu55c972rmdhpjb --- .../static/src/js/account_move_reconciliation.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js index 3d046f99312..680eca18374 100644 --- a/addons/account/static/src/js/account_move_reconciliation.js +++ b/addons/account/static/src/js/account_move_reconciliation.js @@ -81,25 +81,28 @@ instance.account.extend_form_view = instance.web.FormView.extend({ 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 - var viewmanager = self.getParent(); - viewmanager.action.context.next_partner_only = true; if (this.dataset.ids.length == 0){ self.datarecord = {} - viewmanager.action.context.partner_id = []; - viewmanager.searchview.do_search(); _(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; - viewmanager.action.context.partner_id = [id]; - viewmanager.searchview.do_search(); + self.do_search_move_line([id]); }); } }, From 031ccce1504e3d058a1855551543cfc6b724d2f9 Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Wed, 5 Sep 2012 13:41:42 +0530 Subject: [PATCH 088/195] [FIX] account: account reconciliation JS, return false if not datarecord on click on reconciliation, nothing reconciliation buttons bzr revid: hmo@tinyerp.com-20120905081142-6zdw8cs919v0l0j8 --- .../account/static/src/js/account_move_reconciliation.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js index 680eca18374..88b263038b4 100644 --- a/addons/account/static/src/js/account_move_reconciliation.js +++ b/addons/account/static/src/js/account_move_reconciliation.js @@ -36,6 +36,9 @@ instance.account.extend_form_view = instance.web.FormView.extend({ }, 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) { @@ -66,6 +69,9 @@ instance.account.extend_form_view = instance.web.FormView.extend({ 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'); @@ -91,6 +97,7 @@ instance.account.extend_form_view = instance.web.FormView.extend({ on_pager_action: function(action) { var self = this + if (this.dataset.ids.length == 0){ self.datarecord = {} _(this.fields).each(function (field, f) { From c1cbb42b0a917ccd565138f67c6f2fef3a15f8d1 Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Wed, 5 Sep 2012 18:46:38 +0530 Subject: [PATCH 089/195] [FIX] account_voucher: open payment entry for bank statement bzr revid: hmo@tinyerp.com-20120905131638-6nwbwe3acaw0n1nn --- addons/account_voucher/account_voucher.py | 60 ++++++++----------- .../account_voucher/account_voucher_view.xml | 4 -- 2 files changed, 24 insertions(+), 40 deletions(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 91dfdfcf420..cb2e93705bb 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -334,9 +334,15 @@ class account_voucher(osv.osv): } 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') @@ -1496,49 +1502,31 @@ 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 - if not voucher: - voucher_obj = self.pool.get('account.voucher') - sign = 1 - type = 'general' - ttype = statement.amount < 0 and 'payment' or 'receipt' - if statement.journal_id.type in ('sale', 'sale_refund'): - type = 'customer' - ttype = 'receipt' - elif statement.journal_id.type in ('purchase', 'purhcase_refund'): - type = 'supplier' - ttype = 'payment' - sign = -1 - - result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=statement.partner_id.id, journal_id=statement.journal_id.id, amount=sign*statement.amount, currency_id= False, ttype=ttype, date=statement.date, context=context) - voucher_res = { 'type': ttype, - 'name': statement.name, - 'partner_id': statement.partner_id.id, - 'journal_id': statement.journal_id.id, - 'account_id': result.get('account_id', statement.journal_id.default_credit_account_id.id), - 'company_id': statement.company_id.id, - 'date': statement.date, - 'amount': sign*statement.amount, - } - voucher_id = voucher_obj.create(cr, uid, voucher_res, context=context) - self.write(cr, uid, statement_id, {'voucher_id':voucher_id}, context=context) - mod_obj = self.pool.get('ir.model.data') - if voucher and voucher.type == 'customer': - res = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_form') - else: - res = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_payment_form') - view_id = res and res[1] or False return { 'name': _('Payment Entry'), 'res_model': 'account.voucher', 'view_type': 'form', 'view_mode': 'form', 'target':'new', - 'view_id':view_id, - 'context': context, + 'context': ctx, 'res_id':voucher_id, 'type': 'ir.actions.act_window' } diff --git a/addons/account_voucher/account_voucher_view.xml b/addons/account_voucher/account_voucher_view.xml index 47a326e4f96..5577dceec82 100644 --- a/addons/account_voucher/account_voucher_view.xml +++ b/addons/account_voucher/account_voucher_view.xml @@ -213,10 +213,6 @@ -
+ - - + - - - + + + + @@ -278,7 +280,7 @@ - + @@ -319,13 +321,27 @@ + + + sale.order.form.editable.list + sale.order + + + + + + + + + sale.order.list.select sale.order - + diff --git a/addons/sale/sale_workflow.xml b/addons/sale/sale_workflow.xml index 5e032eab8c6..41684e519cd 100644 --- a/addons/sale/sale_workflow.xml +++ b/addons/sale/sale_workflow.xml @@ -39,7 +39,7 @@ done True function - write({'state':'done'}) + action_done() AND @@ -135,10 +135,10 @@ cancel - + - (order_policy=='prepaid') + manual_invoice @@ -146,6 +146,7 @@ subflow.paid + diff --git a/addons/sale/security/ir.model.access.csv b/addons/sale/security/ir.model.access.csv index 4d00f8bb212..504aa76a233 100644 --- a/addons/sale/security/ir.model.access.csv +++ b/addons/sale/security/ir.model.access.csv @@ -1,6 +1,6 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_sale_shop,sale.shop,model_sale_shop,base.group_user,1,0,0,0 access_sale_order,sale.order,model_sale_order,base.group_sale_salesman,1,1,1,0 +access_sale_shop,sale.shop,model_sale_shop,base.group_user,1,0,0,0 access_sale_order_line,sale.order.line,model_sale_order_line,base.group_sale_salesman,1,1,1,1 access_sale_order_line_accountant,sale.order.line accountant,model_sale_order_line,account.group_account_user,1,1,0,0 access_account_invoice_tax_salesman,account_invoice_tax salesman,account.model_account_invoice_tax,base.group_sale_salesman,1,1,1,0 diff --git a/addons/sale/security/sale_security.xml b/addons/sale/security/sale_security.xml index 8b64b360435..6dd9492394c 100644 --- a/addons/sale/security/sale_security.xml +++ b/addons/sale/security/sale_security.xml @@ -51,7 +51,7 @@ - + @@ -73,7 +73,7 @@ ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] - + diff --git a/addons/sale/test/cancel_order.yml b/addons/sale/test/cancel_order.yml index 71f6d404516..2f0c1a61120 100644 --- a/addons/sale/test/cancel_order.yml +++ b/addons/sale/test/cancel_order.yml @@ -1,19 +1,31 @@ - In order to test the cancel sale order. - First I confirm order. + I confirm order. - !workflow {model: sale.order, action: order_confirm, ref: sale_order_8} - + I check state of order in 'Sale Order'. - !assert {model: sale.order, id: sale_order_8, string: Sale order should be In Progress state}: - - state == 'progress' + - state == 'manual' - - I check that Invoice should be created. + I check that Invoice should not be created. - !python {model: sale.order}: | sale_order = self.browse(cr, uid, ref("sale_order_8")) - assert len(sale_order.invoice_ids) == True, "Invoice should be created." + assert len(sale_order.invoice_ids) == False, "Invoice should not be created." + +- + I create advance invoice. +- + !python {model: sale.advance.payment.inv}: | + ctx = context.copy() + ctx.update({"active_model": 'sale.order', "active_ids": [ref("sale_order_8")], "active_id":ref("sale.sale_order_8")}) + order_line = self.pool.get('sale.order.line').browse(cr, uid, ref("sale_order_line_20"), context=context) + pay_id = self.create(cr, uid, {'advance_payment_method': 'fixed', 'product_id': order_line.product_id.id, 'amount': order_line.price_subtotal, 'qtty': order_line.product_uom_qty}) + self.create_invoices(cr, uid, [pay_id], context=ctx) + - To cancel the sale order from Invoice Exception, I have to cancel the invoice of sale order. - diff --git a/addons/sale/test/delete_order.yml b/addons/sale/test/delete_order.yml index 751505237b6..3dbb2cb4033 100644 --- a/addons/sale/test/delete_order.yml +++ b/addons/sale/test/delete_order.yml @@ -10,5 +10,5 @@ I make duplicate order and delete. - !python {model: sale.order}: | - id = self.copy(cr, uid, ref('sale_order_1')) + id = self.copy(cr, uid, ref('sale_order_2')) self.unlink(cr, uid, [id]) diff --git a/addons/sale/test/edi_sale_order.yml b/addons/sale/test/edi_sale_order.yml index 2469581e070..9245cf35520 100644 --- a/addons/sale/test/edi_sale_order.yml +++ b/addons/sale/test/edi_sale_order.yml @@ -11,13 +11,13 @@ product_uom_qty: 1.0 product_uom: 1 price_unit: 150.0 - name: 'Basic pc' + name: 'PC Assemble SC234' order_line: - product_id: product.product_product_5 product_uom_qty: 10.0 product_uom: 1 price_unit: 200.0 - name: 'Medium pc' + name: 'PC Assemble + Custom (PC on Demand)' - I confirm the sale order - @@ -72,10 +72,10 @@ "__model": "purchase.order.line", "__import_module": "sale", "__import_model": "sale.order.line", - "name": "Basic PC", + "name": "PC Assemble SC234", "date_planned": "2011-09-30", "price_unit": 150.0, - "product_id": ["product:5af1272e-dd26-11e0-b65e-701a04e25543.product_product_3", "[PC1] Basic PC"], + "product_id": ["product:5af1272e-dd26-11e0-b65e-701a04e25543.product_product_3", "[PCSC234] PC Assemble SC234"], "product_qty": 1.0, "product_uom": ["product:5af1272e-dd26-11e0-b65e-701a04e25543.product_uom_unit", "Unit"], }, @@ -85,10 +85,10 @@ "__model": "purchase.order.line", "__import_module": "sale", "__import_model": "sale.order.line", - "name": "Medium PC", + "name": "PC on Demand", "date_planned": "2011-09-15", "price_unit": 100.0, - "product_id": ["product:5af1272e-dd26-11e0-b65e-701a04e25543.product_product_5", "[PC3] Medium PC"], + "product_id": ["product:5af1272e-dd26-11e0-b65e-701a04e25543.product_product_5", "[PC-DEM] PC on Demand"], "product_qty": 2.0, "product_uom": ["product:5af1272e-dd26-11e0-b65e-701a04e25543.product_uom_unit", "Unit"], }], @@ -107,13 +107,15 @@ assert order_new.amount_untaxed == 350, "Untaxed amount is wrong" assert len(order_new.order_line) == 2, "Sale order lines mismatch" for sale_line in order_new.order_line: - if sale_line.name == 'Basic PC': - # assert sale_line.delay == 18 , "incorrect delay: got %s, expected 18"%(sale_line.delay,) + + if sale_line.name == 'PC Assemble SC234': + #assert sale_line.delay == 18 , "incorrect delay: got %s, expected 18"%(sale_line.delay,) assert sale_line.product_uom.name == "Unit" , "uom is not same" assert sale_line.price_unit == 150 , "unit price is not same, got %s, expected 150"%(sale_line.price_unit,) assert sale_line.product_uom_qty == 1 , "product qty is not same" - elif sale_line.name == 'Medium PC': - # assert sale_line.delay == 3 , "incorrect delay: got %s, expected 3"%(sale_line.delay,) + + elif sale_line.name == 'PC on Demand': + #assert sale_line.delay == 3 , "incorrect delay: got %s, expected 3"%(sale_line.delay,) assert sale_line.product_uom.name == "Unit" , "uom is not same" assert sale_line.price_unit == 100 , "unit price is not same, got %s, expected 100"%(sale_line.price_unit,) assert sale_line.product_uom_qty == 2 , "product qty is not same" diff --git a/addons/sale_stock/test/manual_order_policy.yml b/addons/sale/test/manual_order_policy.yml similarity index 74% rename from addons/sale_stock/test/manual_order_policy.yml rename to addons/sale/test/manual_order_policy.yml index 4c200e0fa5f..731a723d068 100644 --- a/addons/sale_stock/test/manual_order_policy.yml +++ b/addons/sale/test/manual_order_policy.yml @@ -1,27 +1,27 @@ - I confirm the Quotation with "Deliver & invoice on demand". - - !workflow {model: sale.order, action: order_confirm, ref: sale.sale_order_7} + !workflow {model: sale.order, action: order_confirm, ref: sale_order_7} - I check that Invoice should not created. - !python {model: sale.order}: | - sale_order = self.browse(cr, uid, ref("sale.sale_order_7")) + sale_order = self.browse(cr, uid, ref("sale_order_7")) assert len(sale_order.invoice_ids) == False, "Invoice should not created." - I create advance invoice. - !python {model: sale.advance.payment.inv}: | ctx = context.copy() - ctx.update({"active_model": 'sale.order', "active_ids": [ref("sale.sale_order_7")], "active_id":ref("sale.sale_order_7")}) - order_line = self.pool.get('sale.order.line').browse(cr, uid, ref("sale.sale_order_line_16"), context=context) + ctx.update({"active_model": 'sale.order', "active_ids": [ref("sale_order_7")], "active_id":ref("sale_order_7")}) + order_line = self.pool.get('sale.order.line').browse(cr, uid, ref("sale_order_line_16"), context=context) pay_id = self.create(cr, uid, {'advance_payment_method': 'fixed', 'product_id': order_line.product_id.id, 'amount': order_line.price_subtotal, 'qtty': order_line.product_uom_qty}) self.create_invoices(cr, uid, [pay_id], context=ctx) - I check Invoice which made advance - !python {model: sale.order}: | - order = self.browse(cr, uid, ref('sale.sale_order_7')) + order = self.browse(cr, uid, ref('sale_order_7')) assert order.invoice_ids, "Invoice should be created after make advance invoice." - I create manual Invoice for order. @@ -31,7 +31,7 @@ - !python {model: sale.make.invoice}: | ctx = context.copy() - ctx = ctx.update({"active_model": 'sale.order', "active_ids": [ref("sale.sale_order_7")], "active_id":ref("sale.sale_order_7")}) + ctx = ctx.update({"active_model": 'sale.order', "active_ids": [ref("sale_order_7")], "active_id":ref("sale_order_7")}) self.make_invoices(cr, uid, [ref("sale_make_invoice_1")], context) - @@ -39,13 +39,13 @@ - !python {model: sale.order.line.make.invoice}: | ctx = context.copy() - ctx.update({"active_model": 'sale.order.line', "active_ids": [ref("sale.sale_order_line_17")], "active_id":ref("sale.sale_order_line_17")}) + ctx.update({"active_model": 'sale.order.line', "active_ids": [ref("sale_order_line_17")], "active_id":ref("sale_order_line_17")}) self.make_invoices(cr, uid, [], context=ctx) - I check Invoice which made from sale order line. - !python {model: sale.order.line}: | - line = self.browse(cr, uid, ref('sale.sale_order_line_17')) + line = self.browse(cr, uid, ref('sale_order_line_17')) assert line.invoiced, "Line is not invoiced." assert line.invoice_lines, "Invoice line should be created." - @@ -56,7 +56,7 @@ - !python {model: sale.make.invoice}: | ctx = context.copy() - ctx = ctx.update({"active_model": 'sale.order', "active_ids": [ref("sale.sale_order_7")], "active_id":ref("sale.sale_order_7")}) + ctx = ctx.update({"active_model": 'sale.order', "active_ids": [ref("sale_order_7")], "active_id":ref("sale_order_7")}) self.make_invoices(cr, uid, [ref("sale_make_invoice_1")], context) - I open the Invoice. @@ -64,7 +64,7 @@ !python {model: sale.order}: | import netsvc wf_service = netsvc.LocalService("workflow") - so = self.browse(cr, uid, ref("sale.sale_order_7")) + so = self.browse(cr, uid, ref("sale_order_7")) for invoice in so.invoice_ids: wf_service.trg_validate(uid, 'account.invoice', invoice.id, 'invoice_open', cr) - @@ -72,29 +72,19 @@ - !python {model: account.invoice}: | sale_order = self.pool.get('sale.order') - order = sale_order.browse(cr, uid, ref("sale.sale_order_7")) + order = sale_order.browse(cr, uid, ref("sale_order_7")) journal_ids = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'cash'), ('company_id', '=', order.company_id.id)], limit=1) for invoice in order.invoice_ids: invoice.pay_and_reconcile( invoice.amount_total, ref('account.cash'), ref('account.period_8'), - journal_ids[0], ref('account.cash'), + journal_ids[0], ref('account.cash'), ref('account.period_8'), journal_ids[0], name='test') - I check Invoice after do manual. - !python {model: sale.order}: | - sale_order = self.browse(cr, uid, ref("sale.sale_order_7")) + sale_order = self.browse(cr, uid, ref("sale_order_7")) assert sale_order.invoice_ids, "Invoice should be created." assert sale_order.invoiced, "Order is not invoiced." assert sale_order.state == 'manual', 'Order should be in Manual.' - -- - I set order policy "Deliver & invoice on demand" as default policy. -- - !record {model: sale.config.settings, id: sale_configuration_0}: - default_order_policy: 'manual' -- - !python {model: sale.config.settings}: | - self.execute(cr, uid, [ref("sale_configuration_0")], context=context) - diff --git a/addons/sale/wizard/__init__.py b/addons/sale/wizard/__init__.py index f243b959526..79692a5d7be 100644 --- a/addons/sale/wizard/__init__.py +++ b/addons/sale/wizard/__init__.py @@ -19,5 +19,6 @@ # ############################################################################## import sale_line_invoice - +import sale_make_invoice_advance +import sale_make_invoice # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/sale_analytic_plans/__openerp__.py b/addons/sale_analytic_plans/__openerp__.py index 621d1e4876e..df33feae578 100644 --- a/addons/sale_analytic_plans/__openerp__.py +++ b/addons/sale_analytic_plans/__openerp__.py @@ -33,9 +33,8 @@ Using this module you will be able to link analytic accounts to sales orders. 'website': 'http://www.openerp.com', 'images': ['images/sale_order_analytic_account.jpeg', 'images/sales_order_line.jpeg'], 'depends': ['sale', 'account_analytic_plans'], - 'init_xml': [], - 'update_xml': ['sale_analytic_plans_view.xml'], - 'demo_xml': [], + 'data': ['sale_analytic_plans_view.xml'], + 'demo': [], 'installable': True, 'auto_install': False, 'certificate': '0066055860861', diff --git a/addons/sale_analytic_plans/sale_analytic_plans_view.xml b/addons/sale_analytic_plans/sale_analytic_plans_view.xml index 6701ede5ae5..6c788866520 100644 --- a/addons/sale_analytic_plans/sale_analytic_plans_view.xml +++ b/addons/sale_analytic_plans/sale_analytic_plans_view.xml @@ -22,6 +22,11 @@ + + + + + sale.order.line.form2.inherit sale.order.line diff --git a/addons/sale_crm/__openerp__.py b/addons/sale_crm/__openerp__.py index f4137047fff..4846b61f624 100644 --- a/addons/sale_crm/__openerp__.py +++ b/addons/sale_crm/__openerp__.py @@ -38,14 +38,14 @@ modules. 'website': 'http://www.openerp.com', 'images': ['images/crm_statistics_dashboard.jpeg', 'images/opportunity_to_quote.jpeg'], 'depends': ['sale_stock', 'crm'], - 'init_xml': [], - 'update_xml': ['wizard/crm_make_sale_view.xml', - 'sale_crm_view.xml', - 'process/sale_crm_process.xml', - 'security/sale_crm_security.xml', - 'security/ir.model.access.csv' - ], - 'demo_xml': [], + 'data': [ + 'wizard/crm_make_sale_view.xml', + 'sale_crm_view.xml', + 'process/sale_crm_process.xml', + 'security/sale_crm_security.xml', + 'security/ir.model.access.csv' + ], + 'demo': [], 'test': ['test/sale_crm.yml'], 'installable': True, 'auto_install': True, diff --git a/addons/sale_crm/wizard/crm_make_sale.py b/addons/sale_crm/wizard/crm_make_sale.py index 6ca9ac8230f..2597c1db56c 100644 --- a/addons/sale_crm/wizard/crm_make_sale.py +++ b/addons/sale_crm/wizard/crm_make_sale.py @@ -106,7 +106,7 @@ class crm_make_sale(osv.osv_memory): case_obj.write(cr, uid, [case.id], {'ref': 'sale.order,%s' % new_id}) new_ids.append(new_id) message = _("Opportunity has been converted to the quotation %s.") % (sale_order.name) - case.message_append_note(body=message) + case.message_post(body=message) if make.close: case_obj.case_close(cr, uid, data) if not new_ids: diff --git a/addons/sale_journal/__openerp__.py b/addons/sale_journal/__openerp__.py index 6373cce1810..ee625b9c3a9 100644 --- a/addons/sale_journal/__openerp__.py +++ b/addons/sale_journal/__openerp__.py @@ -30,17 +30,19 @@ The sales journal modules allows you to categorise your sales and deliveries (pi This module is very helpful for bigger companies that works by departments. You can use journal for different purposes, some examples: +---------------------------------------------------------- * isolate sales of different departments * journals for deliveries by truck or by UPS Journals have a responsible and evolves between different status: +----------------------------------------------------------------- * draft, open, cancel, done. Batch operations can be processed on the different journals to confirm all sales at once, to validate or invoice packing. -It also supports batch invoicing methods that can be configured by partners and -sales orders, examples: +It also supports batch invoicing methods that can be configured by partners and sales orders, examples: +------------------------------------------------------------------------------------------------------- * daily invoicing * monthly invoicing @@ -50,12 +52,12 @@ Some statistics by journals are provided. 'website': 'http://www.openerp.com', 'images': ['images/invoice_type.jpeg'], 'depends': ['sale_stock'], - 'init_xml': ['sale_journal_data.xml'], - 'update_xml': [ + 'data': [ 'security/ir.model.access.csv', 'sale_journal_view.xml', + 'sale_journal_data.xml' ], - 'demo_xml': ['sale_journal_demo.xml'], + 'demo': ['sale_journal_demo.xml'], 'test': [ ], 'installable': True, 'auto_install': False, diff --git a/addons/sale_margin/__openerp__.py b/addons/sale_margin/__openerp__.py index 4e622e71b33..6cacdcda7b4 100644 --- a/addons/sale_margin/__openerp__.py +++ b/addons/sale_margin/__openerp__.py @@ -19,25 +19,25 @@ ############################################################################## { - "name": "Margins in Sales Orders", - "version":"1.0", - "category" : "Sales Management", - "description": """ + 'name': 'Margins in Sales Orders', + 'version':'1.0', + 'category' : 'Sales Management', + 'description': """ This module adds the 'Margin' on sales order. ============================================= This gives the profitability by calculating the difference between the Unit Price and Cost Price. """, - "author":"OpenERP SA", - "images":["images/sale_margin.jpeg"], - "depends":["sale_stock"], - "demo_xml":[], + 'author':'OpenERP SA', + 'images':['images/sale_margin.jpeg'], + 'depends':['sale_stock'], + 'demo':[], 'test': ['test/sale_margin.yml'], - "update_xml":["security/ir.model.access.csv","sale_margin_view.xml"], - "auto_install": False, - "installable": True, - "certificate" : "001165700015525701661", + 'data':['security/ir.model.access.csv','sale_margin_view.xml'], + 'auto_install': False, + 'installable': True, + 'certificate' : '001165700015525701661', } # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/sale_margin/test/sale_margin.yml b/addons/sale_margin/test/sale_margin.yml index 17f71807074..8038ea1aa5f 100644 --- a/addons/sale_margin/test/sale_margin.yml +++ b/addons/sale_margin/test/sale_margin.yml @@ -9,7 +9,7 @@ invoice_quantity: order name: Test_SO011 order_line: - - name: '[KEYA] Keyboard - AZERTY' + - name: '[CARD] Graphics Card' price_unit: 7.0 product_uom: product.product_uom_unit product_uom_qty: 100.0 diff --git a/addons/sale_mrp/__openerp__.py b/addons/sale_mrp/__openerp__.py index b1aed2c67b5..c93fdcc91fd 100644 --- a/addons/sale_mrp/__openerp__.py +++ b/addons/sale_mrp/__openerp__.py @@ -35,12 +35,11 @@ from sales order. It adds sales name and sales Reference on production order. 'website': 'http://www.openerp.com', 'images': ['images/SO_to_MO.jpeg'], 'depends': ['mrp', 'sale_stock'], - 'init_xml': [], - 'update_xml': [ + 'data': [ 'security/ir.model.access.csv', 'sale_mrp_view.xml', ], - 'demo_xml': [], + 'demo': [], 'test':['test/sale_mrp.yml'], 'installable': True, 'auto_install': True, diff --git a/addons/sale_order_dates/__openerp__.py b/addons/sale_order_dates/__openerp__.py index f67c7034821..7c3360f3547 100644 --- a/addons/sale_order_dates/__openerp__.py +++ b/addons/sale_order_dates/__openerp__.py @@ -29,22 +29,17 @@ Add additional date information to the sales order. =================================================== You can add the following additional dates to a sale order: +----------------------------------------------------------- * Requested Date * Commitment Date * Effective Date """, 'author': 'OpenERP SA', 'website': 'http://www.openerp.com', - 'images': ["images/sale_order_dates.jpeg"], - 'depends': ["sale_stock"], - 'init_xml': [ - ], - - 'update_xml': [ - 'sale_order_dates_view.xml', - ], - 'demo_xml': [ - ], + 'images': ['images/sale_order_dates.jpeg'], + 'depends': ['sale_stock'], + 'data': ['sale_order_dates_view.xml'], + 'demo': [], 'test': [], 'installable': True, 'auto_install': False, diff --git a/addons/sale_stock/__openerp__.py b/addons/sale_stock/__openerp__.py index 268e641cf41..ff4ef80e5ea 100644 --- a/addons/sale_stock/__openerp__.py +++ b/addons/sale_stock/__openerp__.py @@ -20,10 +20,11 @@ ############################################################################## { - 'name': 'Sale To Stock', + 'name': 'Sales and Warehouse Management', 'version': '1.0', 'category': 'Hidden', 'description': """ + 'summary': 'Quotation, Sale Orders, Delivery & Invoicing Control', This Module manage quotations and sales orders. =========================================================================== @@ -61,11 +62,9 @@ Dashboard for Sales Manager that includes: 'author': 'OpenERP SA', 'website': 'http://www.openerp.com', 'images': [], - 'depends': ['sale', 'procurement'], + 'depends': ['sale', 'stock', 'procurement'], 'init_xml': [], - 'update_xml': ['wizard/sale_make_invoice_advance.xml', - 'wizard/sale_make_invoice.xml', - 'security/sale_stock_security.xml', + 'update_xml': ['security/sale_stock_security.xml', 'security/ir.model.access.csv', 'company_view.xml', 'sale_stock_view.xml', @@ -73,15 +72,16 @@ Dashboard for Sales Manager that includes: 'res_config_view.xml', 'report/sale_report_view.xml', 'process/sale_stock_process.xml', + ], 'data': ['sale_stock_data.xml'], 'demo_xml': ['sale_stock_demo.xml'], 'test': ['test/cancel_order_sale_stock.yml', 'test/picking_order_policy.yml', - 'test/manual_order_policy.yml' + 'test/prepaid_order_policy.yml', ], 'installable': True, 'auto_install': True, } -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/sale_stock/res_config.py b/addons/sale_stock/res_config.py index b7f51afb967..73724b64999 100644 --- a/addons/sale_stock/res_config.py +++ b/addons/sale_stock/res_config.py @@ -26,6 +26,9 @@ from tools.translate import _ class sale_configuration(osv.osv_memory): _inherit = 'sale.config.settings' _columns = { + 'group_invoice_so_lines': fields.boolean('generate invoices based on the sale order', + implied_group='sale.group_invoice_so_lines', + help="To allow your salesman to make invoices for sale order lines using the menu 'Lines to Invoice'."), 'group_invoice_deli_orders': fields.boolean('generate invoices after and based on delivery orders', implied_group='sale_stock.group_invoice_deli_orders', help="To allow your salesman to make invoices for Delivery Orders using the menu 'Deliveries to Invoice'."), @@ -52,8 +55,11 @@ class sale_configuration(osv.osv_memory): help="This allows to configure and use multiple shops."), 'module_project_timesheet': fields.boolean("Project Timesheet"), 'module_project_mrp': fields.boolean("Project MRP"), - - } + } + + _defaults = { + 'default_order_policy': 'manual', + } def default_get(self, cr, uid, fields, context=None): res = super(sale_configuration, self).default_get(cr, uid, fields, context) diff --git a/addons/sale_stock/res_config_view.xml b/addons/sale_stock/res_config_view.xml index 24ece1673b3..1f5380b0f58 100644 --- a/addons/sale_stock/res_config_view.xml +++ b/addons/sale_stock/res_config_view.xml @@ -9,7 +9,11 @@ - + +
+ +
- - +
- - - -
-
-
+
+ +
diff --git a/addons/account_followup/__init__.py b/addons/account_followup/__init__.py index 395ce5475c8..4bfe3186298 100644 --- a/addons/account_followup/__init__.py +++ b/addons/account_followup/__init__.py @@ -22,6 +22,5 @@ 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 diff --git a/addons/account_followup/__openerp__.py b/addons/account_followup/__openerp__.py index 2afa0afd623..43b1c4b2859 100644 --- a/addons/account_followup/__openerp__.py +++ b/addons/account_followup/__openerp__.py @@ -55,7 +55,6 @@ Note that if you want to check the follow-up level for a given partner/account e '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': [], diff --git a/addons/account_followup/account_followup.py b/addons/account_followup/account_followup.py index ad419736c57..60499603295 100644 --- a/addons/account_followup/account_followup.py +++ b/addons/account_followup/account_followup.py @@ -20,7 +20,6 @@ ############################################################################## from osv import fields, osv -import tools class followup(osv.osv): _name = 'account_followup.followup' diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index ccecf5d6a20..c74ca5f833a 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -334,15 +334,9 @@ class account_voucher(osv.osv): } def create(self, cr, uid, vals, context=None): - 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 + voucher = super(account_voucher, self).create(cr, uid, vals, context=context) + self.create_send_note(cr, uid, [voucher], context=context) + return voucher def compute_tax(self, cr, uid, ids, context=None): tax_pool = self.pool.get('account.tax') @@ -1502,37 +1496,7 @@ account_bank_statement() 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 {} @@ -1557,11 +1521,6 @@ class account_bank_statement_line(osv.osv): ] _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'), diff --git a/addons/account_voucher/account_voucher_view.xml b/addons/account_voucher/account_voucher_view.xml index b5a1912e158..07647d02fe3 100644 --- a/addons/account_voucher/account_voucher_view.xml +++ b/addons/account_voucher/account_voucher_view.xml @@ -213,8 +213,7 @@ - - +
- + +
From d1a078687eda028c19d4119420a9b64510884c94 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Thu, 20 Sep 2012 19:22:49 +0200 Subject: [PATCH 151/195] [IMP] sale: help tooltip on state field of sale.order bzr revid: qdp-launchpad@openerp.com-20120920172249-kb6xene37ygwxawc --- addons/sale/sale.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index c4d1453552a..0bb85718f43 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -165,9 +165,8 @@ class sale_order(osv.osv): _columns = { 'name': fields.char('Order Reference', size=64, required=True, readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}, select=True), - 'shop_id': fields.many2one('sale.shop', 'Shop', required=True, readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}), + 'shop_id': fields.many2one('sale.shop', 'Shop', required=True, readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}), 'origin': fields.char('Source Document', size=64, help="Reference of the document that generated this sales order request."), - 'client_order_ref': fields.char('Customer Reference', size=64), 'state': fields.selection([ ('draft', 'Draft Quotation'), @@ -175,10 +174,10 @@ class sale_order(osv.osv): ('cancel', 'Cancelled'), ('waiting_date', 'Waiting Schedule'), ('progress', 'Sale Order'), - ('manual', 'Sale to Invoice'), + ('manual', 'Sale to Invoice'), ('invoice_except', 'Invoice Exception'), ('done', 'Done'), - ], 'Status', readonly=True, help="Gives the state of the quotation or sales order. \nThe exception state is automatically set when a cancel operation occurs in the invoice validation (Invoice Exception). \nThe 'Waiting Schedule' state is set when the invoice is confirmed but waiting for the scheduler to run on the order date.", select=True), + ], 'Status', readonly=True, help="Gives the state of the quotation or sales order. \nThe exception state is automatically set when a cancel operation occurs in the processing of a document linked to the sale order. \nThe 'Waiting Schedule' state is set when the invoice is confirmed but waiting for the scheduler to run on the order date.", select=True), 'date_order': fields.date('Date', required=True, readonly=True, select=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}), 'create_date': fields.datetime('Creation Date', readonly=True, select=True, help="Date on which sales order is created."), 'date_confirm': fields.date('Confirmation Date', readonly=True, select=True, help="Date on which sales order is confirmed."), From ff2c5ad2347677a61b785038edc7b5b013172b8e Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Fri, 21 Sep 2012 09:49:05 +0200 Subject: [PATCH 152/195] [IMP] better error message bzr revid: fp@tinyerp.com-20120921074905-p7t8p96va5c49nte --- addons/product/product.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/product/product.py b/addons/product/product.py index fc90c72c693..14f28450c9b 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -609,7 +609,7 @@ class product_product(osv.osv): return res - _constraints = [(_check_ean_key, 'You provided an invalid "EAN13 Barcode" reference. You may use the internal reference field instead.', ['ean13'])] + _constraints = [(_check_ean_key, 'You provided an invalid "EAN13 Barcode" reference. You may use the "Internal Reference" field instead.', ['ean13'])] def on_order(self, cr, uid, ids, orderline, quantity): pass From bc8250b428d41aacd84d8d829e1a4e578a96cd69 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Fri, 21 Sep 2012 09:58:41 +0200 Subject: [PATCH 153/195] [IMP] usability product form bzr revid: fp@tinyerp.com-20120921075841-qzmqr64ucm2yhdsc --- addons/product/product_view.xml | 18 ++++++++++-------- addons/stock/product_view.xml | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/addons/product/product_view.xml b/addons/product/product_view.xml index d04e6f17fe8..c08bbc412e3 100644 --- a/addons/product/product_view.xml +++ b/addons/product/product_view.xml @@ -110,23 +110,25 @@ - +

When you sell this service, nothing special will be trigered - to deliver the customer. + to deliver the customer, as you set the procurement method as + 'Make to Stock'.

- When you sell this product, OpenERP will use the available inventory - for the delivery order. -
+ When you sell this product, OpenERP will use the available + inventory for the delivery order. +

If there are not enough quantities available, the delivery order - will wait for new products. You should create others rules - (orderpoints, manual purchase orders) to fulfill the inventory. + will wait for new products. To fulfill the inventory, you should + create others rules like orderpoints.

When you sell this product, a delivery order will be created. OpenERP will consider that the required quantities are always - available as it's a consumable (the stock on hand may become negative). + available as it's a consumable (as a result of this, the quantity + on hand may become negative).

diff --git a/addons/stock/product_view.xml b/addons/stock/product_view.xml index 2e0eef44da9..a7dff7fcc0d 100644 --- a/addons/stock/product_view.xml +++ b/addons/stock/product_view.xml @@ -56,7 +56,7 @@ product.product - +