From 3594dc56da679a12c908bd6e6d81c7fceff52c44 Mon Sep 17 00:00:00 2001 From: Sandy Carter Date: Fri, 16 May 2014 17:42:20 -0400 Subject: [PATCH 01/13] [FIX] Add context propagation for m2m list view Fix bug https://bugs.launchpad.net/openerp-web/+bug/1279885 : Many2many fields in Tree views will not get translated. If you check the context for a name_get of a m2m field, it is passed as None. Add context propagation to m2m fields in list views. Fix translation issues when viewing a a many2many field in a Tree view. --- addons/web/static/src/js/view_list.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 6de354bfcb8..4cf5cc6169b 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -1073,7 +1073,7 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web. ids = value; } new instance.web.Model(column.relation) - .call('name_get', [ids]).done(function (names) { + .call('name_get', [ids, this.dataset.context]).done(function (names) { // FIXME: nth horrible hack in this poor listview record.set(column.id + '__display', _(names).pluck(1).join(', ')); From 2542992c24b7e1c5ca86360b07c66539df41aa81 Mon Sep 17 00:00:00 2001 From: Yannick Vaucher Date: Thu, 19 Jun 2014 14:10:24 +0200 Subject: [PATCH 02/13] Fix sale_id on stock.picking.out view View inheritance is on the wrong model after model change of stock.picking. Here we just fix the model. --- addons/sale_stock/stock_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale_stock/stock_view.xml b/addons/sale_stock/stock_view.xml index d4bf4fc4629..f4ed19b5127 100644 --- a/addons/sale_stock/stock_view.xml +++ b/addons/sale_stock/stock_view.xml @@ -51,7 +51,7 @@ Outgoing picking Inherited - stock.picking + stock.picking.out From 59c27970b56b60cadd3711db536492ad7c282564 Mon Sep 17 00:00:00 2001 From: kevin wang Date: Mon, 23 Jun 2014 12:48:27 +0200 Subject: [PATCH 03/13] [FIX] orm: allow unicode in inherit views with attribute When extending a view with position='attributes', prevent crash if view contains unicode char Fixes #706 --- openerp/osv/orm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/osv/orm.py b/openerp/osv/orm.py index 1dbac53511f..fc381695fef 100644 --- a/openerp/osv/orm.py +++ b/openerp/osv/orm.py @@ -2162,7 +2162,7 @@ class BaseModel(object): node.getparent().remove(node) elif pos == 'attributes': for child in spec.getiterator('attribute'): - attribute = (child.get('name'), child.text and child.text.encode('utf8') or None) + attribute = (child.get('name'), child.text or None) if attribute[1]: node.set(attribute[0], attribute[1]) else: From d0b3e3b8c66e8091766806f3dedc27ab2a264672 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 23 Jun 2014 13:09:36 +0200 Subject: [PATCH 04/13] [IMP] module: when uninstalling a module, do not redirect to a useless screen --- .../addons/base/module/wizard/base_module_upgrade.py | 12 +----------- .../base/module/wizard/base_module_upgrade_view.xml | 2 +- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/openerp/addons/base/module/wizard/base_module_upgrade.py b/openerp/addons/base/module/wizard/base_module_upgrade.py index 559931fddc1..f827c157bb7 100644 --- a/openerp/addons/base/module/wizard/base_module_upgrade.py +++ b/openerp/addons/base/module/wizard/base_module_upgrade.py @@ -103,17 +103,7 @@ class base_module_upgrade(osv.osv_memory): pooler.restart_pool(cr.dbname, update_module=True) - ir_model_data = self.pool.get('ir.model.data') - __, res_id = ir_model_data.get_object_reference(cr, uid, 'base', 'view_base_module_upgrade_install') - return { - 'view_type': 'form', - 'view_mode': 'form', - 'res_model': 'base.module.upgrade', - 'views': [(res_id, 'form')], - 'view_id': False, - 'type': 'ir.actions.act_window', - 'target': 'new', - } + return {'type': 'ir.actions.act_window_close'} def config(self, cr, uid, ids, context=None): return self.pool.get('res.config').next(cr, uid, [], context=context) diff --git a/openerp/addons/base/module/wizard/base_module_upgrade_view.xml b/openerp/addons/base/module/wizard/base_module_upgrade_view.xml index 10c023e5148..705ba31b16f 100644 --- a/openerp/addons/base/module/wizard/base_module_upgrade_view.xml +++ b/openerp/addons/base/module/wizard/base_module_upgrade_view.xml @@ -13,7 +13,7 @@
-
From d9e6a7a9aed76ea27c0cb9d152b859f1914b2c06 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 23 Jun 2014 16:21:28 +0200 Subject: [PATCH 05/13] [FIX] calendar: do not parse date to date When creating an event from the calendar view, no need to parse a date to date (error undefined is not a function) --- addons/web_calendar/static/src/js/web_calendar.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/addons/web_calendar/static/src/js/web_calendar.js b/addons/web_calendar/static/src/js/web_calendar.js index ad49ff9a9b1..e75806bb8e4 100644 --- a/addons/web_calendar/static/src/js/web_calendar.js +++ b/addons/web_calendar/static/src/js/web_calendar.js @@ -657,17 +657,13 @@ openerp.web_calendar = function(instance) { date_start_day = new Date(event.start.getFullYear(),event.start.getMonth(),event.start.getDate(),7); date_stop_day = new Date(event_end.getFullYear(),event_end.getMonth(),event_end.getDate(),19); } - data[this.date_start] = instance.web.parse_value(date_start_day, this.fields[this.date_start]); - if (this.date_stop) { - data[this.date_stop] = instance.web.parse_value(date_stop_day, this.fields[this.date_stop]); - } diff_seconds = Math.round((date_stop_day.getTime() - date_start_day.getTime()) / 1000); } else { - data[this.date_start] = instance.web.parse_value(event.start, this.fields[this.date_start]); + data[this.date_start] = event.start; if (this.date_stop) { - data[this.date_stop] = instance.web.parse_value(event_end, this.fields[this.date_stop]); + data[this.date_stop] = event_end; } diff_seconds = Math.round((event_end.getTime() - event.start.getTime()) / 1000); } From b86e0a4392ed873caf4eb4a4072d3838384b583d Mon Sep 17 00:00:00 2001 From: Jos De Graeve Date: Mon, 23 Jun 2014 18:18:42 +0200 Subject: [PATCH 06/13] [FIX] Partner VAT Intra XML delaration: Vat number format correction The Partner VAT Intra XML delaration needs to have the VAT number in the format without the country code prefix. The current behaviour was to include the country code prefix in the report which causes an SQLException error on uploading the XML file to the Federal goverment's website. While the error is non-descriptive fixing the VAT number format fixes the error. --- addons/l10n_be/wizard/l10n_be_vat_intra.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/l10n_be/wizard/l10n_be_vat_intra.py b/addons/l10n_be/wizard/l10n_be_vat_intra.py index ff86a6ba21e..60cd0cb7cb3 100644 --- a/addons/l10n_be/wizard/l10n_be_vat_intra.py +++ b/addons/l10n_be/wizard/l10n_be_vat_intra.py @@ -224,7 +224,7 @@ class partner_vat_intra(osv.osv_memory): data_head = """ - %(company_vat)s + %(vatnum)s %(company_name)s %(street)s %(post_code)s From 7d3453d119a80f484918842682ac5f4299d91e7b Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Tue, 24 Jun 2014 12:12:27 +0200 Subject: [PATCH 07/13] [FIX] purchase_requisition: broken procurement wkf If a purchase requisition is created instead of a purchase order for a procurement order, the method make_po should not return the id of this requisition, as methods calling the make_po method expects ids of purchase orders, not purchase requisition ids. Besides, on purchase requisition done or cancel, we set the procurement order accordingly, without the use of the workflow. We consider this as crappy, the proper fix should be the use of a dedicated workflow for purchase requisition, but I cannot be done in stable branches. This aims trunk/master. --- addons/purchase_requisition/purchase_requisition.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/purchase_requisition/purchase_requisition.py b/addons/purchase_requisition/purchase_requisition.py index c31f8a69a37..3b8ea1c06c7 100644 --- a/addons/purchase_requisition/purchase_requisition.py +++ b/addons/purchase_requisition/purchase_requisition.py @@ -72,6 +72,8 @@ class purchase_requisition(osv.osv): for purchase_id in purchase.purchase_ids: if str(purchase_id.state) in('draft'): purchase_order_obj.action_cancel(cr,uid,[purchase_id.id]) + procurement_ids = self.pool['procurement.order'].search(cr, uid, [('requisition_id', 'in', ids)], context=context) + self.pool['procurement.order'].write(cr, uid, procurement_ids, {'state': 'cancel'}, context=context) return self.write(cr, uid, ids, {'state': 'cancel'}) def tender_in_progress(self, cr, uid, ids, context=None): @@ -81,6 +83,8 @@ class purchase_requisition(osv.osv): return self.write(cr, uid, ids, {'state': 'draft'}) def tender_done(self, cr, uid, ids, context=None): + procurement_ids = self.pool['procurement.order'].search(cr, uid, [('requisition_id', 'in', ids)], context=context) + self.pool['procurement.order'].write(cr, uid, procurement_ids, {'state': 'done'}, context=context) return self.write(cr, uid, ids, {'state':'done', 'date_end':time.strftime('%Y-%m-%d %H:%M:%S')}, context=context) def _planned_date(self, requisition, delay=0.0): @@ -272,7 +276,7 @@ class procurement_order(osv.osv): for procurement in self.browse(cr, uid, ids, context=context): if procurement.product_id.purchase_requisition: user_company = self.pool['res.users'].browse(cr, uid, uid, context=context).company_id - req = res[procurement.id] = requisition_obj.create(cr, uid, { + req = requisition_obj.create(cr, uid, { 'origin': procurement.origin, 'date_end': procurement.date_planned, 'warehouse_id': self._get_warehouse(procurement, user_company), @@ -288,6 +292,7 @@ class procurement_order(osv.osv): 'state': 'running', 'requisition_id': req }) + res[procurement.id] = 0 else: non_requisition.append(procurement.id) From e2201369a314feaec70a485f0459c1dcdcecd82b Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Tue, 24 Jun 2014 13:53:02 +0200 Subject: [PATCH 08/13] [FIX] web: format.js, toString while parsing date When attempting to parse client date, value is not always a string. We force the toString when adding the leading 0, as the replace method is for string --- addons/web/static/src/js/formats.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/js/formats.js b/addons/web/static/src/js/formats.js index cf53d9fb3f0..aa40975e0ab 100644 --- a/addons/web/static/src/js/formats.js +++ b/addons/web/static/src/js/formats.js @@ -266,7 +266,7 @@ instance.web.parse_value = function (value, descriptor, value_if_empty) { value, (date_pattern + ' ' + time_pattern)); if (datetime !== null) return instance.web.datetime_to_str(datetime); - datetime = Date.parseExact(value.replace(/\d+/g, function(m){ + datetime = Date.parseExact(value.toString().replace(/\d+/g, function(m){ return m.length === 1 ? "0" + m : m ; }), (date_pattern + ' ' + time_pattern)); if (datetime !== null) @@ -279,7 +279,7 @@ instance.web.parse_value = function (value, descriptor, value_if_empty) { var date = Date.parseExact(value, date_pattern); if (date !== null) return instance.web.date_to_str(date); - date = Date.parseExact(value.replace(/\d+/g, function(m){ + date = Date.parseExact(value.toString().replace(/\d+/g, function(m){ return m.length === 1 ? "0" + m : m ; }), date_pattern); if (date !== null) From 0b593ada11f6222803949705c508a5616c3e6a3e Mon Sep 17 00:00:00 2001 From: Mohammed Shekha Date: Tue, 24 Jun 2014 17:42:48 +0530 Subject: [PATCH 09/13] Server Translation: Fixed the issue search on translated field do not return true result, search on tranlsated field fails due to expression parsing which fetches ids from ir_translation as well as working table and UNION of this makes search fruitless, also search fails for in language other then english when you enter part of a string for the field to search. --- openerp/osv/expression.py | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/openerp/osv/expression.py b/openerp/osv/expression.py index 68ad4c2e589..18c82306bc5 100644 --- a/openerp/osv/expression.py +++ b/openerp/osv/expression.py @@ -1037,34 +1037,30 @@ class expression(object): unaccent = self._unaccent if sql_operator.endswith('like') else lambda x: x - trans_left = unaccent('value') - quote_left = unaccent(_quote(left)) instr = unaccent('%s') if sql_operator == 'in': # params will be flatten by to_sql() => expand the placeholders instr = '(%s)' % ', '.join(['%s'] * len(right)) - subselect = """(SELECT res_id - FROM ir_translation - WHERE name = %s - AND lang = %s - AND type = %s - AND {trans_left} {operator} {right} - ) UNION ( - SELECT id - FROM "{table}" - WHERE {left} {operator} {right} - ) - """.format(trans_left=trans_left, operator=sql_operator, - right=instr, table=working_model._table, left=quote_left) + subselect = """WITH temp_irt_current (id, name) as ( + SELECT ct.id, coalesce(it.value,ct.{quote_left}) + FROM {current_table} ct + LEFT JOIN ir_translation it ON (it.name = %s and + it.lang = %s and + it.type = %s and + it.res_id = ct.id and + it.value != '') + ) + SELECT id FROM temp_irt_current WHERE {name} {operator} {right} order by name + """.format(current_table=working_model._table, quote_left=_quote(left), name=unaccent('name'), + operator=sql_operator, right=instr) params = ( working_model._name + ',' + left, context.get('lang') or 'en_US', 'model', right, - right, ) push(create_substitution_leaf(leaf, ('id', inselect_operator, (subselect, params)), working_model)) From ac5a0b046b41fa0041db3f789ef725d5ed705027 Mon Sep 17 00:00:00 2001 From: Yogesh Parekh Date: Tue, 24 Jun 2014 11:26:49 +0530 Subject: [PATCH 10/13] [IMP]: Improve copy method to set stage_id in draft stage --- addons/crm_claim/crm_claim.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/crm_claim/crm_claim.py b/addons/crm_claim/crm_claim.py index 04e12c8bce8..ee4aff1e7e3 100644 --- a/addons/crm_claim/crm_claim.py +++ b/addons/crm_claim/crm_claim.py @@ -179,6 +179,13 @@ class crm_claim(base_stage, osv.osv): address = self.pool.get('res.partner').browse(cr, uid, part) return {'value': {'email_from': address.email, 'partner_phone': address.phone}} + def copy(self, cr, uid, id, default=None, context=None): + claim = self.browse(cr, uid, id, context=context) + default = dict(default or {}, + stage_id = self._get_default_stage_id(cr, uid, context=context), + name = _('%s (copy)') % claim.name) + return super(crm_claim, self).copy(cr, uid, id, default, context=context) + # ------------------------------------------------------- # Mail gateway # ------------------------------------------------------- From 4bfcbb2a480db6b72b6db84420a39dcf641bbbb1 Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Wed, 25 Jun 2014 10:57:10 +0200 Subject: [PATCH 11/13] [FIX] fields property: do not create empty properties fixes #595 In the case where a property for the company exists but has no related record (e.g. in case of type m2o with no defined value), not setting a value to this field for a new record would create a new property (as browse_null is not an instance of browse_record) --- openerp/osv/fields.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openerp/osv/fields.py b/openerp/osv/fields.py index 49421365852..040548ec7cc 100644 --- a/openerp/osv/fields.py +++ b/openerp/osv/fields.py @@ -1428,7 +1428,8 @@ class property(function): default_val = self._get_default(obj, cr, uid, prop_name, context) property_create = False - if isinstance(default_val, openerp.osv.orm.browse_record): + if isinstance(default_val, (openerp.osv.orm.browse_record, + openerp.osv.orm.browse_null)): if default_val.id != id_val: property_create = True elif default_val != id_val: From dee969929a000e069b1d2bf2d3e362ae7aed6d9e Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 25 Jun 2014 12:00:14 +0200 Subject: [PATCH 12/13] [FIX] purchase_requisition: duplicated stock moves When a purchase requisition is created from a procurement order, a first stock move is created, not associated to any purchase orders Then, on purchase order creation and confirmation, in the purchase requisition, new stock moves are created, associated to the purchase order. The existing stock move issued from the procurement order which created the purchase requisition remained untouched, leading to wrong inventory values To fix this, the destination location of the stock move of the procurement order is written on the source location A proper fix should be to use a dedicated workflow for puchase requisition, but this can't be done in 7.0, it has to be done in master/trunk --- addons/purchase_requisition/purchase_requisition.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/purchase_requisition/purchase_requisition.py b/addons/purchase_requisition/purchase_requisition.py index 3b8ea1c06c7..031c902e4bb 100644 --- a/addons/purchase_requisition/purchase_requisition.py +++ b/addons/purchase_requisition/purchase_requisition.py @@ -73,7 +73,7 @@ class purchase_requisition(osv.osv): if str(purchase_id.state) in('draft'): purchase_order_obj.action_cancel(cr,uid,[purchase_id.id]) procurement_ids = self.pool['procurement.order'].search(cr, uid, [('requisition_id', 'in', ids)], context=context) - self.pool['procurement.order'].write(cr, uid, procurement_ids, {'state': 'cancel'}, context=context) + self.pool['procurement.order'].action_done(cr, uid, procurement_ids) return self.write(cr, uid, ids, {'state': 'cancel'}) def tender_in_progress(self, cr, uid, ids, context=None): @@ -84,7 +84,7 @@ class purchase_requisition(osv.osv): def tender_done(self, cr, uid, ids, context=None): procurement_ids = self.pool['procurement.order'].search(cr, uid, [('requisition_id', 'in', ids)], context=context) - self.pool['procurement.order'].write(cr, uid, procurement_ids, {'state': 'done'}, context=context) + self.pool['procurement.order'].action_done(cr, uid, procurement_ids) return self.write(cr, uid, ids, {'state':'done', 'date_end':time.strftime('%Y-%m-%d %H:%M:%S')}, context=context) def _planned_date(self, requisition, delay=0.0): @@ -218,6 +218,10 @@ class purchase_order(osv.osv): wf_service = netsvc.LocalService("workflow") wf_service.trg_validate(uid, 'purchase.order', order.id, 'purchase_cancel', cr) po.requisition_id.tender_done(context=context) + if po.requisition_id and all(purchase_id.state in ['draft', 'cancel'] for purchase_id in po.requisition_id.purchase_ids if purchase_id.id != po.id): + procurement_ids = self.pool['procurement.order'].search(cr, uid, [('requisition_id', '=', po.requisition_id.id)], context=context) + for procurement in proc_obj.browse(cr, uid, procurement_ids, context=context): + procurement.move_id.write({'location_id': procurement.move_id.location_dest_id.id}) return res purchase_order() From df6b37c472772ef8911671b54caee1769cf77706 Mon Sep 17 00:00:00 2001 From: dhr-odoo Date: Wed, 25 Jun 2014 12:07:02 +0200 Subject: [PATCH 13/13] [FIX] account: add multicompany rule to account.subscription.line The wizard to generate recurring entries did not respect multicompany rules as the request was done in plain sql. Add ir.rule and use the orm (opw 607782) --- addons/account/security/account_security.xml | 7 +++++++ addons/account/wizard/account_subscription_generate.py | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/addons/account/security/account_security.xml b/addons/account/security/account_security.xml index 9a2383de45b..65d3e95be54 100644 --- a/addons/account/security/account_security.xml +++ b/addons/account/security/account_security.xml @@ -139,6 +139,13 @@ ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]
+ + Account subscription line company rule + + + ['|',('subscription_id.model_id.company_id','=',False),('subscription_id.model_id.company_id','child_of',[user.company_id.id])] + + Invoice Line company rule diff --git a/addons/account/wizard/account_subscription_generate.py b/addons/account/wizard/account_subscription_generate.py index f5babc4fd87..65604446e9f 100644 --- a/addons/account/wizard/account_subscription_generate.py +++ b/addons/account/wizard/account_subscription_generate.py @@ -36,11 +36,11 @@ class account_subscription_generate(osv.osv_memory): def action_generate(self, cr, uid, ids, context=None): mod_obj = self.pool.get('ir.model.data') act_obj = self.pool.get('ir.actions.act_window') + sub_line_obj = self.pool.get('account.subscription.line') moves_created=[] for data in self.read(cr, uid, ids, context=context): - cr.execute('select id from account_subscription_line where date<%s and move_id is null', (data['date'],)) - line_ids = map(lambda x: x[0], cr.fetchall()) - moves = self.pool.get('account.subscription.line').move_create(cr, uid, line_ids, context=context) + line_ids = sub_line_obj.search(cr, uid, [('date', '<', data['date']), ('move_id', '=', False)], context=context) + moves = sub_line_obj.move_create(cr, uid, line_ids, context=context) moves_created.extend(moves) result = mod_obj.get_object_reference(cr, uid, 'account', 'action_move_line_form') id = result and result[1] or False