From c8df0333f5aca04d2923c34f4efa9d79b50d4a3f Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Thu, 14 Dec 2017 12:54:00 +0100 Subject: [PATCH 1/3] [FIX] mrp: determine order of mrp.production The order of production was first based on "priority DESC" and then "date_planned ASC". So for production with the same priority/date_planned the order is not deterministic. This commit make the order deterministic as it seems preferred. opw-784243 closes #21644 --- addons/mrp/mrp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index 9755b53bc9c..f8de7e29320 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -622,7 +622,7 @@ class mrp_production(osv.osv): ('name_uniq', 'unique(name, company_id)', 'Reference must be unique per Company!'), ] - _order = 'priority desc, date_planned asc' + _order = 'priority desc, date_planned asc, id' def _check_qty(self, cr, uid, ids, context=None): for order in self.browse(cr, uid, ids, context=context): From 69d4383d7bcc52cf69628ec029bfffff387b04ea Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Thu, 14 Dec 2017 12:45:39 +0100 Subject: [PATCH 2/3] [FIX] web_editor: browser-unify alignment editor option Summernote uses `document.execCommand` to apply most styles when editing, leveraging the implementation to the browser. Summernote is configured to use HTML styling (`'styleWithSpan': false`), and in this case, browsers such as Firefox use HTML attributes for styling text align, while Chrome still uses CSS for that. In fact, `document.execCommand` is browser-inconsistent... but so is the `styleWithSpan` option. Indeed, setting the option to `true` will make Firefox use CSS property for alignment too... but not Internet Explorer. So we might consider changing this option's value but this would not solve the current problem. Indeed, any CSS `text-align` style in Firefox takes precedence above the element's `align` attribute, so when users were trying to align text on stuff that was pre-aligned, they were unable to do so. We can better explain the situation with this example: A user tries to left-align in Firefox a `p.text-center` element, and produces this: ```html

``` (`align` attribute is ignored because of the `text-center` class) On Chrome, this would be produced with the same steps: ```html

``` With this patch, we actually make that HTML look like expected by the user, no matter the browser he's using, by forcing the editor to use the text-align CSS property. Note that the implementation is quite ugly but had to take care of compatibility. See https://github.com/odoo/odoo/pull/20900 (thanks to @Yajo for original PR) --- addons/web_editor/static/src/js/summernote.js | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/addons/web_editor/static/src/js/summernote.js b/addons/web_editor/static/src/js/summernote.js index bdd365ff93f..8385a79fb39 100644 --- a/addons/web_editor/static/src/js/summernote.js +++ b/addons/web_editor/static/src/js/summernote.js @@ -19,6 +19,57 @@ var editor = eventHandler.modules.editor; var renderer = $.summernote.renderer; var options = $.summernote.options; +// Browser-unify execCommand +var oldJustify = {}; +_.each(['Left', 'Right', 'Full', 'Center'], function (align) { + oldJustify[align] = editor['justify' + align]; + editor['justify' + align] = function ($editable, value) { + // Before calling the standard function, check all elements which have + // an 'align' attribute and mark them with their value + var $align = $editable.find('[align]'); + _.each($align, function (el) { + var $el = $(el); + $el.data('__align', $el.attr('align')); + }); + + // Call the standard function + oldJustify[align].apply(this, arguments); + + // Then: + + // Remove the text-align of elements which lost the 'align' attribute + var $newAlign = $editable.find('[align]'); + $align.not($newAlign).css('text-align', ''); + + // Transform the 'align' attribute into the 'text-align' css + // property for elements which received the 'align' attribute or whose + // 'align' attribute changed + _.each($newAlign, function (el) { + var $el = $(el); + + var oldAlignValue = $align.data('__align'); + var alignValue = $el.attr('align'); + if (oldAlignValue === alignValue) { + // If the element already had an 'align' attribute and that it + // did not changed, do nothing (compatibility) + return; + } + + $el.removeAttr('align'); + $el.css('text-align', alignValue); + + // Note the first step (removing the text-align of elemnts which + // lost the 'align' attribute) is kinda the same as this one, but + // this one handles the elements which have been edited with chrome + // or with this new system + $el.find('*').css('text-align', ''); + }); + + // Unmark the elements + $align.removeData('__align'); + }; +}); + ////////////////////////////////////////////////////////////////////////////////////////////////////////// /* Add method to Summernote*/ From 9bba7fea42be534fd100d809dfd1dc632ee9ace4 Mon Sep 17 00:00:00 2001 From: qdp-odoo Date: Fri, 15 Dec 2017 15:50:43 +0100 Subject: [PATCH 3/3] [FIX] l10n_ch: update taxes for 2018 - Added taxes for year 2018 of sales and purchase with percentage 3.7 and 7.7 - Added tags to show newly added tax in VAT report(enterprise branch) for Switzerland Was PR #20851. Was task 39082. --- addons/l10n_ch/chart/fiscal_position.xml | 32 ++++- addons/l10n_ch/chart/vat2011.xml | 159 +++++++++++++++++++++++ 2 files changed, 189 insertions(+), 2 deletions(-) diff --git a/addons/l10n_ch/chart/fiscal_position.xml b/addons/l10n_ch/chart/fiscal_position.xml index 70c402d6cf2..7dde57a5d7b 100644 --- a/addons/l10n_ch/chart/fiscal_position.xml +++ b/addons/l10n_ch/chart/fiscal_position.xml @@ -18,6 +18,16 @@ + + + + + + + + + + @@ -28,6 +38,16 @@ + + + + + + + + + + @@ -45,13 +65,21 @@ - + + + + + - + + + + + diff --git a/addons/l10n_ch/chart/vat2011.xml b/addons/l10n_ch/chart/vat2011.xml index a9dacd98253..58a673fe234 100644 --- a/addons/l10n_ch/chart/vat2011.xml +++ b/addons/l10n_ch/chart/vat2011.xml @@ -33,6 +33,10 @@ Switzerland VAT Form: grid 301 base taxes + + Switzerland VAT Form: grid 302 base + taxes + Switzerland VAT Form: grid 311 base taxes @@ -41,6 +45,10 @@ Switzerland VAT Form: grid 341 base taxes + + Switzerland VAT Form: grid 342 base + taxes + Switzerland VAT Form: grid 381 base taxes @@ -49,6 +57,10 @@ Switzerland VAT Form: grid 301 tax taxes + + Switzerland VAT Form: grid 302 tax + taxes + Switzerland VAT Form: grid 311 tax taxes @@ -57,6 +69,10 @@ Switzerland VAT Form: grid 341 tax taxes + + Switzerland VAT Form: grid 342 tax + taxes + Switzerland VAT Form: grid 381 tax taxes @@ -161,6 +177,75 @@ + + TVA due a 3.7% (TS) + 3.7% + + percent + + sale + + + + + + TVA due à 3.7% (Incl. TS) + 3.7% Incl. + + + percent + + sale + + + + + + TVA 3.7% sur achat B&S (TS) + 3.7% achat + + percent + + purchase + + + + + + TVA 3.7% sur achat B&S (Incl. TS) + 3.7% achat Incl. + + + percent + + purchase + + + + + + TVA 3.7% sur invest. et autres ch. (TS) + 3.7% invest + + percent + + purchase + + + + + + TVA 3.7% sur invest. et autres ch. (Incl. TS) + 3.7% invest Incl. + + + percent + + purchase + + + + TVA due a 3.8% (TS) 3.8% @@ -230,6 +315,80 @@ + + + TVA due a 7.7% (TN) + 7.7% + + + percent + + sale + + + + + + TVA due à 7.7% (Incl. TN) + 7.7% Incl. + + + + percent + + sale + + + + + + TVA 7.7% sur achat B&S (TN) + 7.7% achat + + percent + + + purchase + + + + + + TVA 7.7% sur achat B&S (Incl. TN) + 7.7% achat Incl. + + + percent + + + purchase + + + + + + TVA 7.7% sur invest. et autres ch. (TN) + 7.7% invest. + + percent + + purchase + + + + + + TVA 7.7% sur invest. et autres ch. (Incl. TN) + 7.7% invest. Incl. + + + percent + + purchase + + + + TVA due a 8.0% (TN) 8.0%