summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--addons/account/models/account_move.py13
-rw-r--r--addons/im_livechat/controllers/main.py7
-rw-r--r--addons/l10n_uk/__manifest__.py2
-rw-r--r--addons/purchase/models/purchase.py6
-rw-r--r--addons/web/static/src/js/core/utils.js2
-rw-r--r--addons/web_editor/static/src/js/editor/summernote.js8
-rw-r--r--addons/website_sale_comparison/models/website_sale_comparison.py2
-rw-r--r--odoo/addons/base/models/ir_model.py2
-rw-r--r--odoo/addons/base/tests/test_float.py2
-rw-r--r--odoo/tools/float_utils.py2
10 files changed, 30 insertions, 16 deletions
diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py
index 23a60c1423c..29bd05b70ad 100644
--- a/addons/account/models/account_move.py
+++ b/addons/account/models/account_move.py
@@ -515,12 +515,13 @@ class AccountMoveLine(models.Model):
#compute the default credit/debit of the next line in case of a manual entry
balance = 0
- for line in self._context['line_ids']:
- if line[2]: # in case of command 0: add a record with values
- balance += line[2].get('debit', 0) - line[2].get('credit', 0)
- elif line[0] == 2: # line has been deleted
- line_obj = self.browse(line[1])
- balance -= line_obj.debit - line_obj.credit
+ for line in self.move_id.resolve_2many_commands(
+ 'line_ids', self._context['line_ids'], fields=['credit', 'debit']):
+ balance += line.get('debit', 0) - line.get('credit', 0)
+ # if we are here, line_ids is in context, so journal_id should also be.
+ currency = self._context.get('journal_id') and self.browse(self._context['journal_id']).company_id.currency_id
+ if currency:
+ balance = currency.round(balance)
if balance < 0:
rec.update({'debit': -balance})
if balance > 0:
diff --git a/addons/im_livechat/controllers/main.py b/addons/im_livechat/controllers/main.py
index 79a5f28b99b..381874903b9 100644
--- a/addons/im_livechat/controllers/main.py
+++ b/addons/im_livechat/controllers/main.py
@@ -80,7 +80,6 @@ class LivechatController(http.Controller):
@http.route('/im_livechat/feedback', type='json', auth='public')
def feedback(self, uuid, rate, reason=None, **kwargs):
Channel = request.env['mail.channel']
- Rating = request.env['rating.rating']
channel = Channel.sudo().search([('uuid', '=', uuid)], limit=1)
if channel:
# limit the creation : only ONE rating per session
@@ -101,7 +100,11 @@ class LivechatController(http.Controller):
# if logged in user, set its partner on rating
values['partner_id'] = request.env.user.partner_id.id if request.session.uid else False
# create the rating
- rating = Rating.sudo().create(values)
+
+ channel.write({
+ 'rating_ids': [(0, False, values)]
+ })
+ rating = channel.rating_ids[0]
else:
rating = channel.rating_ids[0]
rating.write(values)
diff --git a/addons/l10n_uk/__manifest__.py b/addons/l10n_uk/__manifest__.py
index e35c1478840..b1765ff6f6c 100644
--- a/addons/l10n_uk/__manifest__.py
+++ b/addons/l10n_uk/__manifest__.py
@@ -15,7 +15,7 @@ This is the latest UK Odoo localisation necessary to run Odoo accounting for UK
- InfoLogic UK counties listing
- a few other adaptations""",
'author': 'SmartMode LTD',
- 'website': 'http://www.smartmode.co.uk',
+ 'website': 'https://www.odoo.com/page/accounting',
'depends': [
'account',
'base_iban',
diff --git a/addons/purchase/models/purchase.py b/addons/purchase/models/purchase.py
index 5697ce004c9..e591b9a20a0 100644
--- a/addons/purchase/models/purchase.py
+++ b/addons/purchase/models/purchase.py
@@ -699,6 +699,12 @@ class PurchaseOrderLine(models.Model):
if move.location_dest_id.usage == "supplier":
if move.to_refund:
total -= move.product_uom._compute_quantity(move.product_uom_qty, line.product_uom)
+ elif move.origin_returned_move_id._is_dropshipped() and not move._is_dropshipped_returned():
+ # Edge case: the dropship is returned to the stock, no to the supplier.
+ # In this case, the received quantity on the PO is set although we didn't
+ # receive the product physically in our stock. To avoid counting the
+ # quantity twice, we do nothing.
+ pass
else:
total += move.product_uom._compute_quantity(move.product_uom_qty, line.product_uom)
line.qty_received = total
diff --git a/addons/web/static/src/js/core/utils.js b/addons/web/static/src/js/core/utils.js
index ffeb4a1de87..18fa99097ce 100644
--- a/addons/web/static/src/js/core/utils.js
+++ b/addons/web/static/src/js/core/utils.js
@@ -324,7 +324,7 @@ var utils = {
}
var normalized_value = value / precision;
var epsilon_magnitude = Math.log(Math.abs(normalized_value))/Math.log(2);
- var epsilon = Math.pow(2, epsilon_magnitude - 53);
+ var epsilon = Math.pow(2, epsilon_magnitude - 52);
normalized_value += normalized_value >= 0 ? epsilon : -epsilon;
/**
diff --git a/addons/web_editor/static/src/js/editor/summernote.js b/addons/web_editor/static/src/js/editor/summernote.js
index f3d895c1b76..e67bf160e53 100644
--- a/addons/web_editor/static/src/js/editor/summernote.js
+++ b/addons/web_editor/static/src/js/editor/summernote.js
@@ -2095,14 +2095,16 @@ $.summernote.pluginEvents.applyFont = function (event, editor, layoutInfo, color
}
// apply font: foreColor, backColor, size (the color can be use a class text-... or bg-...)
- var font, $font, fonts = [], className;
+ var ancestors, font, $font, fonts = [], className;
var i;
if (color || bgcolor || size) {
for (i=0; i<nodes.length; i++) {
node = nodes[i];
- font = dom.ancestor(node, dom.isFont);
- if (!font) {
+ ancestors = dom.listAncestor(node, dom.isFont);
+ font = ancestors.slice(-1)[0];
+ // add font if node is not inside a font or inside an anchor firstly
+ if (!dom.isFont(font) || ancestors.filter(dom.isAnchor).length) {
if (node.textContent.match(/^[ ]|[ ]$/)) {
node.textContent = node.textContent.replace(/^[ ]|[ ]$/g, '\u00A0');
}
diff --git a/addons/website_sale_comparison/models/website_sale_comparison.py b/addons/website_sale_comparison/models/website_sale_comparison.py
index 88be2499c0a..a03da2638f0 100644
--- a/addons/website_sale_comparison/models/website_sale_comparison.py
+++ b/addons/website_sale_comparison/models/website_sale_comparison.py
@@ -9,7 +9,7 @@ class ProductAttributeCategory(models.Model):
_description = "Product Attribute Category"
_order = 'sequence'
- name = fields.Char("Category Name", required=True)
+ name = fields.Char("Category Name", required=True, translate=True)
sequence = fields.Integer("Sequence", default=10)
diff --git a/odoo/addons/base/models/ir_model.py b/odoo/addons/base/models/ir_model.py
index a70e5044ea3..9459165215a 100644
--- a/odoo/addons/base/models/ir_model.py
+++ b/odoo/addons/base/models/ir_model.py
@@ -1242,7 +1242,7 @@ class IrModelAccess(models.Model):
else:
msg_tail = _("Please contact your system administrator if you think this is an error.") + "\n\n(" + _("Document model") + ": %s)"
msg_params = (model,)
- msg_tail += ' - ({} {}, {} {})'.format(_('Operation:'), mode, _('User:'), self._uid)
+ msg_tail += u' - ({} {}, {} {})'.format(_('Operation:'), mode, _('User:'), self._uid)
_logger.info('Access Denied by ACLs for operation: %s, uid: %s, model: %s', mode, self._uid, model)
msg = '%s %s' % (msg_heads[mode], msg_tail)
raise AccessError(msg % msg_params)
diff --git a/odoo/addons/base/tests/test_float.py b/odoo/addons/base/tests/test_float.py
index a5f91982303..641c9c2d9e7 100644
--- a/odoo/addons/base/tests/test_float.py
+++ b/odoo/addons/base/tests/test_float.py
@@ -27,6 +27,8 @@ class TestFloatPrecision(TransactionCase):
try_round(0.0049,'0.00') # 0.0049 is closer to 0 than to 0.01, so should round down
try_round(0.005,'0.01') # the rule is to round half away from zero
try_round(-0.005,'-0.01') # the rule is to round half away from zero
+ try_round(6.6 * 0.175, '1.16') # 6.6 * 0.175 is rounded to 1.15 with epsilon = 53
+ try_round(-6.6 * 0.175, '-1.16')
def try_zero(amount, expected):
self.assertEqual(currency.is_zero(amount), expected,
diff --git a/odoo/tools/float_utils.py b/odoo/tools/float_utils.py
index 041a87cabbe..eb3c0b4bd01 100644
--- a/odoo/tools/float_utils.py
+++ b/odoo/tools/float_utils.py
@@ -73,7 +73,7 @@ def float_round(value, precision_digits=None, precision_rounding=None, rounding_
normalized_value = value / rounding_factor # normalize
sign = math.copysign(1.0, normalized_value)
epsilon_magnitude = math.log(abs(normalized_value), 2)
- epsilon = 2**(epsilon_magnitude-53)
+ epsilon = 2**(epsilon_magnitude-52)
# TIE-BREAKING: UP/DOWN (for ceiling[resp. flooring] operations)
# When rounding the value up[resp. down], we instead subtract[resp. add] the epsilon value