From 9b83b1ba64dc58ebc997bf5fdb38264351904c06 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Mon, 18 Dec 2017 09:36:57 +0100 Subject: [PATCH 01/13] [FIX] point_of_sale: prevent scanning on receipt - Sell a Product A - From receipt screen, scan the barcode of Product B - B will be in tab along with A - Pay and validate - Close the session Only an order with Product A is recorded in the session (order 1). When performing this set of actions, a new order is not created: the POS simply reuses the current order. However, `create_from_ui` (called in the receipt screen) discards an order if the reference already exists. This means that the first order is correctly synchronized at validation, while the second order is silently discarded. Closes #16781 opw-766459 --- addons/point_of_sale/static/src/js/screens.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js index 788276ea957..726231a9258 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -1908,6 +1908,7 @@ var PaymentScreenWidget = ScreenWidget.extend({ } order.initialize_validation_date(); + order.finalized = true; if (order.is_to_invoice()) { var invoiced = this.pos.push_and_invoice_order(order); @@ -2010,4 +2011,3 @@ return { }; }); - From f65f0659011413cc5df04f031c31ef72489e28c6 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Tue, 19 Dec 2017 10:10:52 +0100 Subject: [PATCH 02/13] [FIX] web tests: correct wrong route visibility --- addons/web/controllers/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 636f37d293e..2ac11d1c1e4 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -587,7 +587,7 @@ class WebClient(http.Controller): def version_info(self): return openerp.service.common.exp_version() - @http.route('/web/tests', type='http', auth="none") + @http.route('/web/tests', type='http', auth="user") def index(self, mod=None, **kwargs): return request.render('web.qunit_suite') From ad8e1118c1a18c22555abecccfb8ee0eee387e5e Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 14 Dec 2017 11:54:18 +0100 Subject: [PATCH 03/13] [FIX] web: action url never call on_close method On a tree view: - Add a button returning an `act_url` action; e.g.: ``` @api.multi def open_google(self): return { 'type': 'ir.actions.act_url', 'url': 'https://google.fr/', 'target': 'new', } ``` - Click on a button The action call works only once because the button is never re-enabled. The button is actually enabled only at view rendering. Therefore, we call `on_close` in order to reload the view. opw-784587 --- addons/web/static/src/js/action_manager.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/action_manager.js b/addons/web/static/src/js/action_manager.js index 5eb5aaa9891..61978d7132d 100644 --- a/addons/web/static/src/js/action_manager.js +++ b/addons/web/static/src/js/action_manager.js @@ -790,7 +790,7 @@ var ActionManager = Widget.extend({ }); }); }, - ir_actions_act_url: function (action) { + ir_actions_act_url: function (action, options) { var url = action.url; if (session.debug && url && url.length && url[0] === '/') { url = $.param.querystring(url, 'debug'); @@ -800,6 +800,7 @@ var ActionManager = Widget.extend({ framework.redirect(url); } else { window.open(url, '_blank'); + options.on_close(); } return $.when(); }, From a8e444bea88ffbec8016f92a51025dfdea65a90b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul=20=28ACSONE=29?= Date: Tue, 19 Dec 2017 16:48:35 +0100 Subject: [PATCH 04/13] [FIX] l10n_lu: bad line breaks in CSV data This was causing the creation of weird records when installing this module --- addons/l10n_lu/account.account.tag.csv | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/addons/l10n_lu/account.account.tag.csv b/addons/l10n_lu/account.account.tag.csv index 93c9c280973..f25178a068e 100644 --- a/addons/l10n_lu/account.account.tag.csv +++ b/addons/l10n_lu/account.account.tag.csv @@ -179,20 +179,17 @@ tag_lu_177,I.B.5. Tabacs fabriqués,taxes tag_lu_178,Base - Vente Biens Tabacs - Extracommunautaire,taxes tag_lu_179,Base - Vente Biens Tabacs - Intracommunautaire,taxes tag_lu_180,Base - Vente Biens Tabacs - Pays,taxes -tag_lu_181,I.B.6.a) Livraisons subséquentes à des acquisitions intracommunautaires dans -le cadre d'opérations triangulaires, lorsque le destinataire identifié à la TVA dans l'Etat membre de destination des biens y est le redevable de la taxe (4),taxes +tag_lu_181,"I.B.6.a) Livraisons subséquentes à des acquisitions intracommunautaires dans le cadre d'opérations triangulaires, lorsque le destinataire identifié à la TVA dans l'Etat membre de destination des biens y est le redevable de la taxe (4)",taxes tag_lu_182,Base - Vente Biens – Triangulaire Intracommunautaire,taxes tag_lu_183,I.B.6.d) Autres opérations réalisées (imposables) à l'étranger,taxes tag_lu_184,Base - Vente Prestations - Extracommunautaire,taxes tag_lu_185,I.B.6.c) Opérations réalisées dans le cadre du régime particulier de l'article 56sexies,taxes tag_lu_186,I.B.7. Opérations à l'intérieur du pays pour lesquelles le preneur est le redevable,taxes -tag_lu_187,I.B.6.b)1) Prestations de services à des identifiés à la TVA dans un autre -Etat membre non exonérées dans l'Etat membre du preneur redevable (art.17/1/b) (5),taxes +tag_lu_187,I.B.6.b)1) Prestations de services à des identifiés à la TVA dans un autre Etat membre non exonérées dans l'Etat membre du preneur redevable (art.17/1/b) (5),taxes tag_lu_188,Base - Vente Prestations - Intracommunautaire,taxes -tag_lu_189,I.B.6.b)2) Prestations de services à des identifiés à la TVA dans un autre -Etat membre exonérées dans l'Etat membre du preneur (art.17/1/b),taxes +tag_lu_189,I.B.6.b)2) Prestations de services à des identifiés à la TVA dans un autre Etat membre exonérées dans l'Etat membre du preneur (art.17/1/b),taxes tag_lu_190,Base - Vente Prestations - Intracommunautaire exonérées dans l'état membre,taxes -tag_lu_191,I.B.1. Livraisons intracommunautaires de biens à des personnes identifiées à la TVA dans unautre Etat membre (art.43/1/d e et f) (3),taxes +tag_lu_191,I.B.1. Livraisons intracommunautaires de biens à des personnes identifiées à la TVA dans un autre Etat membre (art.43/1/d e et f) (3),taxes tag_lu_192,Base - Vente Biens - Intracommunautaire,taxes tag_lu_193,I.C. Chiffre d'affaires imposable,taxes tag_lu_194,II.A. Ventilation du chiffre d'affaires imposable – base,taxes @@ -598,4 +595,4 @@ tag_lu_594,Taxe - Investissement Prestations 17% - Intracommunautaire (-),taxes tag_lu_595,Taxe - Investissement Prestations 3% - Intracommunautaire (-),taxes tag_lu_596,Taxe - Investissement Prestations 6% - Intracommunautaire (-),taxes tag_lu_597,Taxe - Investissement Prestations 8% - Intracommunautaire (-),taxes -tag_lu_598,Base - Sans Taxe,taxes \ No newline at end of file +tag_lu_598,Base - Sans Taxe,taxes From 06ccccdb7535a21933457761aa59547614de492b Mon Sep 17 00:00:00 2001 From: Florent de Labarre Date: Tue, 19 Dec 2017 17:52:18 +0100 Subject: [PATCH 05/13] [FIX] account: check ACL and ir.rules upon account.move cancellation Was PR #21732. Was OPW 800611. Courtesy of Florent de Labarre --- addons/account/models/account_move.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 8232d99f071..a31acf43e84 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -154,6 +154,8 @@ class AccountMove(models.Model): if not move.journal_id.update_posted: raise UserError(_('You cannot modify a posted entry of this journal.\nFirst you should set the journal to allow cancelling entries.')) if self.ids: + self.check_access_rights('write') + self.check_access_rule('write') self._check_lock_date() self._cr.execute('UPDATE account_move '\ 'SET state=%s '\ From 5651f28cd7050ac70e1570734ebfc96360cf2879 Mon Sep 17 00:00:00 2001 From: Guillaume Masson Date: Wed, 20 Dec 2017 10:56:49 +0100 Subject: [PATCH 06/13] [CLA] add metaminux to TecLib CCLA Done at #21735 --- doc/cla/corporate/teclib.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/cla/corporate/teclib.md b/doc/cla/corporate/teclib.md index ff9db6dd21c..275a2b41300 100644 --- a/doc/cla/corporate/teclib.md +++ b/doc/cla/corporate/teclib.md @@ -12,3 +12,4 @@ List of contributors: Laurent Destailleur ldestailleur@teclib.com https://github.com/eldy David Halgand dhalgand@teclib.com https://github.com/halgandd +Guillaume Masson gmasson@teclib.com https://github.com/metaminux From d8846e8e64456b2498839260051f5f4d56414170 Mon Sep 17 00:00:00 2001 From: Guillaume Masson Date: Wed, 20 Dec 2017 10:57:42 +0100 Subject: [PATCH 07/13] [FIX] l10n_fr_pos_cert: bad import Closes #21735 --- addons/l10n_fr_pos_cert/models/pos.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/l10n_fr_pos_cert/models/pos.py b/addons/l10n_fr_pos_cert/models/pos.py index d6d88604e8c..9ce9694e979 100644 --- a/addons/l10n_fr_pos_cert/models/pos.py +++ b/addons/l10n_fr_pos_cert/models/pos.py @@ -1,4 +1,4 @@ -from datetime import datetime +from datetime import datetime, timedelta from hashlib import sha256 from json import dumps import pytz @@ -41,7 +41,7 @@ class pos_session(models.Model): self.ensure_one() date_today = datetime.utcnow() session_start = Datetime.from_string(self.start_at) - if not date_today - datetime.timedelta(hours=24) <= session_start: + if not date_today - timedelta(hours=24) <= session_start: raise UserError(_("This session has been opened another day. To comply with the French law, you should close sessions on a daily basis. Please close session %s and open a new one.") % self.name) return True From 16065f3ee2f02aba9b7a78f24522fc561cbdc2fe Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Wed, 20 Dec 2017 12:24:03 +0100 Subject: [PATCH 08/13] [FIX] website_sale: hide checkout btn on emptied cart in all languages When an user goes to its cart and removes all the items, the checkout button is hidden so that the user cannot start an order with no product. This behavior was not working in languages which are not the default language of the website, as the button was found in JS relying on the fact it started by "/shop/checkout", while it can be something like "/fr_FR/shop/checkout". Closes https://github.com/odoo/odoo/issues/21722 --- addons/website_sale/static/src/js/website_sale.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website_sale/static/src/js/website_sale.js b/addons/website_sale/static/src/js/website_sale.js index 32c18cb4d5b..914b76c56e0 100644 --- a/addons/website_sale/static/src/js/website_sale.js +++ b/addons/website_sale/static/src/js/website_sale.js @@ -190,7 +190,7 @@ $('.oe_website_sale').each(function () { } else { $q.parent().parent().addClass("hidden"); - $('a[href^="/shop/checkout"]').addClass("hidden") + $('a[href*="/shop/checkout"]').addClass("hidden"); } $q.html(data.cart_quantity).hide().fadeIn(600); From be5950e429e40e79ccc1330a1f6a79cf71d48a5b Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Thu, 16 Nov 2017 13:36:55 +0100 Subject: [PATCH 09/13] [FIX] web_planner: use user language on frontend The web planner specified no language for frontend so the website planner on the frontend was never translated. This commit add a specialized fallback for this use case so the planner on the website is in the language of the current user. The code is the same that get_context from web_editor.base but requiring that would possibly adds delays (for dom_ready) that we don't want. note: this is for 9.0 up to not including 11.0, in 11.0 another solution is used and in master a bigger change is being worked on. opw-781727 fixes #20829 closes #21004 --- addons/web_planner/static/src/js/web_planner_common.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/addons/web_planner/static/src/js/web_planner_common.js b/addons/web_planner/static/src/js/web_planner_common.js index ad27739f2c5..1e230a4f830 100644 --- a/addons/web_planner/static/src/js/web_planner_common.js +++ b/addons/web_planner/static/src/js/web_planner_common.js @@ -66,10 +66,17 @@ var PlannerDialog = Widget.extend({ */ willStart: function() { var self = this; + var context = session.user_context; + // fallback context for frontend + if(_.isEmpty(context)) { + context = { + lang: (document.documentElement.getAttribute('lang')||'').replace('-', '_'), + }; + } var res = this._super.apply(this, arguments).then(function() { return (new Model('web.planner')).call('render', [self.planner.view_id[0], self.planner.planner_application], - {context: session.user_context}); + {context: context}); }).then(function(template) { self.$res = $(template); }); From 49cbeabe104384abcd9d656ef4ed3f4ce94b5b99 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Mon, 18 Dec 2017 14:24:04 +0100 Subject: [PATCH 10/13] [FIX] point_of_sale: prevent taxes of another company to be loaded As admin every tax is loaded, which is wrong anyway. When the admin opens a session a change the cashier in the POS interface, every order is made with every tax ever (on the product) which could lead to major faulty records See the case on OPW 786803 which is critical --- addons/point_of_sale/static/src/js/models.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index 42d652a57dd..9975ca9e307 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -203,7 +203,7 @@ exports.PosModel = Backbone.Model.extend({ },{ model: 'account.tax', fields: ['name','amount', 'price_include', 'include_base_amount', 'amount_type', 'children_tax_ids'], - domain: null, + domain: function(self) {return [['company_id', '=', self.company && self.company.id || false]]}, loaded: function(self, taxes){ self.taxes = taxes; self.taxes_by_id = {}; From 8aa1a493a0574305c81d56e082c532b596d31d42 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 10 Jan 2017 18:25:46 +0100 Subject: [PATCH 11/13] [FIX] account: exchange rate of `price_subtotal_signed` The field `price_subtotal_signed` contains the price converted in the company currency. However, we should make sure to use the exchange rate of the invoice date for its computation. An use problematic use case is the creation of a deferred revenue from an invoice (commit 7fe89d08b3a). opw-702352 --- addons/account/models/account_invoice.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index 7b57b514ead..5b09af3be43 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -1102,7 +1102,8 @@ class AccountInvoiceLine(models.Model): @api.one @api.depends('price_unit', 'discount', 'invoice_line_tax_ids', 'quantity', - 'product_id', 'invoice_id.partner_id', 'invoice_id.currency_id', 'invoice_id.company_id') + 'product_id', 'invoice_id.partner_id', 'invoice_id.currency_id', 'invoice_id.company_id', + 'invoice_id.date_invoice') def _compute_price(self): currency = self.invoice_id and self.invoice_id.currency_id or None price = self.price_unit * (1 - (self.discount or 0.0) / 100.0) @@ -1111,7 +1112,7 @@ class AccountInvoiceLine(models.Model): taxes = self.invoice_line_tax_ids.compute_all(price, currency, self.quantity, product=self.product_id, partner=self.invoice_id.partner_id) self.price_subtotal = price_subtotal_signed = taxes['total_excluded'] if taxes else self.quantity * price if self.invoice_id.currency_id and self.invoice_id.company_id and self.invoice_id.currency_id != self.invoice_id.company_id.currency_id: - price_subtotal_signed = self.invoice_id.currency_id.compute(price_subtotal_signed, self.invoice_id.company_id.currency_id) + price_subtotal_signed = self.invoice_id.currency_id.with_context(date=self.invoice_id.date_invoice).compute(price_subtotal_signed, self.invoice_id.company_id.currency_id) sign = self.invoice_id.type in ['in_refund', 'out_refund'] and -1 or 1 self.price_subtotal_signed = price_subtotal_signed * sign From 9d25f63c9bd9c00f000377bcfeb176892c688b79 Mon Sep 17 00:00:00 2001 From: Yannick Tivisse Date: Wed, 27 Dec 2017 13:47:42 +0100 Subject: [PATCH 12/13] [FIX] account_budget: Make the analytic account mandatory on budget form Purpose ======= When you create a budget, the field analytic account on the budget line is not mandatory but if you don't set one, it doesn't work, the practical amount always stays at 0 even if there are journal items in the accounts defined in the budgetary positions --- addons/account_budget/account_budget_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account_budget/account_budget_view.xml b/addons/account_budget/account_budget_view.xml index 69ec48578f7..63783e3c591 100644 --- a/addons/account_budget/account_budget_view.xml +++ b/addons/account_budget/account_budget_view.xml @@ -111,7 +111,7 @@ - +