diff --git a/addons/account/models/partner.py b/addons/account/models/partner.py index 54206ceba5a..b6a86f29664 100644 --- a/addons/account/models/partner.py +++ b/addons/account/models/partner.py @@ -260,7 +260,6 @@ class ResPartner(models.Model): def _invoice_total(self): account_invoice_report = self.env['account.invoice.report'] if not self.ids: - self.total_invoiced = 0.0 return True user_currency_id = self.env.user.company_id.currency_id.id diff --git a/addons/account_voucher/models/account_voucher.py b/addons/account_voucher/models/account_voucher.py index 2acc3ba3ec7..efef1680c0a 100644 --- a/addons/account_voucher/models/account_voucher.py +++ b/addons/account_voucher/models/account_voucher.py @@ -123,14 +123,32 @@ class AccountVoucher(models.Model): @api.multi @api.depends('tax_correction', 'line_ids.price_subtotal') def _compute_total(self): + tax_calculation_rounding_method = self.env.user.company_id.tax_calculation_rounding_method for voucher in self: total = 0 tax_amount = 0 + tax_lines_vals_merged = {} for line in voucher.line_ids: tax_info = line.tax_ids.compute_all(line.price_unit, voucher.currency_id, line.quantity, line.product_id, voucher.partner_id) - total += tax_info.get('total_included', 0.0) - tax_amount += sum([t.get('amount',0.0) for t in tax_info.get('taxes', False)]) - voucher.amount = total + voucher.tax_correction + if tax_calculation_rounding_method == 'round_globally': + total += tax_info.get('total_excluded', 0.0) + for t in tax_info.get('taxes', False): + key = ( + t['id'], + t['account_id'], + ) + if key not in tax_lines_vals_merged: + tax_lines_vals_merged[key] = t.get('amount', 0.0) + else: + tax_lines_vals_merged[key] += t.get('amount', 0.0) + else: + total += tax_info.get('total_included', 0.0) + tax_amount += sum([t.get('amount', 0.0) for t in tax_info.get('taxes', False)]) + if tax_calculation_rounding_method == 'round_globally': + tax_amount = sum([voucher.currency_id.round(t) for t in tax_lines_vals_merged.values()]) + voucher.amount = total + tax_amount + voucher.tax_correction + else: + voucher.amount = total + voucher.tax_correction voucher.tax_amount = tax_amount @api.onchange('date') diff --git a/addons/purchase/models/purchase.py b/addons/purchase/models/purchase.py index f4624bc8e81..5697ce004c9 100644 --- a/addons/purchase/models/purchase.py +++ b/addons/purchase/models/purchase.py @@ -929,9 +929,8 @@ class PurchaseOrderLine(models.Model): ''' if not self.product_id: return - seller_min_qty = self.product_id.seller_ids\ - .filtered(lambda r: r.name == self.order_id.partner_id)\ + .filtered(lambda r: r.name == self.order_id.partner_id and (not r.product_id or r.product_id == self.product_id))\ .sorted(key=lambda r: r.min_qty) if seller_min_qty: self.product_qty = seller_min_qty[0].min_qty or 1.0 diff --git a/addons/web/static/lib/jSignature/jSignatureCustom.js b/addons/web/static/lib/jSignature/jSignatureCustom.js index ae51103da3d..6ccd2af79a3 100644 --- a/addons/web/static/lib/jSignature/jSignatureCustom.js +++ b/addons/web/static/lib/jSignature/jSignatureCustom.js @@ -760,7 +760,7 @@ function jSignatureClass(parent, options, instanceExtensions) { // these, when enabled, will hover above the sig area. Hence we append them to DOM before canvas. this.$controlbarUpper = (function(){ var controlbarstyle = 'padding:0 !important; margin:0 !important;'+ - 'width: 100% !important; height: 0 !important; -ms-touch-action: none;'+ + 'width: 100% !important; height: 0 !important; -ms-touch-action: none; touch-action: none;'+ 'margin-top:-1em !important; margin-bottom:1em !important;'; return $('
').appendTo($parent); })(); @@ -771,7 +771,7 @@ function jSignatureClass(parent, options, instanceExtensions) { this.$controlbarLower = (function(){ var controlbarstyle = 'padding:0 !important; margin:0 !important;'+ - 'width: 100% !important; height: 0 !important; -ms-touch-action: none;'+ + 'width: 100% !important; height: 0 !important; -ms-touch-action: none; touch-action: none;'+ 'margin-top:-1.5em !important; margin-bottom:1.5em !important; position: relative;'; return $('').appendTo($parent); })(); @@ -876,7 +876,7 @@ function jSignatureClass(parent, options, instanceExtensions) { $canvas.bind('mouseup.'+apinamespace, drawEndHandler); $canvas.bind('mousedown.'+apinamespace, drawStartHandler); } else { - canvas.ontouchstart = function(e) { + canvas.addEventListener('touchstart', function(e) { canvas.onmousedown = canvas.onmouseup = canvas.onmousemove = undef; this.fatFingerCompensation = ( @@ -886,19 +886,19 @@ function jSignatureClass(parent, options, instanceExtensions) { drawStartHandler(e); - canvas.ontouchend = drawEndHandler; - canvas.ontouchstart = drawStartHandler; - canvas.ontouchmove = drawMoveHandler; - }; - canvas.onmousedown = function(e) { + canvas.addEventListener('touchend', drawEndHandler); + canvas.addEventListener('touchstart', drawStartHandler); + canvas.addEventListener('touchmove', drawMoveHandler); + }); + canvas.addEventListener('mousedown', function(e) { canvas.ontouchstart = canvas.ontouchend = canvas.ontouchmove = undef; drawStartHandler(e); - canvas.onmousedown = drawStartHandler; - canvas.onmouseup = drawEndHandler; - canvas.onmousemove = drawMoveHandler; - } + canvas.addEventListener('mousedown', drawStartHandler); + canvas.addEventListener('mouseup', drawEndHandler); + canvas.addEventListener('mousemove', drawMoveHandler); + }); if (window.navigator.msPointerEnabled) { canvas.onmspointerdown = drawStartHandler; canvas.onmspointerup = drawEndHandler; @@ -1084,28 +1084,16 @@ jSignatureClass.prototype.initializeCanvas = function(settings) { settings.width = '100%'; } - $canvas.css( - 'margin' - , 0 - ).css( - 'padding' - , 0 - ).css( - 'border' - , 'none' - ).css( - 'height' - , settings.height === 'ratio' || !settings.height ? 1 : settings.height.toString(10) - ).css( - 'width' - , settings.width === 'ratio' || !settings.width ? 1 : settings.width.toString(10) - ).css( - '-ms-touch-action' - , 'none' - ).css( - 'background-color', - settings['background-color'] - ); + $canvas.css({ + 'margin': 0, + 'padding': 0, + 'border': 'none', + 'height': settings.height === 'ratio' || !settings.height ? 1 : settings.height.toString(10), + 'width': settings.width === 'ratio' || !settings.width ? 1 : settings.width.toString(10), + '-ms-touch-action': 'none', + 'touch-action': 'none', + 'background-color': settings['background-color'], + }); $canvas.appendTo(this.$parent); diff --git a/addons/web/views/database_manager.html b/addons/web/views/database_manager.html index 11037f13d25..6b616e060dc 100644 --- a/addons/web/views/database_manager.html +++ b/addons/web/views/database_manager.html @@ -29,6 +29,10 @@ }); // close modal on submit $('.modal').on('click','input[type="submit"]', function(ev) { + var form = $(this).closest('form')[0]; + if (form && form.checkValidity && !form.checkValidity()) { + return; + } var modal = $(this).parentsUntil('body', '.modal'); if (modal.hasClass('o_database_backup')) { $(modal).modal('hide'); diff --git a/odoo/models.py b/odoo/models.py index 6fb19da2c1a..7a22538e338 100644 --- a/odoo/models.py +++ b/odoo/models.py @@ -2897,7 +2897,7 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})): _('Missing document(s)') + ':' + _('One of the documents you are trying to access has been deleted, please try again after refreshing.') + '\n\n({} {}, {} {}, {} {}, {} {})'.format( _('Document type:'), self._description, _('Operation:'), operation, - _('Records:'), missing_ids[:6], _('User:'), self._uid, + _('Records:'), list(missing_ids)[:6], _('User:'), self._uid, ) )