From cf3f05d58b13cd6e32ba2ebcb1c710de078e70af Mon Sep 17 00:00:00 2001 From: "Vidhin Mehta (OpenERP)" Date: Fri, 19 Oct 2012 11:10:52 +0530 Subject: [PATCH 01/29] [IMP]percentage in title. bzr revid: vme@tinyerp.com-20121019054052-valignwzrc4jao4v --- addons/web/static/src/js/chrome.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 3cb4437d1c3..62f55c439cf 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -236,6 +236,9 @@ instance.web.Loading = instance.web.Widget.extend({ this._super(parent); this.count = 0; this.blocked_ui = false; + this.old_title = document.title; + this.request_count = 0; + this.response_count = 0; this.session.on("request", this, this.request_call); this.session.on("response", this, this.response_call); this.session.on("response_failed", this, this.response_call); @@ -245,13 +248,19 @@ instance.web.Loading = instance.web.Widget.extend({ this._super(); }, request_call: function() { + this.request_count += 1; this.on_rpc_event(1); }, response_call: function() { + this.response_count += 1; this.on_rpc_event(-1); }, + loading_title:function(percentage){ + document.title = percentage + "% processed |" + this.old_title; + }, on_rpc_event : function(increment) { var self = this; + this.loading_title(parseInt(this.response_count * 100 / this.request_count)) if (!this.count && increment === 1) { // Block UI after 3s this.long_running_timer = setTimeout(function () { @@ -271,6 +280,7 @@ instance.web.Loading = instance.web.Widget.extend({ this.getParent().$el.addClass('oe_wait'); } else { this.count = 0; + document.title = this.old_title; clearTimeout(this.long_running_timer); // Don't unblock if blocked by somebody else if (self.blocked_ui) { From 731ca3aaa3738c75f8ba724d816d7840f0f381ea Mon Sep 17 00:00:00 2001 From: "Vidhin Mehta (OpenERP)" Date: Tue, 23 Oct 2012 14:08:56 +0530 Subject: [PATCH 02/29] [IMP]testing for chrome this code from runbot. bzr revid: vme@tinyerp.com-20121023083856-5jgq3dtdmp3e1m40 --- addons/web/static/src/js/chrome.js | 52 ++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 62f55c439cf..fd3434e2105 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -242,6 +242,58 @@ instance.web.Loading = instance.web.Widget.extend({ this.session.on("request", this, this.request_call); this.session.on("response", this, this.response_call); this.session.on("response_failed", this, this.response_call); + this.draw_favicon(50); + }, + draw_favicon: function(percentage){ + var self = this; + var canvas = this.get_canvas(); + var faviconImage = new Image(); + var context = canvas.getContext("2d"); + faviconImage.onload = function() { + console.log("Image Loaded"); + if (context) { + context.clearRect(0, 0, 16, 16); + // Draw shadow + context.beginPath(); + context.moveTo(canvas.width / 2, canvas.height / 2); + context.arc(canvas.width / 2, canvas.height / 2, Math.min(canvas.width / 2, canvas.height / 2), 0, Math.PI * 2, false); + context.fillStyle = "red"; + context.fill(); + // Draw background + context.beginPath(); + context.moveTo(canvas.width / 2, canvas.height / 2); + context.arc(canvas.width / 2, canvas.height / 2, Math.min(canvas.width / 2, canvas.height / 2) - 2, 0, Math.PI * 2, false); + context.fillStyle = "yellow"; + context.fill(); + // Draw pie + if (percentage > 0) { + context.beginPath(); + context.moveTo(canvas.width / 2, canvas.height / 2); + context.arc(canvas.width / 2, canvas.height / 2, Math.min(canvas.width / 2, canvas.height / 2) - 2, (-0.5) * Math.PI, (-0.5 + 2 * percentage / 100) * Math.PI, false); + context.lineTo(canvas.width / 2, canvas.height / 2); + context.fillStyle = "white"; + context.fill(); + } + var link = document.createElement('link'); + link.type = 'image/x-icon'; + link.rel = 'icon'; + link.href = canvas.toDataURL(); + var src = $('link[type="image/x-icon"]').attr("href"); + if (!src.match(/^data/)) { + faviconImage.crossOrigin = 'anonymous'; + } + document.getElementsByTagName('head')[0].appendChild(link); + console.log("canvas to url",canvas.toDataURL()); + } + } + faviconImage.src = $('link[type="image/x-icon"]').attr("href"); + console.log("favicon",faviconImage); + }, + get_canvas: function(){ + canvas = document.createElement("canvas"); + canvas.width = 16; + canvas.height = 16; + return canvas; }, destroy: function() { this.on_rpc_event(-this.count); From 28706d4967c5ea15032383b5bd5afa8130a25a62 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Wed, 24 Oct 2012 10:33:24 +0200 Subject: [PATCH 03/29] [FIX] stock, picking.in: fixed crash at the record creation bzr revid: qdp-launchpad@openerp.com-20121024083324-wog22at3yamadrsd --- addons/stock/stock.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 765599aa842..3b40dfb1dfc 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -618,7 +618,7 @@ class stock_picking(osv.osv): def create(self, cr, user, vals, context=None): if ('name' not in vals) or (vals.get('name')=='/'): - seq_obj_name = 'stock.picking.' + vals['type'] + seq_obj_name = self._name vals['name'] = self.pool.get('ir.sequence').get(cr, user, seq_obj_name) new_id = super(stock_picking, self).create(cr, user, vals, context) if new_id: From b526278aa1182f2f6d191a1a94a0102be9a3e7ff Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Wed, 24 Oct 2012 10:58:42 +0200 Subject: [PATCH 04/29] [IMP] sale_crm depends on sale, not sale_stock bzr revid: qdp-launchpad@openerp.com-20121024085842-98edk5c5twqi1rqw --- addons/sale_crm/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale_crm/__openerp__.py b/addons/sale_crm/__openerp__.py index 88608af8922..82e267337f9 100644 --- a/addons/sale_crm/__openerp__.py +++ b/addons/sale_crm/__openerp__.py @@ -37,7 +37,7 @@ modules. 'author': 'OpenERP SA', 'website': 'http://www.openerp.com', 'images': ['images/crm_statistics_dashboard.jpeg', 'images/opportunity_to_quote.jpeg'], - 'depends': ['sale_stock', 'crm'], + 'depends': ['sale', 'crm'], 'data': [ 'wizard/crm_make_sale_view.xml', 'sale_crm_view.xml', From e21795c3a10b4dcabb5155e7e02682a344b8f601 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Wed, 24 Oct 2012 11:06:25 +0200 Subject: [PATCH 05/29] [FIX] sale_margin depends on sale, not sale_stock bzr revid: qdp-launchpad@openerp.com-20121024090625-opgy3jr0ejlwtnq5 --- addons/sale_margin/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale_margin/__openerp__.py b/addons/sale_margin/__openerp__.py index bb2f78f409c..badb87d3628 100644 --- a/addons/sale_margin/__openerp__.py +++ b/addons/sale_margin/__openerp__.py @@ -31,7 +31,7 @@ Price and Cost Price. """, 'author':'OpenERP SA', 'images':['images/sale_margin.jpeg'], - 'depends':['sale_stock'], + 'depends':['sale'], 'demo':['sale_margin_demo.xml'], 'test': ['test/sale_margin.yml'], 'data':['security/ir.model.access.csv','sale_margin_view.xml'], From 4cf738290511f54238240b928b63e67def16a312 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Wed, 24 Oct 2012 11:12:49 +0200 Subject: [PATCH 06/29] [IMP] account_voucher: improved error messages bzr revid: qdp-launchpad@openerp.com-20121024091249-b12vibq7h0fi41cj --- addons/account_voucher/account_voucher.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 3ae421308b5..37a2343b72a 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -988,11 +988,11 @@ class account_voucher(osv.osv): if amount_residual > 0: account_id = line.voucher_id.company_id.expense_currency_exchange_account_id if not account_id: - raise osv.except_osv(_('Warning!'),_("First you have to configure the 'Expense Currency Rate' on the company, then create accounting entry for currency rate difference.")) + raise osv.except_osv(_('Insufficient Configuration!'),_("You should configure the 'Loss Exchange Rate Account' in the accounting settings, to manage automatically the booking of accounting entries related to differences between exchange rates.")) else: account_id = line.voucher_id.company_id.income_currency_exchange_account_id if not account_id: - raise osv.except_osv(_('Warning!'),_("First you have to configure the 'Income Currency Rate' on the company, then create accounting entry for currency rate difference.")) + raise osv.except_osv(_('Insufficient Configuration!'),_("You should configure the 'Gain Exchange Rate Account' in the accounting settings, to manage automatically the booking of accounting entries related to differences between exchange rates.")) # Even if the amount_currency is never filled, we need to pass the foreign currency because otherwise # the receivable/payable account may have a secondary currency, which render this field mandatory account_currency_id = company_currency <> current_currency and current_currency or False From ff6966da8b3efab5a7da14a089f5b6f510e14a90 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Wed, 24 Oct 2012 11:13:13 +0200 Subject: [PATCH 07/29] [IMP] account: added an option to enable/disable the check_total feature on supplier invoices bzr revid: qdp-launchpad@openerp.com-20121024091313-s6k3ekmsen5ntez4 --- addons/account/account_invoice.py | 7 +++++-- addons/account/account_invoice_view.xml | 1 + addons/account/res_config.py | 2 ++ addons/account/res_config_view.xml | 4 ++++ addons/account/security/account_security.xml | 5 +++++ 5 files changed, 17 insertions(+), 2 deletions(-) diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index 0508a7cadfe..d3d37907538 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -865,8 +865,11 @@ class account_invoice(osv.osv): self.check_tax_lines(cr, uid, inv, compute_taxes, ait_obj) # I disabled the check_total feature - #if inv.type in ('in_invoice', 'in_refund') and abs(inv.check_total - inv.amount_total) >= (inv.currency_id.rounding/2.0): - # raise osv.except_osv(_('Bad total !'), _('Please verify the price of the invoice !\nThe real total does not match the computed total.')) + group_check_total_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account', 'group_supplier_inv_check_total')[1] + group_check_total = self.pool.get('res.groups').browse(cr, uid, group_check_total_id, context=context) + if group_check_total and uid in [x.id for x in group_check_total.users]: + if (inv.type in ('in_invoice', 'in_refund') and abs(inv.check_total - inv.amount_total) >= (inv.currency_id.rounding/2.0)): + raise osv.except_osv(_('Bad total !'), _('Please verify the price of the invoice !\nThe encoded total does not match the computed total.')) if inv.payment_term: total_fixed = total_percent = 0 diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index 5ed373456f3..2699fffaacc 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -186,6 +186,7 @@ + diff --git a/addons/account/res_config.py b/addons/account/res_config.py index 17df4377548..ab271eabc34 100644 --- a/addons/account/res_config.py +++ b/addons/account/res_config.py @@ -120,6 +120,8 @@ class account_config_settings(osv.osv_memory): 'group_analytic_accounting': fields.boolean('Analytic accounting', implied_group='analytic.group_analytic_accounting', help="Allows you to use the analytic accounting."), + 'group_check_supplier_invoice_total': fields.boolean('Check the Total of Supplier Invoices', + implied_group="account.group_supplier_inv_check_total"), } def _default_company(self, cr, uid, context=None): diff --git a/addons/account/res_config_view.xml b/addons/account/res_config_view.xml index 728eefe8078..d4bafca41be 100644 --- a/addons/account/res_config_view.xml +++ b/addons/account/res_config_view.xml @@ -220,6 +220,10 @@