From 40b1fccb2a422c46f4a9b2ae56eb9099c21eb1ef Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Fri, 25 Jul 2014 16:17:29 -0400 Subject: [PATCH 1/9] [FIX] translate: Fix debug print when parse path list to translate. --- openerp/tools/translate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/tools/translate.py b/openerp/tools/translate.py index 4dc49903730..b3bea678cf8 100644 --- a/openerp/tools/translate.py +++ b/openerp/tools/translate.py @@ -854,7 +854,7 @@ def trans_generate(lang, modules, cr): for bin_path in ['osv', 'report' ]: path_list.append(os.path.join(config.config['root_path'], bin_path)) - _logger.debug("Scanning modules at paths: ", path_list) + _logger.debug("Scanning modules at paths: %s", path_list) mod_paths = [] From 767d2ea9a63ceb6d8473766f52eb06f69b281ca1 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 28 Jul 2014 19:02:11 +0200 Subject: [PATCH 2/9] [FIX] web: on refresh, do search_read with fields passed --- addons/web/static/src/js/views.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 7677ddfb9f5..78accfd4da4 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -653,8 +653,8 @@ instance.web.ViewManager = instance.web.Widget.extend({ var container = this.$el.find("> .oe_view_manager_body > .oe_view_manager_view_" + view_type); var view_promise = controller.appendTo(container); this.views[view_type].controller = controller; - this.views[view_type].deferred.resolve(view_type); return $.when(view_promise).done(function() { + self.views[view_type].deferred.resolve(view_type); if (self.searchview && self.flags.auto_search && view.controller.searchable !== false) { @@ -1071,7 +1071,7 @@ instance.web.ViewManagerAction = instance.web.ViewManager.extend({ ); } - $.when(defs).done(function() { + $.when(this.views[this.active_view] ? this.views[this.active_view].deferred : $.when(), defs).done(function() { self.views[self.active_view].controller.do_load_state(state, warm); }); }, From f9da53743f2c12bf12e93c6004c0107249962805 Mon Sep 17 00:00:00 2001 From: StefanRijnhart Date: Tue, 29 Jul 2014 12:17:38 +0200 Subject: [PATCH 3/9] [FIX] mail: reset of default_type in context When creating a new message, we need to reset the default_type key to avoid context propagation (e.g. invoice menu). However we used to compare the key in context (char) with the list of selections (tuple) so it was never matching and always reset. --- addons/mail/mail_message.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py index 3f491df82b7..8ac047fb77e 100644 --- a/addons/mail/mail_message.py +++ b/addons/mail/mail_message.py @@ -61,7 +61,8 @@ class mail_message(osv.Model): def default_get(self, cr, uid, fields, context=None): # protection for `default_type` values leaking from menu action context (e.g. for invoices) - if context and context.get('default_type') and context.get('default_type') not in self._columns['type'].selection: + if context and context.get('default_type') and context.get('default_type') not in [ + val[0] for val in self._columns['type'].selection]: context = dict(context, default_type=None) return super(mail_message, self).default_get(cr, uid, fields, context=context) From dd4d72d710ab9ffcc3143130a6b5feecf8ce7a5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lionel=20Sausin=20=28Num=C3=A9rigraphe=29?= Date: Fri, 25 Jul 2014 11:54:36 +0200 Subject: [PATCH 4/9] [FIX] stock: partial deliveries switch on delivered picking Users don't care for the backorder picking precisely because they can't process it, whereas they may have to do some more things on the picking they processed: invoice it, print delivery orders or transportation stickers.. Refresh the browse record after changing the name to avoid the need to rebrowse. Fixes #1372 --- addons/stock/stock.py | 6 +++--- addons/stock/wizard/stock_partial_picking.py | 18 ++++++++++++++++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index d363275b7fa..64284f7c0c2 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1305,6 +1305,7 @@ class stock_picking(osv.osv): {'name': sequence_obj.get(cr, uid, 'stock.picking.%s'%(pick.type)), }) + pick.refresh() new_picking = self.copy(cr, uid, pick.id, { 'name': new_picking_name, @@ -1362,9 +1363,8 @@ class stock_picking(osv.osv): self.action_move(cr, uid, [new_picking], context=context) wf_service.trg_validate(uid, 'stock.picking', new_picking, 'button_done', cr) wf_service.trg_write(uid, 'stock.picking', pick.id, cr) - delivered_pack_id = pick.id - back_order_name = self.browse(cr, uid, delivered_pack_id, context=context).name - self.message_post(cr, uid, new_picking, body=_("Back order %s has been created.") % (back_order_name), context=context) + delivered_pack_id = new_picking + self.message_post(cr, uid, new_picking, body=_("Back order %s has been created.") % (pick.name), context=context) else: self.action_move(cr, uid, [pick.id], context=context) wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_done', cr) diff --git a/addons/stock/wizard/stock_partial_picking.py b/addons/stock/wizard/stock_partial_picking.py index ceedb682ed8..7358855924d 100644 --- a/addons/stock/wizard/stock_partial_picking.py +++ b/addons/stock/wizard/stock_partial_picking.py @@ -156,6 +156,8 @@ class stock_partial_picking(osv.osv_memory): return partial_move def do_partial(self, cr, uid, ids, context=None): + if context is None: + context = {} assert len(ids) == 1, 'Partial picking processing may only be done one at a time.' stock_picking = self.pool.get('stock.picking') stock_move = self.pool.get('stock.move') @@ -211,7 +213,19 @@ class stock_partial_picking(osv.osv_memory): if (picking_type == 'in') and (wizard_line.product_id.cost_method == 'average'): partial_data['move%s' % (wizard_line.move_id.id)].update(product_price=wizard_line.cost, product_currency=wizard_line.currency.id) - stock_picking.do_partial(cr, uid, [partial.picking_id.id], partial_data, context=context) - return {'type': 'ir.actions.act_window_close'} + + # Do the partial delivery and open the picking that was delivered + # We don't need to find which view is required, stock.picking does it. + done = stock_picking.do_partial( + cr, uid, [partial.picking_id.id], partial_data, context=context) + return { + 'type': 'ir.actions.act_window', + 'res_model': context.get('active_model', 'stock.picking'), + 'name': _('Partial Delivery'), + 'res_id': done[partial.picking_id.id]['delivered_picking'], + 'view_type': 'form', + 'view_mode': 'form,tree,calendar', + 'context': context, + } # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: From 873dc0370d7a006156cbfeb2ee793ddd67437777 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 30 Jul 2014 15:26:43 +0200 Subject: [PATCH 5/9] [FIX] sale: config, timesheet if module account_analytic_analysis In Settings > Sales, the onchange_timesheet ensure that if you check timesheet, it checks module_account_analytic_analysis. Therefore, if module_account_analytic_analysis is installed, timesheet should be checked by default Until now, it worked "luckily", because the onchange_timesheet of the field module_account_analytic_analysis was triggered before the onchange_timesheet of the timesheet field. Nevertheless, we shouldn't trust the onchange calls order. --- addons/sale/res_config.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/sale/res_config.py b/addons/sale/res_config.py index f4239b0e1a2..164213f1f59 100644 --- a/addons/sale/res_config.py +++ b/addons/sale/res_config.py @@ -91,6 +91,7 @@ Example: Product: this product is deprecated, do not purchase more than 5. except ValueError: # keep default value in that case _logger.warning("Product with xml_id 'product.product_product_consultant' not found") + res['timesheet'] = res.get('module_account_analytic_analysis') return res def _get_default_time_unit(self, cr, uid, context=None): From 8f0392b49099eaca6f4c5cdd0931da0821d73865 Mon Sep 17 00:00:00 2001 From: Ravi Gohil Date: Thu, 10 Jul 2014 17:09:15 +0530 Subject: [PATCH 6/9] [FIX] account_voucher: avoid trying unreconcile a move twice When we cancel a voucher, we may be trying to unlink a reconciliation that was already removed on another move (just looking at the version in cache). In such cases, the unlink would fail with traceback. opw 610287 --- addons/account_voucher/account_voucher.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index ce080d9e446..a7c7646f6e1 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -957,6 +957,8 @@ class account_voucher(osv.osv): # refresh to make sure you don't unlink an already removed move voucher.refresh() for line in voucher.move_ids: + # refresh to make sure you don't unreconcile an already unreconciled entry + line.refresh() if line.reconcile_id: move_lines = [move_line.id for move_line in line.reconcile_id.line_id] move_lines.remove(line.id) From faa0df809fdbaa083e0562739ec045820a0b26e2 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 30 Jul 2014 15:27:58 +0200 Subject: [PATCH 7/9] [FIX] project_long_term: avoid bad duplication of phases When we duplicate a project, the related phases need to be duplicated as well but keeping references between each other. e.g. 'project 1' with 'phase A' follwed by 'phase B' should become 'project 1 (copy)' with 'phase A (copy)' followed by 'phase B (copy)'. Fixing bug lp:1212860, opw 607062 --- addons/project_long_term/project_long_term.py | 39 ++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/addons/project_long_term/project_long_term.py b/addons/project_long_term/project_long_term.py index 109f0c03c6f..0758d4181e2 100644 --- a/addons/project_long_term/project_long_term.py +++ b/addons/project_long_term/project_long_term.py @@ -267,7 +267,44 @@ class project(osv.osv): 'date_end': p.end.strftime('%Y-%m-%d %H:%M:%S') }, context=context) return True -project() + + def map_phase(self, cr, uid, old_project_id, new_project_id, context=None): + """ copy and map phases from old to new project while keeping order relations """ + project_phase = self.pool['project.phase'] + project_task = self.pool['project.task'] + # mapping source and copy ids to recreate m2m links + phase_ids_mapping = {} + project = self.browse(cr, uid, old_project_id, context=context) + if project.phase_ids: + for phase in project.phase_ids: + phase_default = { + 'project_id': new_project_id, + 'previous_phase_ids': [], + 'next_phase_ids': [], + 'task_ids': [], + } + # adding relationships with already copied phases + for previous_phase in phase.previous_phase_ids: + if previous_phase.id in phase_ids_mapping: + phase_default['previous_phase_ids'].append((4, phase_ids_mapping[previous_phase.id])) + for next_phase in phase.next_phase_ids: + if next_phase.id in phase_ids_mapping: + phase_default['previous_phase_ids'].append((4, phase_ids_mapping[next_phase.id])) + phase_ids_mapping[phase.id] = project_phase.copy(cr, uid, phase.id, phase_default, context=context) + if project.tasks: + # if has copied tasks, need to update phase_id + for task in self.browse(cr, uid, new_project_id, context=context).tasks: + if task.phase_id and task.phase_id.id in phase_ids_mapping: + project_task.write(cr, uid, task.id, {'phase_id': phase_ids_mapping[phase.id]}, context=context) + return True + + def copy(self, cr, uid, id, default=None, context=None): + if default is None: + default = {} + default.update(phase_ids=[]) + new_project_id = super(project, self).copy(cr, uid, id, default, context) + self.map_phase(cr, uid, id, new_project_id, context=context) + return new_project_id class account_analytic_account(osv.osv): _inherit = 'account.analytic.account' From 0b947b26e19c8a293a54d788c253edf63b77c2b7 Mon Sep 17 00:00:00 2001 From: dhr-odoo Date: Mon, 7 Jul 2014 18:08:12 +0530 Subject: [PATCH 8/9] Passed default type while creating document page category from document page --- addons/document_page/document_page_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/document_page/document_page_view.xml b/addons/document_page/document_page_view.xml index 9d02b47d265..2ffc905946c 100644 --- a/addons/document_page/document_page_view.xml +++ b/addons/document_page/document_page_view.xml @@ -42,7 +42,7 @@

- + From 39f3e403293e51f1e6e544638831dd090bcc0847 Mon Sep 17 00:00:00 2001 From: Guewen Baconnier Date: Wed, 9 Jul 2014 11:39:58 +0200 Subject: [PATCH 9/9] [FIX] sale: copy_quotation must propagate the context --- addons/sale/sale.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index af62b014c05..264c2d9650f 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -281,7 +281,7 @@ class sale_order(osv.osv): return osv.osv.unlink(self, cr, uid, unlink_ids, context=context) def copy_quotation(self, cr, uid, ids, context=None): - id = self.copy(cr, uid, ids[0], context=None) + id = self.copy(cr, uid, ids[0], context=context) view_ref = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'sale', 'view_order_form') view_id = view_ref and view_ref[1] or False, return {