From 8245c1d1d87b443701b161d8d4a42df2b4d13aec Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Wed, 1 Jun 2016 18:39:18 +0200 Subject: [PATCH 01/11] [FIX] service.server: drop idle connection attempts Avoid wasting HTTP workers (in prefork server mode) for pending/idle connections. HTTP connections that have not sent anything for 500ms will be dropped. In particular, wkhtmltopdf uses a connection pool to load remote resources. It opens more HTTP connections than necessary and uses a random subset of them, leaving the other idle. On a server that has little available workers this may significantly delay report rendering, and could even lead to a deadlock. OPW-667870 --- openerp/service/server.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openerp/service/server.py b/openerp/service/server.py index f2d67c000ef..c111af01093 100644 --- a/openerp/service/server.py +++ b/openerp/service/server.py @@ -773,6 +773,7 @@ class WorkerHTTP(Worker): """ HTTP Request workers """ def process_request(self, client, addr): client.setblocking(1) + client.settimeout(0.5) client.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) # Prevent fd inherientence close_on_exec flags = fcntl.fcntl(client, fcntl.F_GETFD) | fcntl.FD_CLOEXEC From 3418b9f8aa052ae0aabf940d6332cc0aa77d409d Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Mon, 25 Jul 2016 14:39:16 +0200 Subject: [PATCH 02/11] [FIX] calendar: avoid infinite recurrent event Old check was always ignored since 0 is False. This commit closes #12715 Other fix; when we detach an event, we reset the rrule_type to avoid to have a warning popup (about empty final_date) if the old one value was end_date. --- addons/calendar/calendar.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/calendar/calendar.py b/addons/calendar/calendar.py index 5da9104b6a8..0c38539d677 100644 --- a/addons/calendar/calendar.py +++ b/addons/calendar/calendar.py @@ -1267,7 +1267,7 @@ class calendar_event(osv.Model): """ if data['interval'] and data['interval'] < 0: raise osv.except_osv(_('warning!'), _('interval cannot be negative.')) - if data['count'] and data['count'] <= 0: + if data['end_type'] == 'count' and int(data['count']) <= 0: raise osv.except_osv(_('warning!'), _('count cannot be negative or 0.')) def get_week_string(freq, data): @@ -1537,6 +1537,7 @@ class calendar_event(osv.Model): recurrent_id=real_event_id, recurrent_id_date=data.get('start'), rrule_type=False, + end_type=False, rrule='', recurrency=False, final_date=datetime.strptime(data.get('start'), DEFAULT_SERVER_DATETIME_FORMAT if data['allday'] else DEFAULT_SERVER_DATETIME_FORMAT) + timedelta(hours=values.get('duration', False) or data.get('duration')) From 4712fddd88ca72b812bf966fdd9bde36feb36c7e Mon Sep 17 00:00:00 2001 From: Stefan Rijnhart Date: Wed, 11 May 2016 17:03:53 +0200 Subject: [PATCH 03/11] [FIX] account: never allow modification of posted entries Posted moves are not protected from modification if the journal is set to 'autopost'. If an account move is posted in a journal with 'Autopost' set, it is possible to modify the associated move lines without any restriction. This can for example lead to the creation of unbalanced moves. The original issue fixed by this extra condition (https://bugs.launchpad.net/openobject-addons/+bug/615268) does not occur if the commit is reverted. This reverts 4e95e4223 Closes #12014 opw-683165 --- addons/account/account_move_line.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index fe893b9ccbe..84778dc0928 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -1274,7 +1274,7 @@ class account_move_line(osv.osv): done = {} for line in self.browse(cr, uid, ids, context=context): err_msg = _('Move name (id): %s (%s)') % (line.move_id.name, str(line.move_id.id)) - if line.move_id.state <> 'draft' and (not line.journal_id.entry_posted): + if line.move_id.state <> 'draft': raise osv.except_osv(_('Error!'), _('You cannot do this modification on a confirmed entry. You can just change some non legal fields or you must unconfirm the journal entry first.\n%s.') % err_msg) if line.reconcile_id: raise osv.except_osv(_('Error!'), _('You cannot do this modification on a reconciled entry. You can just change some non legal fields or you must unreconcile first.\n%s.') % err_msg) From 64c80ddb4ac338b47d40c95f699cb61649966c92 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 25 Jul 2016 16:31:14 +0200 Subject: [PATCH 04/11] [FIX] product: add missing argument in read The list of fields was not present, making the call to fail. Closes #11716 --- addons/product/report/product_pricelist.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/product/report/product_pricelist.py b/addons/product/report/product_pricelist.py index 6a49250734f..dd490abc52d 100644 --- a/addons/product/report/product_pricelist.py +++ b/addons/product/report/product_pricelist.py @@ -109,7 +109,7 @@ class product_pricelist(report_sxw.rml_parse): if price_dict[pricelist_id]: price = float_round(price_dict[pricelist_id], precision_digits=sale_price_digits) else: - res = self.pool.get('product.product').read(self.cr, self.uid, [product_id]) + res = self.pool.get('product.product').read(self.cr, self.uid, [product_id], ['list_price']) price = float_round(res[0]['list_price'], precision_digits=sale_price_digits) price = self.formatLang(price, digits=sale_price_digits, currency_obj=pricelist.currency_id) return price From 78f00700e37ae06e02e948d747b4a2cb5868df45 Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Mon, 25 Jul 2016 17:31:30 +0200 Subject: [PATCH 05/11] [FIX] product: keep precision in historized cost field. Now we use the same decimal precision for cost in table 'Historization cost' and 'product'. It is one fix, but that will not fix the case where decimal precision has been updated between 2 historizations. This commit closes #12861 --- addons/product/product.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/product/product.py b/addons/product/product.py index 9bd497cc8c8..b478297e560 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -324,7 +324,7 @@ class produce_price_history(osv.osv): 'company_id': fields.many2one('res.company', required=True), 'product_template_id': fields.many2one('product.template', 'Product Template', required=True, ondelete='cascade'), 'datetime': fields.datetime('Historization Time'), - 'cost': fields.float('Historized Cost'), + 'cost': fields.float('Historized Cost', digits_compute=dp.get_precision('Product Price')), } def _get_default_company(self, cr, uid, context=None): From e1c55b2d2d3fc2ea61160b5305c7219e810553be Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Tue, 26 Jul 2016 10:15:26 +0200 Subject: [PATCH 06/11] [FIX] calendar: avoid local variable referenced before assignment When the get_one_event_synchro crash, the status variable is not initialize. So the return status, content, ... raise an error: "local variable 'status' referenced before assignment" This commit closes the issue #11513 --- addons/google_calendar/google_calendar.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/google_calendar/google_calendar.py b/addons/google_calendar/google_calendar.py index 83aa9e583ea..995490c3cca 100644 --- a/addons/google_calendar/google_calendar.py +++ b/addons/google_calendar/google_calendar.py @@ -361,9 +361,10 @@ class google_calendar(osv.AbstractModel): url = "/calendar/v3/calendars/%s/events/%s" % ('primary', google_id) try: status, content, ask_time = self.pool['google.service']._do_request(cr, uid, url, params, headers, type='GET', context=context) - except: + except Exception, e: _logger.info("Calendar Synchro - In except of get_one_event_synchro") - pass + _logger.info(exception_to_unicode(e)) + return False return status_response(status) and content or False From 077dde3a693d86fc23293ada862e2a7b7d60e083 Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Tue, 26 Jul 2016 13:35:07 +0200 Subject: [PATCH 07/11] [FIX] calendar: don't duplicate all the calendar_contact Before this patch, add_filter was called 2 times. Once when we select a partner in the drop down, we trigger a onchange value to change from false to the partner id. Once to reset to false the value after the first add_filter() This commit closes #9758 --- addons/calendar/static/src/js/base_calendar.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/calendar/static/src/js/base_calendar.js b/addons/calendar/static/src/js/base_calendar.js index 411a5086f31..da9659bc788 100644 --- a/addons/calendar/static/src/js/base_calendar.js +++ b/addons/calendar/static/src/js/base_calendar.js @@ -101,8 +101,11 @@ function reload_favorite_list(result) { }, }); this.ir_model_m2o.insertAfter($('div.oe_calendar_filter')); - this.ir_model_m2o.on('change:value', self, function() { - self.add_filter(); + this.ir_model_m2o.on('change:value', self, function() { + // once selected, we reset the value to false. + if (self.ir_model_m2o.get_value()) { + self.add_filter(); + } }); }, add_filter: function() { From 245e38d242f90f6eebaa4bebd745140de7dd48a1 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 26 Jul 2016 14:53:18 +0200 Subject: [PATCH 08/11] [FIX] doc: remove statusbar_color reference This attribute has been removed from the web framework since b4c28050 and should not keep example of code with it. Related to #5987 --- doc/reference/guidelines.rst | 2 +- doc/reference/views.rst | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/doc/reference/guidelines.rst b/doc/reference/guidelines.rst index 17e50fe89ae..fa62b8cb147 100644 --- a/doc/reference/guidelines.rst +++ b/doc/reference/guidelines.rst @@ -129,7 +129,7 @@ When declaring a record in XML, - + diff --git a/doc/reference/views.rst b/doc/reference/views.rst index c0e639eb9ac..30d708f76bb 100644 --- a/doc/reference/views.rst +++ b/doc/reference/views.rst @@ -366,7 +366,7 @@ system. Available semantic components are: .. todo:: list of widgets & options & specific attributes (e.g. widget=statusbar - statusbar_visible statusbar_colors clickable) + statusbar_visible clickable) ``options`` JSON object specifying configuration option for the field's widget (including default widgets) @@ -505,13 +505,10 @@ The states are shown following the order used in the field (the list in a selection field, etc). States that are always visible are specified with the attribute ``statusbar_visible``. -``statusbar_colors`` can be used to give a custom color to specific states. - :: + statusbar_visible="draft,sent,progress,invoiced,done" /> The Sheet ''''''''' From dbf44a968016c5cd9836686e75224c805f9d104f Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 12 Jul 2016 15:47:45 +0200 Subject: [PATCH 09/11] [FIX] payment_paypal: country and state code required for paypal As explained in: -https://developer.paypal.com/docs/classic/api/country_codes/ -https://developer.paypal.com/docs/classic/api/state_codes/ The country and state code is required to create a paypal transaction. But in some cases, the complete name of the state/province is required. For example, for India, sometimes the complete name of the state is required. Check the list of those state/province in the documentation. Hint: form_preprocess_values opw:682872 --- addons/payment_paypal/models/paypal.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/payment_paypal/models/paypal.py b/addons/payment_paypal/models/paypal.py index fa9c4e7a660..d66b55add50 100644 --- a/addons/payment_paypal/models/paypal.py +++ b/addons/payment_paypal/models/paypal.py @@ -119,8 +119,8 @@ class AcquirerPaypal(osv.Model): 'currency_code': tx_values['currency'] and tx_values['currency'].name or '', 'address1': partner_values['address'], 'city': partner_values['city'], - 'country': partner_values['country'] and partner_values['country'].name or '', - 'state': partner_values['state'] and partner_values['state'].name or '', + 'country': partner_values['country'] and partner_values['country'].code or '', + 'state': partner_values['state'] and (partner_values['state'].code or partner_values['state'].name) or '', 'email': partner_values['email'], 'zip': partner_values['zip'], 'first_name': partner_values['first_name'], From 6742d1fafe3ced17435c377037035d7b14162ff1 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 26 Jul 2016 18:12:14 +0200 Subject: [PATCH 10/11] [FIX] account: wrong initial balance in GL When the General Ledger is printed, the initial balance is zero if the filtering is done by period. It appears that in this case, the method `_query_get` selects all the periods before the selected period range thanks to: `build_ctx_periods(cr, uid, first_period, context['period_from'])` On the other hand, `_query_get` builds the query as: `date_start <= %(date_start)s AND id NOT IN %(period_ids)s` That doesn't make sense since we first choose the periods before the selected period range, then we exclude them. What the method `_query_get` is doing seems wrong, but since this method is used in many reports, it is safer to only fix the GL report directly. Another solution could be https://gist.github.com/nim-odoo/453176d9ae820615e69f9a809a3780cc opw-681601 --- addons/account/report/account_general_ledger.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/account/report/account_general_ledger.py b/addons/account/report/account_general_ledger.py index 54149cf696c..5535b86741f 100644 --- a/addons/account/report/account_general_ledger.py +++ b/addons/account/report/account_general_ledger.py @@ -45,7 +45,6 @@ class general_ledger(report_sxw.rml_parse, common_report_header): self.init_balance = data['form'].get('initial_balance', True) if self.init_balance: ctx2.update({'initial_bal': True}) - self.init_query = obj_move._query_get(self.cr, self.uid, obj='l', context=ctx2) self.display_account = data['form']['display_account'] self.target_move = data['form'].get('target_move', 'all') ctx = self.context.copy() @@ -54,11 +53,14 @@ class general_ledger(report_sxw.rml_parse, common_report_header): period_from_id = data['form']['period_from'] period_to_id = data['form']['period_to'] ctx['periods'] = self.pool["account.period"].build_ctx_periods(self.cr, self.uid, period_from_id, period_to_id) + # Do not let "_query_get" calculate the periods itself + ctx2.update({'periods': ctx['periods']}) elif data['form']['filter'] == 'filter_date': ctx['date_from'] = data['form']['date_from'] ctx['date_to'] = data['form']['date_to'] ctx['state'] = data['form']['target_move'] self.context.update(ctx) + self.init_query = obj_move._query_get(self.cr, self.uid, obj='l', context=ctx2) if (data['model'] == 'ir.ui.menu'): new_ids = [data['form']['chart_account_id']] objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids) From 8ceb9438d13cc4b947d70b629552d0d9c5f57fa4 Mon Sep 17 00:00:00 2001 From: Gourav Chawla Date: Sun, 10 Jul 2016 15:57:41 +0530 Subject: [PATCH 11/11] [CLA] signature for user gouravchawla Closes #12738 --- doc/cla/individual/gouravchawla.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 doc/cla/individual/gouravchawla.md diff --git a/doc/cla/individual/gouravchawla.md b/doc/cla/individual/gouravchawla.md new file mode 100644 index 00000000000..cbdd94b3ebe --- /dev/null +++ b/doc/cla/individual/gouravchawla.md @@ -0,0 +1,9 @@ +India, July 10, 2016 + +I hereby agree to the terms of the Odoo Individual Contributor License Agreement v1.0. + +I declare that I am authorized and able to make this agreement and sign this declaration. + +Signed, + +Gourav Chawla gouravchawla@live.com https://github.com/Gouravchawla