diff --git a/addons/l10n_fr_fec/wizard/fec.py b/addons/l10n_fr_fec/wizard/fec.py index 3acc2e7e644..1b1ddf20e9b 100644 --- a/addons/l10n_fr_fec/wizard/fec.py +++ b/addons/l10n_fr_fec/wizard/fec.py @@ -184,14 +184,17 @@ class AccountFrFec(models.TransientModel): unaffected_earnings_amount = float(unaffected_earnings_results[11].replace(',', '.')) - float(unaffected_earnings_results[12].replace(',', '.')) listrow_amount = current_amount + unaffected_earnings_amount if listrow_amount > 0: - listrow[11] = str(listrow_amount) - listrow[12] = '0.00' + listrow[11] = str(listrow_amount).replace('.', ',') + listrow[12] = '0,00' else: - listrow[11] = '0.00' - listrow[12] = str(listrow_amount) + listrow[11] = '0,00' + listrow[12] = str(-listrow_amount).replace('.', ',') w.writerow([s.encode("utf-8") for s in listrow]) #if the unaffected earnings account wasn't in the selection yet: add it manually - if not unaffected_earnings_line and unaffected_earnings_results and unaffected_earnings_results[11] != '0,00' and unaffected_earnings_results[12] != '0,00': + if (not unaffected_earnings_line + and unaffected_earnings_results + and (unaffected_earnings_results[11] != '0,00' + or unaffected_earnings_results[12] != '0,00')): #search an unaffected earnings account unaffected_earnings_account = self.env['account.account'].search([('user_type_id', '=', self.env.ref('account.data_unaffected_earnings').id)], limit=1) if unaffected_earnings_account: diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index beb1fec3790..868769e6d62 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -783,7 +783,8 @@ class mrp_production(osv.osv): proc_obj = self.pool.get("procurement.order") procs = proc_obj.search(cr, uid, [('production_id', 'in', ids)], context=context) if procs: - proc_obj.message_post(cr, uid, procs, body=_('Manufacturing order cancelled.'), context=context) + for proc in procs: + proc_obj.message_post(cr, uid, proc, body=_('Manufacturing order cancelled.'), context=context) proc_obj.write(cr, uid, procs, {'state': 'exception'}, context=context) return True diff --git a/addons/web_editor/static/src/js/backend.js b/addons/web_editor/static/src/js/backend.js index ef0dfe7ed09..611cdb1a1f7 100644 --- a/addons/web_editor/static/src/js/backend.js +++ b/addons/web_editor/static/src/js/backend.js @@ -351,7 +351,12 @@ var FieldTextHtml = widget.extend({ }); }, render_value: function () { - if (this.lang !== this.view.dataset.context.lang || this.$iframe.attr('src').match(/[?&]edit_translations=1/)) { + if (this.$iframe.attr('src').match(/[?&]edit_translations=1/)) { + return; + } + // ONLY HAVE THIS IN 9.0 AND SAAS-11 + var is_editor_onchange = this.get('value') === '

on_change_model_and_list

'; + if (this.lang !== this.view.dataset.context.lang && !is_editor_onchange) { return; } var value = (this.get('value') || "").replace(/^]*>(\s*|)<\/p>$/, ''); diff --git a/addons/website/controllers/main.py b/addons/website/controllers/main.py index 808ac8c5498..93605087f46 100644 --- a/addons/website/controllers/main.py +++ b/addons/website/controllers/main.py @@ -151,9 +151,12 @@ class Website(openerp.addons.web.controllers.main.Home): # rename the -id-page.xml => -id.xml ira.write(cr, uid, last, dict(url="/sitemap-%d.xml" % current_website.id, name="/sitemap-%d.xml" % current_website.id), context=context) else: + # TODO: in master/saas-15, move current_website_id in template directly + pages_with_website = map(lambda p: "%d-%d" % (current_website.id, p), range(1, pages + 1)) + # Sitemaps must be split in several smaller files with a sitemap index content = iuv.render_template(cr, uid, 'website.sitemap_index_xml', dict( - pages=range(1, pages + 1), + pages=pages_with_website, url_root=request.httprequest.url_root, ), context=context) create_sitemap('/sitemap-%d.xml' % current_website.id, content) diff --git a/addons/website_portal_sale/controllers/main.py b/addons/website_portal_sale/controllers/main.py index 275e58b049c..a60408f3f42 100644 --- a/addons/website_portal_sale/controllers/main.py +++ b/addons/website_portal_sale/controllers/main.py @@ -27,7 +27,7 @@ class website_account(website_account): ]) invoices = res_invoices.search([ ('message_partner_ids', 'child_of', [partner.commercial_partner_id.id]), - ('state', 'in', ['open', 'paid', 'cancelled']) + ('state', 'in', ['open', 'paid', 'cancel']) ]) response.qcontext.update({ diff --git a/doc/cla/individual/igallart.md b/doc/cla/individual/igallart.md new file mode 100644 index 00000000000..3bf5a8f735c --- /dev/null +++ b/doc/cla/individual/igallart.md @@ -0,0 +1,11 @@ +Spain, 2017-02-27 + +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, + +Isaac Gallart Bochons igallart@puntsistemes.es https://github.com/igallart diff --git a/openerp/addons/base/ir/ir_cron.py b/openerp/addons/base/ir/ir_cron.py index d1bb7f62ec9..3bcf2faef87 100644 --- a/openerp/addons/base/ir/ir_cron.py +++ b/openerp/addons/base/ir/ir_cron.py @@ -178,20 +178,20 @@ class ir_cron(models.Model): """ db = odoo.sql_db.db_connect(db_name) threading.current_thread().dbname = db_name - cr = db.cursor() jobs = [] try: - # Make sure the database we poll has the same version as the code of base - cr.execute("SELECT 1 FROM ir_module_module WHERE name=%s AND latest_version=%s", ('base', BASE_VERSION)) - if cr.fetchone(): - # Careful to compare timestamps with 'UTC' - everything is UTC as of v6.1. - cr.execute("""SELECT * FROM ir_cron - WHERE numbercall != 0 - AND active AND nextcall <= (now() at time zone 'UTC') - ORDER BY priority""") - jobs = cr.dictfetchall() - else: - _logger.warning('Skipping database %s as its base version is not %s.', db_name, BASE_VERSION) + with db.cursor() as cr: + # Make sure the database we poll has the same version as the code of base + cr.execute("SELECT 1 FROM ir_module_module WHERE name=%s AND latest_version=%s", ('base', BASE_VERSION)) + if cr.fetchone(): + # Careful to compare timestamps with 'UTC' - everything is UTC as of v6.1. + cr.execute("""SELECT * FROM ir_cron + WHERE numbercall != 0 + AND active AND nextcall <= (now() at time zone 'UTC') + ORDER BY priority""") + jobs = cr.dictfetchall() + else: + _logger.warning('Skipping database %s as its base version is not %s.', db_name, BASE_VERSION) except psycopg2.ProgrammingError, e: if e.pgcode == '42P01': # Class 42 — Syntax Error or Access Rule Violation; 42P01: undefined_table @@ -201,8 +201,6 @@ class ir_cron(models.Model): raise except Exception: _logger.warning('Exception in cron:', exc_info=True) - finally: - cr.close() for job in jobs: lock_cr = db.cursor() diff --git a/openerp/models.py b/openerp/models.py index ae37168bfe2..258c62c89a1 100644 --- a/openerp/models.py +++ b/openerp/models.py @@ -3277,6 +3277,11 @@ class BaseModel(object): if field.compute: cls._field_computed[field] = group = groups[field.compute] group.append(field) + for fields in groups.itervalues(): + compute_sudo = fields[0].compute_sudo + if not all(field.compute_sudo == compute_sudo for field in fields): + _logger.warning("%s: inconsistent 'compute_sudo' for computed fields: %s", + self._name, ", ".join(field.name for field in fields)) @api.model def _setup_complete(self): diff --git a/openerp/service/server.py b/openerp/service/server.py index 7f9a8e14bef..2342cde7096 100644 --- a/openerp/service/server.py +++ b/openerp/service/server.py @@ -217,8 +217,12 @@ class ThreadedServer(CommonServer): _logger.debug('cron%d polling for jobs', number) for db_name, registry in registries.iteritems(): while registry.ready: - acquired = openerp.addons.base.ir.ir_cron.ir_cron._acquire_job(db_name) - if not acquired: + try: + acquired = openerp.addons.base.ir.ir_cron.ir_cron._acquire_job(db_name) + if not acquired: + break + except Exception: + _logger.warning('cron%d encountered an Exception:', number, exc_info=True) break def cron_spawn(self):