diff --git a/addons/l10n_fr_fec/wizard/account_fr_fec.py b/addons/l10n_fr_fec/wizard/account_fr_fec.py index 237f8f06162..8f57d844e0a 100644 --- a/addons/l10n_fr_fec/wizard/account_fr_fec.py +++ b/addons/l10n_fr_fec/wizard/account_fr_fec.py @@ -44,8 +44,8 @@ class AccountFrFec(models.TransientModel): '-' AS PieceRef, %s AS PieceDate, '/' AS EcritureLib, - replace(CASE WHEN COALESCE(sum(aml.balance), 0) <= 0 THEN '0,00' ELSE to_char(SUM(aml.balance), '999999999999999D99') END, '.', ',') AS Debit, - replace(CASE WHEN COALESCE(sum(aml.balance), 0) >= 0 THEN '0,00' ELSE to_char(-SUM(aml.balance), '999999999999999D99') END, '.', ',') AS Credit, + replace(CASE WHEN COALESCE(sum(aml.balance), 0) <= 0 THEN '0,00' ELSE to_char(SUM(aml.balance), '000000000000000D99') END, '.', ',') AS Debit, + replace(CASE WHEN COALESCE(sum(aml.balance), 0) >= 0 THEN '0,00' ELSE to_char(-SUM(aml.balance), '000000000000000D99') END, '.', ',') AS Credit, '' AS EcritureLet, '' AS DateLet, %s AS ValidDate, @@ -143,8 +143,8 @@ class AccountFrFec(models.TransientModel): '-' AS PieceRef, %s AS PieceDate, '/' AS EcritureLib, - replace(CASE WHEN sum(aml.balance) <= 0 THEN '0,00' ELSE to_char(SUM(aml.balance), '999999999999999D99') END, '.', ',') AS Debit, - replace(CASE WHEN sum(aml.balance) >= 0 THEN '0,00' ELSE to_char(-SUM(aml.balance), '999999999999999D99') END, '.', ',') AS Credit, + replace(CASE WHEN sum(aml.balance) <= 0 THEN '0,00' ELSE to_char(SUM(aml.balance), '000000000000000D99') END, '.', ',') AS Debit, + replace(CASE WHEN sum(aml.balance) >= 0 THEN '0,00' ELSE to_char(-SUM(aml.balance), '000000000000000D99') END, '.', ',') AS Credit, '' AS EcritureLet, '' AS DateLet, %s AS ValidDate, @@ -228,8 +228,8 @@ class AccountFrFec(models.TransientModel): '-' AS PieceRef, %s AS PieceDate, '/' AS EcritureLib, - replace(CASE WHEN sum(aml.balance) <= 0 THEN '0,00' ELSE to_char(SUM(aml.balance), '999999999999999D99') END, '.', ',') AS Debit, - replace(CASE WHEN sum(aml.balance) >= 0 THEN '0,00' ELSE to_char(-SUM(aml.balance), '999999999999999D99') END, '.', ',') AS Credit, + replace(CASE WHEN sum(aml.balance) <= 0 THEN '0,00' ELSE to_char(SUM(aml.balance), '000000000000000D99') END, '.', ',') AS Debit, + replace(CASE WHEN sum(aml.balance) >= 0 THEN '0,00' ELSE to_char(-SUM(aml.balance), '000000000000000D99') END, '.', ',') AS Credit, '' AS EcritureLet, '' AS DateLet, %s AS ValidDate, @@ -290,14 +290,14 @@ class AccountFrFec(models.TransientModel): AS PieceRef, TO_CHAR(am.date, 'YYYYMMDD') AS PieceDate, CASE WHEN aml.name IS NULL THEN '/' ELSE replace(aml.name, '|', '/') END AS EcritureLib, - replace(CASE WHEN aml.debit = 0 THEN '0,00' ELSE to_char(aml.debit, '999999999999999D99') END, '.', ',') AS Debit, - replace(CASE WHEN aml.credit = 0 THEN '0,00' ELSE to_char(aml.credit, '999999999999999D99') END, '.', ',') AS Credit, + replace(CASE WHEN aml.debit = 0 THEN '0,00' ELSE to_char(aml.debit, '000000000000000D99') END, '.', ',') AS Debit, + replace(CASE WHEN aml.credit = 0 THEN '0,00' ELSE to_char(aml.credit, '000000000000000D99') END, '.', ',') AS Credit, CASE WHEN rec.name IS NULL THEN '' ELSE rec.name END AS EcritureLet, CASE WHEN aml.full_reconcile_id IS NULL THEN '' ELSE TO_CHAR(rec.create_date, 'YYYYMMDD') END AS DateLet, TO_CHAR(am.date, 'YYYYMMDD') AS ValidDate, CASE WHEN aml.amount_currency IS NULL OR aml.amount_currency = 0 THEN '' - ELSE replace(to_char(aml.amount_currency, '999999999999999D99'), '.', ',') + ELSE replace(to_char(aml.amount_currency, '000000000000000D99'), '.', ',') END AS Montantdevise, CASE WHEN aml.currency_id IS NULL THEN '' ELSE rc.name END AS Idevise FROM diff --git a/addons/mass_mailing/static/src/less/themes/theme_default.less b/addons/mass_mailing/static/src/less/themes/theme_default.less index cfd1264e0c7..adfa4bba5ce 100644 --- a/addons/mass_mailing/static/src/less/themes/theme_default.less +++ b/addons/mass_mailing/static/src/less/themes/theme_default.less @@ -50,6 +50,7 @@ // ===== Layout ===== .o_layout { overflow: hidden; + box-sizing: content-box; width: 94%; min-height: 100%; background-color: @o_mm_def_color_alpha; diff --git a/addons/mrp/models/stock_move.py b/addons/mrp/models/stock_move.py index 2ffae162cf4..6334bd198c0 100644 --- a/addons/mrp/models/stock_move.py +++ b/addons/mrp/models/stock_move.py @@ -18,9 +18,11 @@ class StockMoveLots(models.Model): 'stock.production.lot', 'Lot', domain="[('product_id', '=', product_id)]") lot_produced_id = fields.Many2one('stock.production.lot', 'Finished Lot') - lot_produced_qty = fields.Float('Quantity Finished Product', help="Informative, not used in matching") - quantity = fields.Float('To Do', default=1.0) - quantity_done = fields.Float('Done') + lot_produced_qty = fields.Float( + 'Quantity Finished Product', digits=dp.get_precision('Product Unit of Measure'), + help="Informative, not used in matching") + quantity = fields.Float('To Do', default=1.0, digits=dp.get_precision('Product Unit of Measure')) + quantity_done = fields.Float('Done', digits=dp.get_precision('Product Unit of Measure')) product_id = fields.Many2one( 'product.product', 'Product', readonly=True, related="move_id.product_id", store=True) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index c9da99309c6..4d58c0fab74 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -17,6 +17,7 @@ import operator import os import re import sys +import tempfile import time import werkzeug import werkzeug.utils @@ -38,6 +39,7 @@ from odoo.http import content_disposition, dispatch_rpc, request, \ serialize_exception as _serialize_exception from odoo.exceptions import AccessError, UserError from odoo.models import check_method_name +from odoo.service import db _logger = logging.getLogger(__name__) @@ -725,12 +727,15 @@ class Database(http.Controller): @http.route('/web/database/restore', type='http', auth="none", methods=['POST'], csrf=False) def restore(self, master_pwd, backup_file, name, copy=False): try: - data = base64.b64encode(backup_file.read()) - dispatch_rpc('db', 'restore', [master_pwd, name, data, str2bool(copy)]) + with tempfile.NamedTemporaryFile(delete=False) as data_file: + backup_file.save(data_file) + db.restore_db(name, data_file.name, str2bool(copy)) return http.local_redirect('/web/database/manager') except Exception as e: error = "Database restore error: %s" % (str(e) or repr(e)) return self._render_template(error=error) + finally: + os.unlink(data_file.name) @http.route('/web/database/change_password', type='http', auth="none", methods=['POST'], csrf=False) def change_password(self, master_pwd, master_pwd_new): diff --git a/addons/web/static/src/js/core/utils.js b/addons/web/static/src/js/core/utils.js index 585be4d37b8..9bba625eb4b 100644 --- a/addons/web/static/src/js/core/utils.js +++ b/addons/web/static/src/js/core/utils.js @@ -116,7 +116,7 @@ var utils = { size /= 1024; ++i; } - return size.toFixed(2) + ' ' + units[i]; + return size.toFixed(2) + ' ' + units[i].trim(); }, /** * Insert "thousands" separators in the provided number (which is actually diff --git a/addons/web_editor/static/src/js/rte.summernote.js b/addons/web_editor/static/src/js/rte.summernote.js index 866d0d68e84..5f28c9510bb 100644 --- a/addons/web_editor/static/src/js/rte.summernote.js +++ b/addons/web_editor/static/src/js/rte.summernote.js @@ -398,7 +398,9 @@ eventHandler.modules.imageDialog.showImageDialog = function ($editable) { if (r.sc.tagName && r.sc.childNodes.length) { r.sc = r.sc.childNodes[r.so]; } - new widgets.MediaDialog(null, {}, $editable, dom.isImg(r.sc) ? r.sc : null).open(); + new widgets.MediaDialog(null, {}, $editable, $(r.sc).parents().addBack().filter(function (i, el) { + return dom.isImg(el); + })[0]).open(); return new $.Deferred().reject(); }; $.summernote.pluginEvents.alt = function (event, editor, layoutInfo, sorted) { diff --git a/addons/website/models/ir_http.py b/addons/website/models/ir_http.py index 18a13278517..24e0a9bd56d 100644 --- a/addons/website/models/ir_http.py +++ b/addons/website/models/ir_http.py @@ -61,7 +61,7 @@ class Http(models.AbstractModel): if not request.session.uid: env = api.Environment(request.cr, SUPERUSER_ID, request.context) website = env['website'].get_current_website() - if website: + if website and website.user_id: request.uid = website.user_id.id else: request.uid = env.ref('base.public_user').id diff --git a/addons/website/models/website.py b/addons/website/models/website.py index f6fe1bc9c77..a656408da14 100644 --- a/addons/website/models/website.py +++ b/addons/website/models/website.py @@ -177,7 +177,7 @@ class Website(models.Model): google_management_client_id = fields.Char('Google Client ID') google_management_client_secret = fields.Char('Google Client Secret') - user_id = fields.Many2one('res.users', string='Public User', default=lambda self: self.env.ref('base.public_user').id) + user_id = fields.Many2one('res.users', string='Public User', required=True, default=lambda self: self.env.ref('base.public_user').id) cdn_activated = fields.Boolean('Activate CDN for assets') cdn_url = fields.Char('CDN Base URL', default='') cdn_filters = fields.Text('CDN Filters', default=lambda s: '\n'.join(DEFAULT_CDN_FILTERS), help="URL matching those filters will be rewritten using the CDN Base URL") diff --git a/addons/website_blog/controllers/main.py b/addons/website_blog/controllers/main.py index 8e4af85e398..ce9257387a1 100644 --- a/addons/website_blog/controllers/main.py +++ b/addons/website_blog/controllers/main.py @@ -173,7 +173,9 @@ class WebsiteBlog(http.Controller): v = {} v['blog'] = blog v['base_url'] = request.env['ir.config_parameter'].sudo().get_param('web.base.url') - v['posts'] = request.env['blog.post'].search([('blog_id','=', blog.id)], limit=min(int(limit), 50)) + v['posts'] = request.env['blog.post'].search([('blog_id','=', blog.id)], + limit=min(int(limit), 50), + order="post_date DESC") v['html2plaintext'] = html2plaintext r = request.render("website_blog.blog_feed", v, headers=[('Content-Type', 'application/atom+xml')]) return r diff --git a/addons/website_blog/models/website_blog.py b/addons/website_blog/models/website_blog.py index d8daea8a6ff..65bd0c472fe 100644 --- a/addons/website_blog/models/website_blog.py +++ b/addons/website_blog/models/website_blog.py @@ -154,7 +154,7 @@ class BlogPost(models.Model): write_date = fields.Datetime('Last Modified on', index=True, readonly=True) write_uid = fields.Many2one('res.users', 'Last Contributor', index=True, readonly=True) author_avatar = fields.Binary(related='author_id.image_small', string="Avatar") - visits = fields.Integer('No of Views') + visits = fields.Integer('No of Views', copy=False) ranking = fields.Float(compute='_compute_ranking', string='Ranking') @api.multi diff --git a/addons/website_blog/views/website_blog_templates.xml b/addons/website_blog/views/website_blog_templates.xml index bcaa3a4c2aa..49a5210624f 100644 --- a/addons/website_blog/views/website_blog_templates.xml +++ b/addons/website_blog/views/website_blog_templates.xml @@ -552,14 +552,14 @@