From e0c5e6abd4712a05bb662650b75db3dc93b08e3e Mon Sep 17 00:00:00 2001 From: Joren Van Onder Date: Mon, 19 Jun 2017 20:50:01 -0700 Subject: [PATCH 1/4] =?UTF-8?q?[FIX]=20point=5Fof=5Fsale:=20display=20PIN?= =?UTF-8?q?=20as=20=E2=80=A2's=20across=20all=20browsers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this the -webkit-text-security CSS property was used. This, as the name implies, only works in webkit based browsers. Instead we can just render the PIN code as •'s since the value of the inputBuffer is used (not the rendered text) when checking the PIN. Fixes #16458 --- addons/point_of_sale/static/src/css/pos.css | 1 - addons/point_of_sale/static/src/js/popups.js | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/point_of_sale/static/src/css/pos.css b/addons/point_of_sale/static/src/css/pos.css index 465704844c1..6cb28f6a71f 100644 --- a/addons/point_of_sale/static/src/css/pos.css +++ b/addons/point_of_sale/static/src/css/pos.css @@ -2328,7 +2328,6 @@ td { } .pos .popup-password .popup-input { width: 70%; - -webkit-text-security: disc; } .pos .popup .body ul, diff --git a/addons/point_of_sale/static/src/js/popups.js b/addons/point_of_sale/static/src/js/popups.js index 80ce043561a..8ee2a35667a 100644 --- a/addons/point_of_sale/static/src/js/popups.js +++ b/addons/point_of_sale/static/src/js/popups.js @@ -238,6 +238,11 @@ var PasswordPopupWidget = NumberPopupWidget.extend({ this._super(); this.$('.popup').addClass('popup-password'); }, + click_numpad: function(event){ + this._super.apply(this, arguments); + var $value = this.$('.value'); + $value.text($value.text().replace(/./g, '•')); + }, }); gui.define_popup({name:'password', widget: PasswordPopupWidget}); From d938ba87ae524ab10a1da43471962f10ed53b9ca Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 20 Jun 2017 14:12:27 +0200 Subject: [PATCH 2/4] [FIX] point_of_sale: fix included taxes Apply commit a9ce4ffb225 to POS orders. opw-746827 --- addons/point_of_sale/point_of_sale.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index 370e150295d..a0bf4d5f253 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -1602,7 +1602,8 @@ class pos_order_line(osv.osv): fiscal_position_id = line.order_id.fiscal_position_id if fiscal_position_id: taxes = fiscal_position_id.map_tax(taxes) - price = line.price_unit * (1 - (line.discount or 0.0) / 100.0) + price = self.env['account.tax']._fix_tax_included_price( + line.price_unit * (1 - (line.discount or 0.0) / 100.0), line.product_id.taxes_id, taxes) line.price_subtotal = line.price_subtotal_incl = price * line.qty if taxes: taxes = taxes.compute_all(price, currency, line.qty, product=line.product_id, partner=line.order_id.partner_id or False) From de403dc1ab440b9b08ea7fce189cd157745dfe74 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Tue, 20 Jun 2017 10:02:03 +0200 Subject: [PATCH 3/4] [FIX] mass_mailing: no multi language edit Creating and editing mass mailing in multiple language is managed with the change 05daa15. But currently the language the mass mailing is sent in, is the language of the "Process Mass Mailing Queue" (root user if not changed) so all the recipients will receive the mail in the root user language has at the time the given batch of mails is sended. So this is different from what someone could expect by it being translatable. In any case the recipients list could be based on a lead, a partner a mass mailing contact or other and a language could not be determinable in stable (a mass mailing contact does not have a language for example). If the system worked, there is also a usability downside in the meaning that someone could duplicate a mail and not check all translation and not be aware that the mail he see is maybe not the mail that will be received (if translations have not all been completed). In stable to have the same behavior in any case and lessen the usability burden of users thinking erroneously the mass mailing may be sent in several languages depending on a not-existing heuristic, this changeset remove the translatability of mass mailing content. This has the following effect: no translation editing appear, the mass mailing is edited and sent in one and the same language, If someone want to send a mass mailing in several language, currently in Odoo it would then require to: duplicate the mass mailing, change the domains of recipients base on choosen heuristic, edit the duplicated mass mailing in the choosen language opw-746445 opw-746776 closes #17718 --- addons/mass_mailing/models/mass_mailing.py | 2 +- addons/web_editor/static/src/js/backend.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/mass_mailing/models/mass_mailing.py b/addons/mass_mailing/models/mass_mailing.py index 643696ad467..c59f12da0e6 100644 --- a/addons/mass_mailing/models/mass_mailing.py +++ b/addons/mass_mailing/models/mass_mailing.py @@ -487,7 +487,7 @@ class MassMailing(osv.Model): 'create_date': fields.datetime('Creation Date'), 'sent_date': fields.datetime('Sent Date', oldname='date', copy=False), 'schedule_date': fields.datetime('Schedule in the Future'), - 'body_html': fields.html('Body', translate=True), + 'body_html': fields.html('Body'), 'attachment_ids': fields.many2many( 'ir.attachment', 'mass_mailing_ir_attachments_rel', 'mass_mailing_id', 'attachment_id', 'Attachments' diff --git a/addons/web_editor/static/src/js/backend.js b/addons/web_editor/static/src/js/backend.js index e35ebcd6204..94c6e8057c0 100644 --- a/addons/web_editor/static/src/js/backend.js +++ b/addons/web_editor/static/src/js/backend.js @@ -183,6 +183,11 @@ var FieldTextHtml = widget.extend({ template: 'web_editor.FieldTextHtml', willStart: function () { var self = this; + + if (this.field.translate === false) { + this.languages = []; + return $.when(); + } return new Model('res.lang').call("search_read", [[['code', '!=', 'en_US']], ["name", "code"]]).then(function (res) { self.languages = res; }); From 26627391870af2edd8315748929122392a9a5f68 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 21 Jun 2017 13:31:49 +0200 Subject: [PATCH 4/4] [FIX] base: backport of 1703a2f80 on noupdate translations When a record is in no update, it is not modified after module upgrade. It should be the same with translations. --- openerp/addons/base/ir/ir_translation.py | 11 ++++++++--- .../tests/test_term_count.py | 17 +++++++++++++++++ .../addons/test_translation_import/view.xml | 2 +- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/openerp/addons/base/ir/ir_translation.py b/openerp/addons/base/ir/ir_translation.py index 00b66a947e8..16a6d6109cc 100644 --- a/openerp/addons/base/ir/ir_translation.py +++ b/openerp/addons/base/ir/ir_translation.py @@ -51,7 +51,8 @@ class ir_translation_import_cursor(object): # of ir_translation, so this copy will be much faster. cr.execute('''CREATE TEMP TABLE %s( imd_model VARCHAR(64), - imd_name VARCHAR(128) + imd_name VARCHAR(128), + noupdate BOOLEAN ) INHERITS (%s) ''' % (self._table_name, self._parent_table)) def push(self, trans_dict): @@ -109,7 +110,8 @@ class ir_translation_import_cursor(object): # Step 1: resolve ir.model.data references to res_ids cr.execute("""UPDATE %s AS ti - SET res_id = imd.res_id + SET res_id = imd.res_id, + noupdate = imd.noupdate FROM ir_model_data AS imd WHERE ti.res_id IS NULL AND ti.module IS NOT NULL AND ti.imd_name IS NOT NULL @@ -155,7 +157,10 @@ class ir_translation_import_cursor(object): src = ti.src, state = 'translated' FROM %s AS ti - WHERE %s AND ti.value IS NOT NULL AND ti.value != '' + WHERE %s + AND ti.value IS NOT NULL + AND ti.value != '' + AND noupdate IS NOT TRUE """ % (self._parent_table, self._table_name, find_expr), (tuple(src_relevant_fields), tuple(src_relevant_fields))) diff --git a/openerp/tests/addons/test_translation_import/tests/test_term_count.py b/openerp/tests/addons/test_translation_import/tests/test_term_count.py index 7ccd30969cb..41021e1d0eb 100644 --- a/openerp/tests/addons/test_translation_import/tests/test_term_count.py +++ b/openerp/tests/addons/test_translation_import/tests/test_term_count.py @@ -13,3 +13,20 @@ class TestTermCount(common.TransactionCase): ids = self.registry('ir.translation').search(self.cr, self.uid, [('src', '=', '1XBUO5PUYH2RYZSA1FTLRYS8SPCNU1UYXMEYMM25ASV7JC2KTJZQESZYRV9L8CGB')]) self.assertEqual(len(ids), 2) + + def test_noupdate(self): + """ + Make sure no update do not overwrite translations + """ + menu = self.env.ref('test_translation_import.menu_test_translation_import') + menu.name = "New Name" + # install french and change translation content + odoo.tools.trans_load(self.cr, 'test_translation_import/i18n/fr.po', 'fr_FR', verbose=False) + menu.with_context(lang='fr_FR').name = "Nouveau nom" + # reload with overwrite + odoo.tools.trans_load(self.cr, 'test_translation_import/i18n/fr.po', 'fr_FR', verbose=False, context={'overwrite': True}) + + # trans_load invalidates ormcache but not record cache + menu.refresh() + self.assertEqual(menu.name, "New Name") + self.assertEqual(menu.with_context(lang='fr_FR').name, "Nouveau nom") diff --git a/openerp/tests/addons/test_translation_import/view.xml b/openerp/tests/addons/test_translation_import/view.xml index 87d7f47a100..fe74c632f9e 100644 --- a/openerp/tests/addons/test_translation_import/view.xml +++ b/openerp/tests/addons/test_translation_import/view.xml @@ -1,6 +1,6 @@ - + Test translation import