From f96a03247b371c4d2e9317a46d645a4b66e2f1fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ana=C3=ABl=20Closson?= Date: Thu, 22 May 2014 09:26:40 +0200 Subject: [PATCH 01/10] [FIX] stock: auto_validate move not set to done when multiple parent move set to done at the same time - opw 607970 --- 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 d2d5ba3fab1..64a43852ad4 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -2413,7 +2413,7 @@ class stock_move(osv.osv): # Downstream move should only be triggered if this move is the last pending upstream move other_upstream_move_ids = self.search(cr, uid, [('id','!=',move.id),('state','not in',['done','cancel']), ('move_dest_id','=',move.move_dest_id.id)], context=context) - if not other_upstream_move_ids: + if not set(other_upstream_move_ids) - set(move_ids): self.write(cr, uid, [move.id], {'move_history_ids': [(4, move.move_dest_id.id)]}) if move.move_dest_id.state in ('waiting', 'confirmed'): self.force_assign(cr, uid, [move.move_dest_id.id], context=context) From 41c5ceb8ebb95c1b4e98d8dd1f12b8e547a24b1d Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 27 May 2014 17:56:30 +0200 Subject: [PATCH 02/10] [FIX] stock: clean previous commit --- addons/stock/stock.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 64a43852ad4..4c45de266d7 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -2411,9 +2411,9 @@ class stock_move(osv.osv): picking_ids.append(move.picking_id.id) if move.move_dest_id.id and (move.state != 'done'): # Downstream move should only be triggered if this move is the last pending upstream move - other_upstream_move_ids = self.search(cr, uid, [('id','!=',move.id),('state','not in',['done','cancel']), + other_upstream_move_ids = self.search(cr, uid, [('id','not in',move_ids),('state','not in',['done','cancel']), ('move_dest_id','=',move.move_dest_id.id)], context=context) - if not set(other_upstream_move_ids) - set(move_ids): + if not other_upstream_move_ids: self.write(cr, uid, [move.id], {'move_history_ids': [(4, move.move_dest_id.id)]}) if move.move_dest_id.state in ('waiting', 'confirmed'): self.force_assign(cr, uid, [move.move_dest_id.id], context=context) From 65d7cc524d9f3a5dc833cb483ccaaf86fab4819d Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 28 May 2014 18:00:11 +0200 Subject: [PATCH 03/10] [FIX] purchase: Do not allow to delete a purchase order line which is validated This restriction behavior copied from the sale.order model Moreover, the purchase.order lines state were not set to cancel when the purchase order was cancelled. This is now the case, this behavior is also coped from the sale.order model When the purchase order is reset to draft, we also reset the order lines state to draft --- addons/purchase/purchase.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 6767f9185ac..d258eee7431 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -499,6 +499,8 @@ class purchase_order(osv.osv): if not len(ids): return False self.write(cr, uid, ids, {'state':'draft','shipped':0}) + for purchase in self.browse(cr, uid, ids, context=context): + self.pool['purchase.order.line'].write(cr, uid, [l.id for l in purchase.order_line], {'state': 'draft'}) wf_service = netsvc.LocalService("workflow") for p_id in ids: # Deleting the existing instance of workflow for PO @@ -596,6 +598,8 @@ class purchase_order(osv.osv): _('You must first cancel all receptions related to this purchase order.')) if inv: wf_service.trg_validate(uid, 'account.invoice', inv.id, 'invoice_cancel', cr) + self.pool['purchase.order.line'].write(cr, uid, [l.id for l in purchase.order_line], + {'state': 'cancel'}) self.write(cr,uid,ids,{'state':'cancel'}) for (id, name) in self.name_get(cr, uid, ids): @@ -901,6 +905,8 @@ class purchase_order_line(osv.osv): def unlink(self, cr, uid, ids, context=None): procurement_ids_to_cancel = [] for line in self.browse(cr, uid, ids, context=context): + if line.state not in ['draft', 'cancel']: + raise osv.except_osv(_('Invalid Action!'), _('Cannot delete a purchase order line which is in state \'%s\'.') %(line.state,)) if line.move_dest_id: procurement_ids_to_cancel.extend(procurement.id for procurement in line.move_dest_id.procurements) if procurement_ids_to_cancel: From 3f6f43214ff363e3f39160828ca4e6dfa80128dd Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 28 May 2014 18:17:33 +0200 Subject: [PATCH 04/10] [FIX] replace .bzrignore by .gitignore, as we are now working with git --- .bzrignore | 21 --------------------- .gitignore | 30 ++++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 21 deletions(-) delete mode 100644 .bzrignore create mode 100644 .gitignore diff --git a/.bzrignore b/.bzrignore deleted file mode 100644 index e7618c7b0ce..00000000000 --- a/.bzrignore +++ /dev/null @@ -1,21 +0,0 @@ -.*.swp -.bzrignore -.idea -.project -.pydevproject -.ropeproject -.settings -.DS_Store -openerp/addons/* -openerp/filestore* -.Python -*.pyc -*.pyo -bin/* -build/ -include/ -lib/ -share/ -doc/_build/* -win32/*.bat -win32/meta.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000000..7828a605ef0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,30 @@ +# sphinx build directories +_build/ + +# dotfiles +.* +!.gitignore +# compiled python files +*.py[co] +# setup.py egg_info +*.egg-info +# emacs backup files +*~ +# hg stuff +*.orig +status +# odoo filestore +openerp/filestore +# generated for windows installer? +install/win32/*.bat +install/win32/meta.py + +# various virtualenv +/bin/ +/build/ +/dist/ +/include/ +/lib/ +/man/ +/share/ +/src/ From 310ecb0d60123094bdc1da6d7915e71749a1e480 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Quenot Date: Wed, 28 May 2014 15:45:29 +0200 Subject: [PATCH 05/10] Fix detection of MIME type in message_parse() Be careful, content-type may contain tricky content like in the following example so test the MIME type with startswith() Content-Type: multipart/related; boundary="_004_3f1e4da175f349248b8d43cdeb9866f1AMSPR06MB343eurprd06pro_"; type="text/html" --- addons/mail/mail_thread.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index 90ae3cf0aa3..942daddd439 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -780,7 +780,14 @@ class mail_thread(osv.AbstractModel): body = u'' if save_original: attachments.append(('original_email.eml', message.as_string())) - if not message.is_multipart() or 'text/' in message.get('content-type', ''): + + # Be careful, content-type may contain tricky content like in the + # following example so test the MIME type with startswith() + # + # Content-Type: multipart/related; + # boundary="_004_3f1e4da175f349248b8d43cdeb9866f1AMSPR06MB343eurprd06pro_"; + # type="text/html" + if not message.is_multipart() or message.get('content-type', '').startswith("text/"): encoding = message.get_content_charset() body = message.get_payload(decode=True) body = tools.ustr(body, encoding, errors='replace') From a7a51cf55d9bd514328e23e3af6f9dac6d57d532 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 2 Jun 2014 12:57:57 +0200 Subject: [PATCH 06/10] [FIX] base: security, group settings is authorized to alter ir.config_parameter --- openerp/addons/base/security/ir.model.access.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/openerp/addons/base/security/ir.model.access.csv b/openerp/addons/base/security/ir.model.access.csv index e17ffb314e1..5e288903629 100644 --- a/openerp/addons/base/security/ir.model.access.csv +++ b/openerp/addons/base/security/ir.model.access.csv @@ -112,6 +112,7 @@ "access_multi_company_default manager","multi_company_default Manager","model_multi_company_default","group_erp_manager",1,1,1,1 "access_ir_filter all","ir_filters all","model_ir_filters",,1,1,1,1 "access_ir_config_parameter","ir_config_parameter","model_ir_config_parameter",,1,0,0,0 +"access_ir_config_parameter","ir_config_parameter","model_ir_config_parameter","group_system",1,1,1,1 "access_ir_mail_server","ir_mail_server","model_ir_mail_server","group_system",1,1,1,1 "access_ir_actions_client","ir_actions_client all","model_ir_actions_client",,1,0,0,0 "access_ir_needaction_mixin","ir_needaction_mixin","model_ir_needaction_mixin",,1,1,1,1 From e61fb4d80afb7b5cdf1db99a51129693c450f49b Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 2 Jun 2014 13:00:36 +0200 Subject: [PATCH 07/10] [FIX] base: security, do not override basic ir_config_paramter ACL --- openerp/addons/base/security/ir.model.access.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/addons/base/security/ir.model.access.csv b/openerp/addons/base/security/ir.model.access.csv index 5e288903629..3fa980f4368 100644 --- a/openerp/addons/base/security/ir.model.access.csv +++ b/openerp/addons/base/security/ir.model.access.csv @@ -112,7 +112,7 @@ "access_multi_company_default manager","multi_company_default Manager","model_multi_company_default","group_erp_manager",1,1,1,1 "access_ir_filter all","ir_filters all","model_ir_filters",,1,1,1,1 "access_ir_config_parameter","ir_config_parameter","model_ir_config_parameter",,1,0,0,0 -"access_ir_config_parameter","ir_config_parameter","model_ir_config_parameter","group_system",1,1,1,1 +"access_ir_config_parameter_system","ir_config_parameter_system","model_ir_config_parameter","group_system",1,1,1,1 "access_ir_mail_server","ir_mail_server","model_ir_mail_server","group_system",1,1,1,1 "access_ir_actions_client","ir_actions_client all","model_ir_actions_client",,1,0,0,0 "access_ir_needaction_mixin","ir_needaction_mixin","model_ir_needaction_mixin",,1,1,1,1 From 6e5bef9bd2b2f4644d1c10b01e8228fd29665bdd Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 2 Jun 2014 18:00:25 +0200 Subject: [PATCH 08/10] [FIX] calendar: avoid double popup, opw 606297 Some browsers (e.g. chrome) trigger onEmptyClick as well as onBeforeLightbox during drag&drop which calls two slow_create calls (and two popups). Workaround to kill the second one. --- addons/web_calendar/static/src/js/calendar.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/addons/web_calendar/static/src/js/calendar.js b/addons/web_calendar/static/src/js/calendar.js index f7f08c3f6e3..f2cc0f74fcd 100644 --- a/addons/web_calendar/static/src/js/calendar.js +++ b/addons/web_calendar/static/src/js/calendar.js @@ -57,6 +57,7 @@ instance.web_calendar.CalendarView = instance.web.View.extend({ this.range_stop = null; this.update_range_dates(Date.today()); this.selected_filters = []; + this.is_slow_open = false; }, view_loading: function(r) { return this.load_calendar(r); @@ -465,6 +466,13 @@ instance.web_calendar.CalendarView = instance.web.View.extend({ }, slow_create: function(event_id, event_obj) { var self = this; + // Workaround, some browsers trigger onEmptyClick as well as onBeforeLightbox + // during drag&drop which calls two slow_create calls, kills the second one + if (this.is_slow_open) { + scheduler.deleteEvent(event_id); + return; + } + this.is_slow_open = true; if (this.current_mode() === 'month') { event_obj['start_date'].addHours(8); if (event_obj._length === 1) { @@ -487,6 +495,7 @@ instance.web_calendar.CalendarView = instance.web.View.extend({ view_id: pop_infos.view_id, }); pop.on('closed', self, function() { + this.is_slow_open = false; if (!something_saved) { scheduler.deleteEvent(event_id); } From 7a157dd35e414968282596cb6e0cf1c09da249ec Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Tue, 3 Jun 2014 17:12:07 +0200 Subject: [PATCH 09/10] [FIX] delivery: allow to add delivery method in quotation if quotation in quotation sent stage opw-607920 --- addons/delivery/sale.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/delivery/sale.py b/addons/delivery/sale.py index da5e8fd3fd6..d2916eb2085 100644 --- a/addons/delivery/sale.py +++ b/addons/delivery/sale.py @@ -53,7 +53,7 @@ class sale_order(osv.osv): if not grid_id: raise osv.except_osv(_('No Grid Available!'), _('No grid matching for this carrier!')) - if not order.state in ('draft'): + if not order.state in ('draft', 'sent'): raise osv.except_osv(_('Order not in Draft State!'), _('The order state have to be draft to add delivery lines.')) grid = grid_obj.browse(cr, uid, grid_id, context=context) From 0c4bc1cf72d69110246fd133f6c9f55245fa3bd0 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 3 Jun 2014 16:56:07 +0200 Subject: [PATCH 10/10] [FIX] sale: keep customer reference in grouped invoice (opw 606523) --- addons/sale/sale.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 364ca36b1c2..af62b014c05 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -525,14 +525,18 @@ class sale_order(osv.osv): if grouped: res = self._make_invoice(cr, uid, val[0][0], reduce(lambda x, y: x + y, [l for o, l in val], []), context=context) invoice_ref = '' + origin_ref = '' for o, l in val: - invoice_ref += o.name + '|' + invoice_ref += (o.client_order_ref or o.name) + '|' + origin_ref += (o.origin or o.name) + '|' self.write(cr, uid, [o.id], {'state': 'progress'}) cr.execute('insert into sale_order_invoice_rel (order_id,invoice_id) values (%s,%s)', (o.id, res)) #remove last '|' in invoice_ref - if len(invoice_ref) >= 1: + if len(invoice_ref) >= 1: invoice_ref = invoice_ref[:-1] - invoice.write(cr, uid, [res], {'origin': invoice_ref, 'name': invoice_ref}) + if len(origin_ref) >= 1: + origin_ref = origin_ref[:-1] + invoice.write(cr, uid, [res], {'origin': origin_ref, 'name': invoice_ref}) else: for order, il in val: res = self._make_invoice(cr, uid, order, il, context=context)