From 42aa9096d9c1aa54529960e70590335660e33d12 Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Thu, 26 Mar 2015 23:25:28 +0100 Subject: [PATCH 001/235] [FIX] product: fix search view to search on attribute name. Searching 'memory' doesn't work before... --- addons/product/product_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/product/product_view.xml b/addons/product/product_view.xml index e66040d10ad..9c3d4356f68 100644 --- a/addons/product/product_view.xml +++ b/addons/product/product_view.xml @@ -16,7 +16,7 @@ - + From a35badc00bac7701f0ffe191a781b0f1aa31adc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Fri, 27 Mar 2015 10:05:11 +0100 Subject: [PATCH 002/235] [FIX] web: graph view should respect graph type The graph view is supposed to load in a given mode, as described by the type attribute ('bar', 'line', 'pie'). However, the type attribute in the fieldviewget was ignored, which means that the graph view was always loaded in bar mode. --- addons/web/static/src/js/view_graph.js | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/web/static/src/js/view_graph.js b/addons/web/static/src/js/view_graph.js index 19da95b9273..13361c6bab1 100644 --- a/addons/web/static/src/js/view_graph.js +++ b/addons/web/static/src/js/view_graph.js @@ -61,6 +61,7 @@ instance.web.GraphView = instance.web.View.extend({ self.initial_groupbys.push(name); } }); + this.active_mode = fvg.arch.attrs.type || 'bar'; }, do_show: function () { this.do_push_state({}); From 020caa17e4318a8e4134519e00b4a13962c8223d Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Fri, 27 Mar 2015 10:57:18 +0100 Subject: [PATCH 003/235] [FIX] project_timesheet: undefined employee journal error message There is no more any "timesheet" tab in the employee form. This is actually the "HR Settings" tab, nowadays. opw-631599 --- addons/project_timesheet/project_timesheet.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/project_timesheet/project_timesheet.py b/addons/project_timesheet/project_timesheet.py index cefb1e0ef40..fe4f940222f 100644 --- a/addons/project_timesheet/project_timesheet.py +++ b/addons/project_timesheet/project_timesheet.py @@ -88,14 +88,14 @@ class project_work(osv.osv): if not emp.journal_id: raise osv.except_osv(_('Bad Configuration!'), - _('Please define journal on the related employee.\nFill in the timesheet tab of the employee form.')) + _('Please define journal on the related employee.\nFill in the HR Settings tab of the employee form.')) acc_id = emp.product_id.property_account_expense.id if not acc_id: acc_id = emp.product_id.categ_id.property_account_expense_categ.id if not acc_id: raise osv.except_osv(_('Bad Configuration!'), - _('Please define product and product category property account on the related employee.\nFill in the timesheet tab of the employee form.')) + _('Please define product and product category property account on the related employee.\nFill in the HR Settings of the employee form.')) res['product_id'] = emp.product_id.id res['journal_id'] = emp.journal_id.id From cd08281979c0d50a0f135ed452d2a15c6bcc3324 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Fri, 27 Mar 2015 13:14:46 +0100 Subject: [PATCH 004/235] [IMP] web: debug menu extra actions available to users in "Configuration" group --- addons/web/static/src/js/core.js | 12 ++++++++++++ addons/web/static/src/js/views.js | 11 +++++++---- addons/web/static/src/xml/base.xml | 2 +- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/addons/web/static/src/js/core.js b/addons/web/static/src/js/core.js index ef7523ee440..28b209ee582 100644 --- a/addons/web/static/src/js/core.js +++ b/addons/web/static/src/js/core.js @@ -205,6 +205,7 @@ instance.web.Session.include( /** @lends instance.web.Session# */{ // TODO: session store in cookie should be optional this.name = instance._session_id; this.qweb_mutex = new $.Mutex(); + this._groups_def = {}; }, /** * Setup a sessionm @@ -264,6 +265,17 @@ instance.web.Session.include( /** @lends instance.web.Session# */{ $.bbq.removeState(); return this.rpc("/web/session/destroy", {}); }, + user_has_group: function(group) { + if (!this.uid) { + return $.when().resolve(false); + } + var def = this._groups_def[group]; + if (!def) { + var Users = new instance.web.Model('res.users'); + def = this._groups_def[group] = Users.call('has_group', [group]); + } + return def; + }, get_cookie: function (name) { if (!this.name) { return null; } var nameEQ = this.name + '|' + name + '='; diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index e58753e1efa..2d52f2a6344 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -685,10 +685,13 @@ instance.web.ViewManager = instance.web.Widget.extend({ self._display_view(view_options); self.trigger('switch_mode', view_type, no_store, view_options); if (self.session.debug) { - self.$('.oe_debug_view').html(QWeb.render('ViewManagerDebug', { - view: self.active_view.controller, - view_manager: self, - })); + self.session.user_has_group('base.group_system').then(function(is_admin) { + self.$('.oe_debug_view').html(QWeb.render('ViewManagerDebug', { + view: self.active_view.controller, + view_manager: self, + is_admin: is_admin, + })); + }); } }); }, diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index c26d9b99612..5f92b83c854 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -532,7 +532,7 @@
  • View Fields
  • Fields View Get
  • Manage Filters
  • - +
  • Technical Translation
  • Manage Views
  • Edit View
  • From 34c891a426717849ef1111c78f41c687e04dac91 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Mon, 23 Mar 2015 15:45:33 +0100 Subject: [PATCH 005/235] [FIX] purchase: set the unit price to zero if requested in the purchase order If a purchase order is created with free goods (e.g. 5 units offered if 100 are purchased), the price_unit of stock.move and the cost of stock.quant were set to the product cost price instead of zero. This would lead to inconsistencies in the 'Current Inventory Valuation'. opw: 630593 --- addons/purchase/stock.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/addons/purchase/stock.py b/addons/purchase/stock.py index e6d0cb8fa6f..5f569e1964d 100644 --- a/addons/purchase/stock.py +++ b/addons/purchase/stock.py @@ -31,6 +31,13 @@ class stock_move(osv.osv): readonly=True), } + def get_price_unit(self, cr, uid, move, context=None): + """ Returns the unit price to store on the quant """ + if move.purchase_line_id: + return move.price_unit + + return super(stock_move, self).get_price_unit(cr, uid, move, context=context) + def write(self, cr, uid, ids, vals, context=None): if isinstance(ids, (int, long)): ids = [ids] @@ -117,6 +124,13 @@ class stock_move(osv.osv): """ Attribute price to move, important in inter-company moves or receipts with only one partner """ + # The method attribute_price of the parent class sets the price to the standard product + # price if move.price_unit is zero. We don't want this behavior in the case of a purchase + # order since we can purchase goods which are free of charge (e.g. 5 units offered if 100 + # are purchased). + if move.purchase_line_id: + return + code = self.get_code_from_locs(cr, uid, move, context=context) if not move.purchase_line_id and code == 'incoming' and not move.price_unit: partner = move.picking_id and move.picking_id.partner_id or False From 7ecb78adfaac4a7972f7ce90eefe6830fbba9e7a Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 17 Mar 2015 16:21:33 +0100 Subject: [PATCH 006/235] [FIX] mrp: cancel remaining products to consume if no more products to produce opw: 630222 --- addons/mrp/mrp.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index fabeeca0fe3..3d933fc0dbf 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -986,6 +986,11 @@ class mrp_production(osv.osv): stock_mov_obj.action_done(cr, uid, [extra_move_id], context=context) self.message_post(cr, uid, production_id, body=_("%s produced") % self._description, context=context) + + # Remove remaining products to consume if no more products to produce + if not production.move_created_ids and production.move_lines: + stock_mov_obj.action_cancel(cr, uid, [x.id for x in production.move_lines], context=context) + self.signal_workflow(cr, uid, [production_id], 'button_produce_done') return True From d555fdac0c089a3d99497376e818f58c7e38d59c Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Thu, 26 Mar 2015 19:28:57 +0100 Subject: [PATCH 007/235] [IMP] tools.ustr: speed up average call by short-circuiting common cases Direct type comparison is significantly faster than isinstance/issubclass calls, so it is worth using in a method that is very frequently called. The extra call to getencoding() also causes a significant overhead, so we try to spare it by tring the hint_encoding first. If all fails, the default behavior still applies. Using micro-benchmarks, the execution time of ustr() on an already-unicode string is cut in half (no conversion is needed), and the overhead for converting utf-8 bytestrings is also cut in half (the conversion itself is O(n) on the string length, obviously) --- openerp/loglevels.py | 46 +++++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/openerp/loglevels.py b/openerp/loglevels.py index c43f3cfc07b..a72e1066c79 100644 --- a/openerp/loglevels.py +++ b/openerp/loglevels.py @@ -73,24 +73,40 @@ def ustr(value, hint_encoding='utf-8', errors='strict'): :raise: UnicodeError if value cannot be coerced to unicode :return: unicode string representing the given value """ + # We use direct type comparison instead of `isinstance` + # as much as possible, in order to make the most common + # cases faster (isinstance/issubclass are significantly slower) + ttype = type(value) + + if ttype is unicode: + return value + + # special short-circuit for str, as we still needs to support + # str subclasses such as `openerp.tools.unquote` + if ttype is str or issubclass(ttype, str): + + # try hint_encoding first, avoids call to get_encoding() + # for the most common case + try: + return unicode(value, hint_encoding, errors=errors) + except Exception: + pass + + # rare: no luck with hint_encoding, attempt other ones + for ln in get_encodings(hint_encoding): + try: + return unicode(value, ln, errors=errors) + except Exception: + pass + if isinstance(value, Exception): return exception_to_unicode(value) - if isinstance(value, unicode): - return value - - if not isinstance(value, basestring): - try: - return unicode(value) - except Exception: - raise UnicodeError('unable to convert %r' % (value,)) - - for ln in get_encodings(hint_encoding): - try: - return unicode(value, ln, errors=errors) - except Exception: - pass - raise UnicodeError('unable to convert %r' % (value,)) + # fallback for non-string values + try: + return unicode(value) + except Exception: + raise UnicodeError('unable to convert %r' % (value,)) def exception_to_unicode(e): From 534d5b8fe7cf13cada7a2be67eda7a8403070f9b Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 27 Mar 2015 12:43:57 +0100 Subject: [PATCH 008/235] [FIX] stock_landed_costs: avoid rounding issues for comparaison amount_total may return an unrounded amount, force the comparison with float_comapre to avoid errors opw 631157 --- addons/stock_landed_costs/stock_landed_costs.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/stock_landed_costs/stock_landed_costs.py b/addons/stock_landed_costs/stock_landed_costs.py index ad729377fb2..a2b05640bde 100644 --- a/addons/stock_landed_costs/stock_landed_costs.py +++ b/addons/stock_landed_costs/stock_landed_costs.py @@ -21,6 +21,7 @@ from openerp.osv import fields, osv import openerp.addons.decimal_precision as dp +from openerp.tools import float_compare from openerp.tools.translate import _ import product @@ -178,9 +179,12 @@ class stock_landed_cost(osv.osv): else: costcor[valuation_line.cost_line_id] = valuation_line.additional_landed_cost tot += valuation_line.additional_landed_cost - res = (tot == landed_cost.amount_total) + + prec = self.pool['decimal.precision'].precision_get(cr, uid, 'Account') + # float_compare returns 0 for equal amounts + res = not bool(float_compare(tot, landed_cost.amount_total, precision_digits=prec)) for costl in costcor.keys(): - if costcor[costl] != costl.price_unit: + if float_compare(costcor[costl], costl.price_unit, precision_digits=prec): res = False return res From 2f29acf9c5d8e5eb90cc9b502fbf3d44ed42afbe Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Fri, 27 Mar 2015 15:48:11 +0100 Subject: [PATCH 009/235] [FIX] account: correct `contract_count` value. Use `child_of` operator to match the search that will be done by the search view. --- addons/account/partner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/partner.py b/addons/account/partner.py index 4ca4abde46e..ee3aec145e5 100644 --- a/addons/account/partner.py +++ b/addons/account/partner.py @@ -254,7 +254,7 @@ class res_partner(osv.osv): return { partner_id: { 'journal_item_count': MoveLine.search_count(cr, uid, [('partner_id', '=', partner_id)], context=context), - 'contracts_count': AnalyticAccount.search_count(cr,uid, [('partner_id', '=', partner_id)], context=context) + 'contracts_count': AnalyticAccount.search_count(cr, uid, [('partner_id', 'child_of', partner_id)], context=context) } for partner_id in ids } From ba435bc3a98ac2b1b1a0effad1e2d97ecb63324a Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Thu, 19 Mar 2015 12:11:44 +0100 Subject: [PATCH 010/235] [IMP] stock: adapt views of current inventory valuation and stock level forecast The stock level forecast view should have inverse columns and rows. The line graph is also better by default. The stock valuation view should only be in reporting (removed the graph part) and is replaced by a pivot and graph view of the quants in the warehouse menu. We only group by location by default. Use date_expected instead of date in stock level forecast and group dates by week by default. --- addons/stock/report/report_stock_forecast.py | 12 +++--- addons/stock/report/report_stock_forecast.xml | 9 ++-- addons/stock/stock_view.xml | 42 +++++++++++++++---- .../wizard/stock_valuation_history.py | 2 +- .../wizard/stock_valuation_history_view.xml | 16 +------ 5 files changed, 46 insertions(+), 35 deletions(-) diff --git a/addons/stock/report/report_stock_forecast.py b/addons/stock/report/report_stock_forecast.py index e89efad5b31..61397d5a25c 100644 --- a/addons/stock/report/report_stock_forecast.py +++ b/addons/stock/report/report_stock_forecast.py @@ -38,7 +38,7 @@ class report_stock_forecast(models.Model): END AS date, SUM(sq.qty) AS product_qty FROM - (SELECT min(date) AS date FROM stock_move AS sm + (SELECT min(date_expected) AS date FROM stock_move AS sm LEFT JOIN stock_location source_location ON sm.location_id = source_location.id LEFT JOIN @@ -59,7 +59,7 @@ class report_stock_forecast(models.Model): SELECT max(sm.id) as id, sm.product_id, - to_date(to_char(sm.date, 'YYYY/MM/DD'), 'YYYY/MM/DD') AS date, + to_date(to_char(sm.date_expected, 'YYYY/MM/DD'), 'YYYY/MM/DD') AS date, SUM(sm.product_qty) AS product_qty FROM stock_move as sm @@ -72,12 +72,12 @@ class report_stock_forecast(models.Model): WHERE sm.state IN ('confirmed','assigned','waiting') and source_location.usage != 'internal' and dest_location.usage = 'internal' - GROUP BY sm.date,sm.product_id + GROUP BY sm.date_expected,sm.product_id UNION ALL SELECT max(sm.id) as id, sm.product_id, - to_date(to_char(sm.date, 'YYYY/MM/DD'), 'YYYY/MM/DD') AS date, + to_date(to_char(sm.date_expected, 'YYYY/MM/DD'), 'YYYY/MM/DD') AS date, SUM(-(sm.product_qty)) AS product_qty FROM stock_move as sm @@ -90,7 +90,7 @@ class report_stock_forecast(models.Model): WHERE sm.state IN ('confirmed','assigned','waiting') and source_location.usage = 'internal' and dest_location.usage != 'internal' - GROUP BY sm.date,sm.product_id) + GROUP BY sm.date_expected,sm.product_id) as MAIN LEFT JOIN (SELECT DISTINCT date @@ -98,7 +98,7 @@ class report_stock_forecast(models.Model): ( SELECT CURRENT_DATE AS DATE UNION ALL - SELECT to_date(to_char(sm.date, 'YYYY/MM/DD'), 'YYYY/MM/DD') AS date + SELECT to_date(to_char(sm.date_expected, 'YYYY/MM/DD'), 'YYYY/MM/DD') AS date FROM stock_move sm LEFT JOIN stock_location source_location ON sm.location_id = source_location.id diff --git a/addons/stock/report/report_stock_forecast.xml b/addons/stock/report/report_stock_forecast.xml index 5e40b79cc68..269611c8777 100644 --- a/addons/stock/report/report_stock_forecast.xml +++ b/addons/stock/report/report_stock_forecast.xml @@ -6,8 +6,7 @@ report.stock.forecast - - + @@ -17,7 +16,7 @@ Stock.forecast.graph report.stock.forecast - + @@ -32,8 +31,8 @@ - - + + diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index 9f60e360c41..0ffe0dc8aaf 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -1687,6 +1687,10 @@ + + + + @@ -1705,8 +1709,18 @@ Quants stock.quant form - tree,form,graph - This analysis gives you a fast overview on the current stock level of your products and their today's inventory value. + tree,form + {'search_default_internal_loc': 1, 'group_by': ['product_id', 'location_id']} + This analysis gives you a fast overview on the current stock level of your products and their current inventory value. + + + + Current Inventory + stock.quant + form + pivot,graph + {'search_default_internal_loc': 1} + This analysis gives you a fast overview on the current stock level of your products and their current inventory value. @@ -1759,19 +1773,31 @@ - + stock.quant.graph stock.quant - - - - + + + + + + stock.quant.pivot + stock.quant + + + + + + + + + @@ -1784,7 +1810,7 @@ - + {'default_product_id': active_id, 'search_default_product_id': active_id} diff --git a/addons/stock_account/wizard/stock_valuation_history.py b/addons/stock_account/wizard/stock_valuation_history.py index 193b19cbc7b..9b5db80f7b2 100644 --- a/addons/stock_account/wizard/stock_valuation_history.py +++ b/addons/stock_account/wizard/stock_valuation_history.py @@ -29,7 +29,7 @@ class wizard_valuation_history(osv.osv_memory): 'domain': "[('date', '<=', '" + data['date'] + "')]", 'name': _('Stock Value At Date'), 'view_type': 'form', - 'view_mode': 'tree,graph', + 'view_mode': 'tree', 'res_model': 'stock.history', 'type': 'ir.actions.act_window', 'context': ctx, diff --git a/addons/stock_account/wizard/stock_valuation_history_view.xml b/addons/stock_account/wizard/stock_valuation_history_view.xml index d2026b5a5ab..3561fe3c7a9 100644 --- a/addons/stock_account/wizard/stock_valuation_history_view.xml +++ b/addons/stock_account/wizard/stock_valuation_history_view.xml @@ -51,7 +51,7 @@ - + @@ -94,20 +94,6 @@ - - - Current Inventory - stock.history - ir.actions.act_window - [('date','<=',time.strftime('%Y-%m-%d %H:%M:%S'))] - form - tree,pivot,graph - - From b577e16411d78413c248a8ffbcce84b4b5871a88 Mon Sep 17 00:00:00 2001 From: Arthur Maniet Date: Fri, 27 Mar 2015 13:11:04 +0100 Subject: [PATCH 011/235] [FIX] account bank statement import ofx: use provided balance as end balance instead of start balance --- .../account_bank_statement_import_ofx.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/account_bank_statement_import_ofx/account_bank_statement_import_ofx.py b/addons/account_bank_statement_import_ofx/account_bank_statement_import_ofx.py index 61e67d51021..bf36347d88b 100644 --- a/addons/account_bank_statement_import_ofx/account_bank_statement_import_ofx.py +++ b/addons/account_bank_statement_import_ofx/account_bank_statement_import_ofx.py @@ -60,7 +60,9 @@ class account_bank_statement_import(osv.TransientModel): vals_bank_statement = { 'name': ofx.account.routing_number, 'transactions': transactions, - 'balance_start': ofx.account.statement.balance, - 'balance_end_real': float(ofx.account.statement.balance) + total_amt, + # WARNING: the provided ledger balance is not necessarily the ending balance of the statement + # see https://github.com/odoo/odoo/issues/3003 + 'balance_start': float(ofx.account.statement.balance) - total_amt, + 'balance_end_real': ofx.account.statement.balance, } return ofx.account.statement.currency, ofx.account.number, [vals_bank_statement] From 2b7a6e29330deb18e8de7fb7f2118bf6b28fee9d Mon Sep 17 00:00:00 2001 From: Monica Date: Thu, 19 Mar 2015 00:29:50 -0400 Subject: [PATCH 012/235] [FIX] purchase_requisition: avoid errors on service based requisitions When the product type is Service, the procurement doesn't have stock move. Confirming the purchase order linked to such procurement would fail. --- addons/purchase_requisition/purchase_requisition.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/purchase_requisition/purchase_requisition.py b/addons/purchase_requisition/purchase_requisition.py index 2d3708b6710..c66af2c8e55 100644 --- a/addons/purchase_requisition/purchase_requisition.py +++ b/addons/purchase_requisition/purchase_requisition.py @@ -221,7 +221,8 @@ class purchase_order(osv.osv): 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}) + if procurement.move_id: + procurement.move_id.write({'location_id': procurement.move_id.location_dest_id.id}) return res purchase_order() From 7e7ecf36f1fa8a5dac30ef8b2498c448eee30ed8 Mon Sep 17 00:00:00 2001 From: Jos De Graeve Date: Wed, 18 Mar 2015 18:20:25 +0100 Subject: [PATCH 013/235] [FIX] service: error database in use on duplicate database When trying to duplicate a database, while having opened connections to it, postgresql throws ``` OperationalError: source database "duplicate_test" is being accessed by other users DETAIL: There is 1 other session using the database. ``` Connections must be dropped before trying duplication using TEMPLATE to avoid this. --- openerp/service/db.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openerp/service/db.py b/openerp/service/db.py index 485a35c4abd..f5663d462b0 100644 --- a/openerp/service/db.py +++ b/openerp/service/db.py @@ -97,6 +97,7 @@ def exp_duplicate_database(db_original_name, db_name): db = openerp.sql_db.db_connect('postgres') with closing(db.cursor()) as cr: cr.autocommit(True) # avoid transaction block + _drop_conn(cr, db_original_name) cr.execute("""CREATE DATABASE "%s" ENCODING 'unicode' TEMPLATE "%s" """ % (db_name, db_original_name)) from_fs = openerp.tools.config.filestore(db_original_name) From 12fc5ea84092cb0806d8efbff7819affc50f31c1 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 27 Mar 2015 16:27:44 +0100 Subject: [PATCH 014/235] [FIX] website_blog: safer check of variables in write call Some code may call write with only one id instead of a list (e.g. translations, see #5941) and the call to _postproces_content would fail --- addons/website_blog/models/website_blog.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/website_blog/models/website_blog.py b/addons/website_blog/models/website_blog.py index 1b7849b3480..95447c12db9 100644 --- a/addons/website_blog/models/website_blog.py +++ b/addons/website_blog/models/website_blog.py @@ -243,6 +243,8 @@ class BlogPost(osv.Model): return post_id def write(self, cr, uid, ids, vals, context=None): + if isinstance(ids, (int, long)): + ids = [ids] if 'content' in vals: vals['content'] = self._postproces_content(cr, uid, ids[0], vals['content'], context=context) result = super(BlogPost, self).write(cr, uid, ids, vals, context) From ff902f62e249b2134c9c7129f9cf6e8a8107fb1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Ru=CC=88bner?= Date: Wed, 25 Mar 2015 14:07:28 +0100 Subject: [PATCH 015/235] [FIX] base: update of source value in translation Make sure pass a list of ids instead of a single id to write calls. Some models (e.g. blog.post, fixed at 12fc5ea) are assuming that it got a list of ids and is not checking the type. Always pass a list of ids as it's the expected format for the orm. --- openerp/addons/base/ir/ir_translation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/addons/base/ir/ir_translation.py b/openerp/addons/base/ir/ir_translation.py index 14fe9000334..a69c30a55ba 100644 --- a/openerp/addons/base/ir/ir_translation.py +++ b/openerp/addons/base/ir/ir_translation.py @@ -203,7 +203,7 @@ class ir_translation(osv.osv): #Also not removing lang from context trigger an error when lang is different context_wo_lang = context.copy() context_wo_lang.pop('lang', None) - model.write(cr, uid, record.res_id, {field: value}, context=context_wo_lang) + model.write(cr, uid, [record.res_id], {field: value}, context=context_wo_lang) return self.write(cr, uid, id, {'src': value}, context=context) _columns = { From ade57d1a6f0be88460571d75e05cc0f998702ad3 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Fri, 27 Mar 2015 16:53:54 +0100 Subject: [PATCH 016/235] [FIX] website_event_questions: inability to delete quotation line linked to a event.registration.answer. On the ecommerce, when ordering a place for an event, and answering to an event.registration.answer, it wasn't possible to delete the quotation line (missing ON DELETE CASCADE) opw-631619 --- addons/website_event_questions/models/event.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/website_event_questions/models/event.py b/addons/website_event_questions/models/event.py index 3d9165357b7..77cdf75ada4 100644 --- a/addons/website_event_questions/models/event.py +++ b/addons/website_event_questions/models/event.py @@ -23,8 +23,8 @@ class EventRegistrationAnswer(models.Model): _name = 'event.registration.answer' _table = 'event_registration_answer' - event_answer_id = fields.Many2one('event.answer', required=True) - event_registration_id = fields.Many2one('event.registration', required=True) + event_answer_id = fields.Many2one('event.answer', required=True, ondelete='cascade') + event_registration_id = fields.Many2one('event.registration', required=True, ondelete='cascade') class EventRegistration(models.Model): From 62bc5c81232f5baf06276904e77ad1a982fbfa0b Mon Sep 17 00:00:00 2001 From: Arthur Maniet Date: Fri, 27 Mar 2015 16:59:48 +0100 Subject: [PATCH 017/235] [FIX] account bank statement import ofx: fix amounts used in test case --- .../tests/test_import_bank_statement.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account_bank_statement_import_ofx/tests/test_import_bank_statement.py b/addons/account_bank_statement_import_ofx/tests/test_import_bank_statement.py index 3fc5fdff2be..6a6215fa6df 100644 --- a/addons/account_bank_statement_import_ofx/tests/test_import_bank_statement.py +++ b/addons/account_bank_statement_import_ofx/tests/test_import_bank_statement.py @@ -25,5 +25,5 @@ class TestOfxFile(TransactionCase): self.statement_import_model.import_file(cr, uid, [bank_statement_id]) statement_id = self.bank_statement_model.search(cr, uid, [('name', '=', '000000123')])[0] bank_st_record = self.bank_statement_model.browse(cr, uid, statement_id) - self.assertEquals(bank_st_record.balance_start, 2156.56) - self.assertEquals(bank_st_record.balance_end_real, 1796.56) + self.assertEquals(bank_st_record.balance_start, 2516.56) + self.assertEquals(bank_st_record.balance_end_real, 2156.56) From 26abbf676dcba5ebebdf4b2912384ea7367e3bf5 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Fri, 27 Mar 2015 17:17:21 +0100 Subject: [PATCH 018/235] [FIX] website_mail: remove unused alert div, fixes look of input-group-btn Bootstrap's CSS depends on the input-group-btn element being the first/last child of its parent. This was not the case because of the invisible and useless alert. --- addons/website_mail/static/src/js/follow.js | 3 +-- addons/website_mail/views/website_mail.xml | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/addons/website_mail/static/src/js/follow.js b/addons/website_mail/static/src/js/follow.js index 54b64c949cf..c173f68ecae 100644 --- a/addons/website_mail/static/src/js/follow.js +++ b/addons/website_mail/static/src/js/follow.js @@ -19,9 +19,8 @@ self.$target.removeClass("hidden"); }); - // not if editable mode to allow designer to edit alert field + // not if editable mode to allow designer to edit if (!editable_mode) { - $('.js_follow > .alert').addClass("hidden"); $('.js_follow > .input-group-btn.hidden').removeClass("hidden"); this.$target.find('.js_follow_btn, .js_unfollow_btn').on('click', function (event) { event.preventDefault(); diff --git a/addons/website_mail/views/website_mail.xml b/addons/website_mail/views/website_mail.xml index eefe29ebbb4..b8207839b02 100644 --- a/addons/website_mail/views/website_mail.xml +++ b/addons/website_mail/views/website_mail.xml @@ -16,7 +16,6 @@ - From 2e60513c15f01b2c8f30158cd39565b77cc14241 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Fri, 27 Mar 2015 17:34:58 +0100 Subject: [PATCH 019/235] [FIX] website_links: linker access rights Links shortener is a tool needed by Website managers, restricting this tool to ERP manager is a bit too restrictive. Website managers is probably too restrictive as well, maybe all employees should be able to access this feature. Before having a real use case, giving this tool to website managers is enough at this time. opw-631511 --- addons/website_links/security/ir.model.access.csv | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/website_links/security/ir.model.access.csv b/addons/website_links/security/ir.model.access.csv index a734f942c5f..56f1e1dd457 100644 --- a/addons/website_links/security/ir.model.access.csv +++ b/addons/website_links/security/ir.model.access.csv @@ -1,10 +1,10 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink access_website_links_user,website.links,model_website_links,base.group_user,1,0,0,0 -access_website_links_manager,website.links,model_website_links,base.group_erp_manager,1,1,1,1 +access_website_links_manager,website.links,model_website_links,base.group_website_designer,1,1,1,1 access_website_links_public,website.links,model_website_links,base.group_public,1,0,0,0 access_website_links_code_user,website.links.code,model_website_links_code,base.group_user,1,0,0,0 -access_website_links_code_manager,website.links.code,model_website_links_code,base.group_erp_manager,1,1,1,1 +access_website_links_code_manager,website.links.code,model_website_links_code,base.group_website_designer,1,1,1,1 access_website_links_code_public,website.links.code,model_website_links_code,base.group_public,1,0,0,0 access_website_links_click_user,website.links.click,model_website_links_click,base.group_user,1,0,0,0 -access_website_links_click_manager,website.links.click,model_website_links_click,base.group_erp_manager,1,1,1,1 +access_website_links_click_manager,website.links.click,model_website_links_click,base.group_website_designer,1,1,1,1 access_website_links_click_public,website.links.click,model_website_links_click,base.group_public,1,0,0,0 From d969e606995bba0c354f68409eff15ca199d7c42 Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Mon, 23 Mar 2015 12:19:27 +0100 Subject: [PATCH 020/235] [IMP] Change the naming of pull rule to procurement rule --- addons/mrp/stock.py | 2 +- addons/procurement/procurement_view.xml | 4 +-- addons/purchase/stock.py | 2 +- addons/stock/stock.py | 30 +++++++++---------- addons/stock/stock_view.xml | 4 +-- .../addons/base/tests/test_mail_examples.py | 2 +- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/addons/mrp/stock.py b/addons/mrp/stock.py index 249d4a9548f..0aa91010c14 100644 --- a/addons/mrp/stock.py +++ b/addons/mrp/stock.py @@ -305,7 +305,7 @@ class stock_warehouse(osv.osv): def _handle_renaming(self, cr, uid, warehouse, name, code, context=None): res = super(stock_warehouse, self)._handle_renaming(cr, uid, warehouse, name, code, context=context) pull_obj = self.pool.get('procurement.rule') - #change the manufacture pull rule name + #change the manufacture procurement rule name if warehouse.manufacture_pull_id: pull_obj.write(cr, uid, warehouse.manufacture_pull_id.id, {'name': warehouse.manufacture_pull_id.name.replace(warehouse.name, name, 1)}, context=context) return res diff --git a/addons/procurement/procurement_view.xml b/addons/procurement/procurement_view.xml index 5b6f935d9f9..1e2bad4c8d2 100644 --- a/addons/procurement/procurement_view.xml +++ b/addons/procurement/procurement_view.xml @@ -208,7 +208,7 @@ procurement.rule - + @@ -221,7 +221,7 @@ procurement.rule -
    +