From e6a1ac6e6462c973f55d12ef4b5543aad7790179 Mon Sep 17 00:00:00 2001 From: Richard Mathot Date: Tue, 20 Aug 2019 13:16:07 +0000 Subject: [PATCH 01/14] [FIX] models: avoid Unicode error when translating that error message Same cause, error, rationale and fix than 0ec0a4a32e98f2288e419dcb0627cfd972f32034 #OneCharacterPatch, reloaded opw-2056251 closes odoo/odoo#35857 Signed-off-by: Richard Mathot (rim) --- odoo/addons/base/ir/ir_model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odoo/addons/base/ir/ir_model.py b/odoo/addons/base/ir/ir_model.py index 3a12f2d7c82..c75e028534c 100644 --- a/odoo/addons/base/ir/ir_model.py +++ b/odoo/addons/base/ir/ir_model.py @@ -958,7 +958,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_name,) - 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_name) msg = '%s %s' % (msg_heads[mode], msg_tail) raise AccessError(msg % msg_params) From b058f7094191364083fbd50b18cafabf5fa82b4a Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Tue, 20 Aug 2019 13:39:39 +0000 Subject: [PATCH 02/14] [FIX] web_editor: font>a colorize a change font color If you change the color of a link with the editor without using the link edition menu, this do not work (which might be expected), but if the text outside the font had been colorized, the font will be applied outside of the link only. This is unexpected since if we have: "hello cruel world!", if we select only "cruel" and change color, the change only happen to "hello" and "world!". With this changeset, an anchor in the ancestor prevent to use an ancestor font tag to change color (which prevent the issue). opw-2044551 closes #35862 Signed-off-by: Nicolas Lempereur (nle) --- addons/web_editor/static/src/js/summernote.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/addons/web_editor/static/src/js/summernote.js b/addons/web_editor/static/src/js/summernote.js index e52ea66614d..0f6c7cddd03 100644 --- a/addons/web_editor/static/src/js/summernote.js +++ b/addons/web_editor/static/src/js/summernote.js @@ -2121,13 +2121,15 @@ $.summernote.pluginEvents.applyFont = function (event, editor, layoutInfo, color } // apply font: foreColor, backColor, size (the color can be use a class text-... or bg-...) - var node, font, $font, fonts = [], className; + var node, ancestors, font, $font, fonts = [], className; if (color || bgcolor || size) { for (var i=0; i Date: Thu, 22 Aug 2019 07:26:42 +0000 Subject: [PATCH 03/14] [FIX] website_event_track: suggest recipient with an email If an event track had a speaker assigned who had an email, and the email field in the track itself was empty, Odoo was suggesting the user to send an email to an empty recipient, making an error Now it only suggests the email if there's one. Fixes odoo/odoo#35941 Signed-off-by: Martin Trigaux (mat) --- addons/website_event_track/models/event_track.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website_event_track/models/event_track.py b/addons/website_event_track/models/event_track.py index cd581946580..a58235d61c4 100644 --- a/addons/website_event_track/models/event_track.py +++ b/addons/website_event_track/models/event_track.py @@ -155,7 +155,7 @@ class Track(models.Model): def message_get_suggested_recipients(self): recipients = super(Track, self).message_get_suggested_recipients() for track in self: - if track.partner_email != track.partner_id.email: + if track.partner_email and track.partner_email != track.partner_id.email: track._message_add_suggested_recipient(recipients, email=track.partner_email, reason=_('Speaker Email')) return recipients From 61eccf212b25e03564c1e51bea3723873a862042 Mon Sep 17 00:00:00 2001 From: Wolfgang Taferner Date: Thu, 22 Aug 2019 04:09:41 +0000 Subject: [PATCH 04/14] [FIX] payment_stripe: backwards compatibility IE 11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes odoo/odoo#35944 Signed-off-by: Jérémy Kersten (jke) --- addons/payment_stripe/static/src/js/stripe.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/payment_stripe/static/src/js/stripe.js b/addons/payment_stripe/static/src/js/stripe.js index 8de9bc62c4a..d1db0cee113 100644 --- a/addons/payment_stripe/static/src/js/stripe.js +++ b/addons/payment_stripe/static/src/js/stripe.js @@ -130,14 +130,14 @@ odoo.define('payment_stripe.stripe', function(require) { }).then(function (data) { try { provider_form[0].innerHTML = data; } catch (e) {}; }); - } else if (window.location.href.includes("/my/orders/")) { + } else if (window.location.href.indexOf("/my/orders/") !== -1) { var create_tx = ajax.jsonRpc('/pay/sale/' + so_id + '/form_tx/', 'call', { access_token: access_token, acquirer_id: acquirer_id }).then(function (data) { try { provider_form.innerHTML = data; } catch (e) {}; }); - } else if (window.location.href.includes("/my/invoices/")) { + } else if (window.location.href.indexOf("/my/invoices/") !== -1) { var create_tx = ajax.jsonRpc('/invoice/pay/' + invoice_id + '/form_tx/', 'call', { access_token: access_token, acquirer_id: acquirer_id From 06a516af408e499e53c94ab90ed16001b1af815f Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Tue, 20 Aug 2019 14:35:17 +0000 Subject: [PATCH 05/14] [FIX] gamification, hr_recruitment, maintenance: kankan tooltip no longer supports field tag In v10.0, it was possible, and kinda work, to have ```
  • Project:
``` In v11.0 onwards, this "feature" has been dropped, since in kanban records it doesn't make much sense to a field defined/displayed that way The right way is to call `record.(field).(raw_)?value` This commit adapts the only two modules still having kanban-tooltip classes in their views OPW 2055132 related to #29802 closes odoo/odoo#35869 Signed-off-by: Aaron Bohy (aab) --- addons/gamification/views/goal.xml | 5 ++++- addons/hr_recruitment/views/hr_recruitment_views.xml | 7 ++++--- addons/maintenance/views/maintenance_views.xml | 8 ++++---- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/addons/gamification/views/goal.xml b/addons/gamification/views/goal.xml index dda5f0c35ff..9a539077469 100644 --- a/addons/gamification/views/goal.xml +++ b/addons/gamification/views/goal.xml @@ -136,6 +136,7 @@ + @@ -144,7 +145,9 @@ - +
    +
  • +
diff --git a/addons/hr_recruitment/views/hr_recruitment_views.xml b/addons/hr_recruitment/views/hr_recruitment_views.xml index a289939bc33..aaae0365d60 100644 --- a/addons/hr_recruitment/views/hr_recruitment_views.xml +++ b/addons/hr_recruitment/views/hr_recruitment_views.xml @@ -253,6 +253,7 @@ + @@ -263,9 +264,9 @@
    -
  • Degree:
  • -
  • Contact:
  • -
  • Departement:
  • +
  • Degree:
  • +
  • Contact:
  • +
  • Departement:
diff --git a/addons/maintenance/views/maintenance_views.xml b/addons/maintenance/views/maintenance_views.xml index cdd3bd4f185..ed24538fe91 100644 --- a/addons/maintenance/views/maintenance_views.xml +++ b/addons/maintenance/views/maintenance_views.xml @@ -125,8 +125,8 @@
    -
  • Category:
  • -
  • Request to:
  • +
  • Category:
  • +
  • Request to:
@@ -396,8 +396,8 @@
    -
  • Serial Number:
  • -
  • Model Number:
  • +
  • Serial Number:
  • +
  • Model Number:
From 8443a74cd6e4c8aae67668da5ee52c6f9c1661bc Mon Sep 17 00:00:00 2001 From: mreficent Date: Wed, 21 Aug 2019 21:35:57 +0000 Subject: [PATCH 06/14] [FIX] account: computes correctly belongs_to_company Typo of https://github.com/odoo/odoo/commit/b154e219f68cc378ba8cc9dedf1d48819cd8e87a closes odoo/odoo#35937 Signed-off-by: Martin Trigaux (mat) --- addons/account/models/account.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account.py b/addons/account/models/account.py index f8f1303277c..1e739007490 100644 --- a/addons/account/models/account.py +++ b/addons/account/models/account.py @@ -534,7 +534,7 @@ class AccountJournal(models.Model): @api.depends('company_id') def _belong_to_company(self): for journal in self: - journal.belong_to_company = (journal.company_id.id == self.env.user.company_id.id) + journal.belongs_to_company = (journal.company_id.id == self.env.user.company_id.id) @api.multi def _search_company_journals(self, operator, value): From da474d0e872c9938b061e133011bd36b416eafc7 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Thu, 22 Aug 2019 10:19:05 +0000 Subject: [PATCH 07/14] [FIX] web_editor: parallax effect in sanitized field A sanitize fields by default remove all attributes outside of a whitelist (if sanitize_attributes on field is not set to false). This prevent to use parallax widget in Html sanitized field since attribute "data-scroll-background-ratio" define parallax effect speed but was not in whitelist. note: also keep data-interval for gallery widget opw-2053983 closes #35961 Signed-off-by: Nicolas Lempereur (nle) --- odoo/tools/mail.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odoo/tools/mail.py b/odoo/tools/mail.py index 65ba6b32be1..74ad5154224 100644 --- a/odoo/tools/mail.py +++ b/odoo/tools/mail.py @@ -33,7 +33,7 @@ safe_attrs = clean.defs.safe_attrs | frozenset( ['style', 'data-o-mail-quote', # quote detection 'data-oe-model', 'data-oe-id', 'data-oe-field', 'data-oe-type', 'data-oe-expression', 'data-oe-translation-id', 'data-oe-nodeid', - 'data-publish', 'data-id', 'data-res_id', 'data-member_id', 'data-view-id' + 'data-publish', 'data-id', 'data-res_id', 'data-interval', 'data-member_id', 'data-scroll-background-ratio', 'data-view-id', ]) From e0c7a368580dfeac9af8dc3cb3a10fc33bf4b521 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 22 Aug 2019 12:14:18 +0000 Subject: [PATCH 08/14] [FIX] account_check_printing: set the amount in words - Create a vendor payment by check - Remove the amount in words - Confirm It is impossible to set the amount to print the check. We add an action button to recompute the amount in words. It is only visible when the amount is not set. opw-2046339 closes odoo/odoo#35968 Signed-off-by: Nicolas Martinelli (nim) --- addons/account_check_printing/models/account_payment.py | 4 ++++ addons/account_check_printing/views/account_payment_views.xml | 1 + 2 files changed, 5 insertions(+) diff --git a/addons/account_check_printing/models/account_payment.py b/addons/account_check_printing/models/account_payment.py index 37f3f1b9d53..b7d1189e4af 100644 --- a/addons/account_check_printing/models/account_payment.py +++ b/addons/account_check_printing/models/account_payment.py @@ -119,3 +119,7 @@ class AccountPayment(models.Model): """ This method is a hook for l10n_xx_check_printing modules to implement actual check printing capabilities """ raise UserError(_("There is no check layout configured.\nMake sure the proper check printing module is installed" " and its configuration (in company settings > 'Configuration' tab) is correct.")) + + def set_check_amount_in_words(self): + for payment in self: + payment.check_amount_in_words = payment.currency_id.amount_to_text(payment.amount) if payment.currency_id else '' diff --git a/addons/account_check_printing/views/account_payment_views.xml b/addons/account_check_printing/views/account_payment_views.xml index f3836a44099..c592f8a1675 100644 --- a/addons/account_check_printing/views/account_payment_views.xml +++ b/addons/account_check_printing/views/account_payment_views.xml @@ -8,6 +8,7 @@
- + +
From 832dc676783e0cbaa2e9a1f491dfdd6ee4dd9bd6 Mon Sep 17 00:00:00 2001 From: Jorge Pinna Puissant Date: Fri, 9 Aug 2019 12:04:28 +0000 Subject: [PATCH 11/14] [FIX] point_of_sale: automatic selection of customer pricelist when using barcode Backport from 12.0 to 11.0 When using barcode to change the customer to a customer with a different pricelist than the pos default, the customer pricelist was not automatically selected. This is a fine-tuning on 5603b778f6a52a0c251be8d871139efdeeff5a40 opw-2047070 closes odoo/odoo#36050 Signed-off-by: Lucas Perais (lpe) --- addons/point_of_sale/static/src/js/screens.js | 5 ++++- 1 file changed, 4 insertions(+), 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 a2b34025c08..96a9cf67c2f 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -102,7 +102,10 @@ var ScreenWidget = PosBaseWidget.extend({ barcode_client_action: function(code){ var partner = this.pos.db.get_partner_by_barcode(code.code); if(partner){ - this.pos.get_order().set_client(partner); + if (this.pos.get_order().get_client() !== partner) { + this.pos.get_order().set_client(partner); + this.pos.get_order().set_pricelist(_.findWhere(this.pos.pricelists, {'id': partner.property_product_pricelist[0]}) || this.pos.default_pricelist); + } return true; } this.barcode_error_action(code); From 0ff1933ba122206db3003552b74f3a532cd68c3c Mon Sep 17 00:00:00 2001 From: Romain Derie Date: Mon, 26 Aug 2019 14:35:17 +0000 Subject: [PATCH 12/14] [FIX] website: restore sitemap lastmod and priority MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit 54d30d5194 introduced `lastmod` and `priority` on sitemap locs. This was broken with 4ecbacaf5957 which introduced `website.page` model as it removed the `PageConverter`. Before website.page: 1. PageConverter returned records with `__lastmod` 2. `enumerate_pages` loop on converters would remove the prefixed `__` After website.page: 1. code to remove `__` was still there but the pages would be found and looped on after that code, making it useless. With this commit: 1. The code to remove the `__` is moved after searching the pages. Following #36090 Related to #35464 Signed-off-by: Jérémy Kersten (jke) --- addons/website/models/website.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/addons/website/models/website.py b/addons/website/models/website.py index 2d267a489dc..cbaf967fb42 100644 --- a/addons/website/models/website.py +++ b/addons/website/models/website.py @@ -517,9 +517,6 @@ class Website(models.Model): domain_part, url = rule.build(value, append_unknown=False) if not query_string or query_string.lower() in url.lower(): page = {'loc': url} - for key, val in value.items(): - if key.startswith('__'): - page[key[2:]] = val if url in ('/sitemap.xml',): continue if url in url_set: @@ -543,9 +540,9 @@ class Website(models.Model): for page in pages: record = {'loc': page['url'], 'id': page['id'], 'name': page['name']} if page.view_id and page.view_id.priority != 16: - record['__priority'] = min(round(page.view_id.priority / 32.0, 1), 1) + record['priority'] = min(round(page.view_id.priority / 32.0, 1), 1) if page['write_date']: - record['__lastmod'] = page['write_date'][:10] + record['lastmod'] = page['write_date'][:10] yield record @api.multi From a20b84d05a3f76040a4ca9477b7719537e9c987d Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Mon, 26 Aug 2019 13:41:21 +0000 Subject: [PATCH 13/14] [FIX] account: reconcile invoice, refund in foreign; payment and writeoff in domestic This reverts 0164c9dfcb8f94dd09ffc5a0ce056e4e23308abe Have exchange rates: Domestic - Domestic: 1.0 Domestic - Foreign : 1.113900 Make an invoice: 480 Foreign Make a credit note: 140 Foreign Make a payment: 287.20 Domestic Reconcile all this with a writeoff: 18.04 Domestic Before this commit, the first invoice was not fully paid this was due to wrong summing of the partial lines that applies to it account.partial.reconcile are made between only 2 move lines at a time Whatever the amounts they hold, it has been computed at creation and it makes no sense to aggregate their rounding error when computing their impact on a move line (because, the information is already lost) After this commit, the use case works, all invoices and payments are fully consumed and reconciled Note that this is a simple use case, no dates or exchange rates involved OPW 2057845 closes odoo/odoo#36087 Signed-off-by: Lucas Perais (lpe) --- addons/account/models/account_move.py | 2 +- addons/account/tests/test_reconciliation.py | 62 +++++++++++++++++++++ 2 files changed, 63 insertions(+), 1 deletion(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 733edb8f565..df9172ab88c 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -343,7 +343,7 @@ class AccountMoveLine(models.Model): else: date = partial_line.credit_move_id.date if partial_line.debit_move_id == line else partial_line.debit_move_id.date rate = line.currency_id.with_context(date=date).rate - amount_residual_currency += sign_partial_line * partial_line.amount * rate + amount_residual_currency += sign_partial_line * line.currency_id.round(partial_line.amount * rate) #computing the `reconciled` field. reconciled = False diff --git a/addons/account/tests/test_reconciliation.py b/addons/account/tests/test_reconciliation.py index 4259dd50583..0149558976f 100644 --- a/addons/account/tests/test_reconciliation.py +++ b/addons/account/tests/test_reconciliation.py @@ -964,3 +964,65 @@ class TestReconciliation(AccountingTestCase): partner_lines = [line for line in report_lines if line['partner_id'] == partner.id] self.assertEqual(partner_lines, [], 'The aged receivable shouldn\'t have lines at this point') self.assertFalse(amls.get(partner.id, False), 'The aged receivable should not have amls either') + + def test_inv_refund_foreign_payment_writeoff_domestic(self): + company = self.env.ref('base.main_company') + self.env['res.currency.rate'].search([]).unlink() + self.env['res.currency.rate'].create({ + 'name': time.strftime('%Y') + '-07-01', + 'rate': 1.0, + 'currency_id': self.currency_euro_id, + 'company_id': company.id + }) + self.env['res.currency.rate'].create({ + 'name': time.strftime('%Y') + '-07-01', + 'rate': 1.113900, # Don't change this ! + 'currency_id': self.currency_usd_id, + 'company_id': self.env.ref('base.main_company').id + }) + inv1 = self.create_invoice(invoice_amount=480, currency_id=self.currency_usd_id) + inv2 = self.create_invoice(type="out_refund", invoice_amount=140, currency_id=self.currency_usd_id) + + payment = self.env['account.payment'].create({ + 'payment_method_id': self.inbound_payment_method.id, + 'payment_type': 'inbound', + 'partner_type': 'customer', + 'partner_id': inv1.partner_id.id, + 'amount': 287.20, + 'journal_id': self.bank_journal_euro.id, + 'company_id': company.id, + }) + payment.post() + + inv1_receivable = inv1.move_id.line_ids.filtered(lambda l: l.account_id.internal_type == 'receivable') + inv2_receivable = inv2.move_id.line_ids.filtered(lambda l: l.account_id.internal_type == 'receivable') + pay_receivable = payment.move_line_ids.filtered(lambda l: l.account_id.internal_type == 'receivable') + + data_for_reconciliation = [ + { + 'type': 'partner', + 'id': inv1.partner_id.id, + 'mv_line_ids': (inv1_receivable + inv2_receivable + pay_receivable).ids, + 'new_mv_line_dicts': [ + { + 'credit': 18.04, + 'debit': 0.00, + 'journal_id': self.bank_journal_euro.id, + 'name': 'Total WriteOff (Fees)', + 'account_id': self.diff_expense_account.id + } + ] + } + ] + + self.env['account.move.line'].process_reconciliations(data_for_reconciliation) + + self.assertTrue(inv1_receivable.full_reconcile_id.exists()) + self.assertEquals(inv1_receivable.full_reconcile_id, inv2_receivable.full_reconcile_id) + self.assertEquals(inv1_receivable.full_reconcile_id, pay_receivable.full_reconcile_id) + + self.assertTrue(inv1.reconciled) + self.assertTrue(inv2.reconciled) + + self.assertEquals(inv1.state, 'paid') + self.assertEquals(inv2.state, 'paid') From 61ad8a9ea70671bf5059c65aa3aae10b8ae1ce71 Mon Sep 17 00:00:00 2001 From: Jorge Pinna Puissant Date: Tue, 27 Aug 2019 08:24:10 +0000 Subject: [PATCH 14/14] [FIX] website_event_sale: event discount Fine-tuning 180866fe1e3b8998cc47ee584abaaff76d4135bb - Go to Sales > Configuration > Settings - Enable "Multiple Sales Prices per Product" and select option "Prices computed from formulas (discounts, margins, roundings)" - Go to Sales > Catalog / Pricelists - Select "Public Pricelist" and set "Discount Policy: Show public price & discount to the customer" - Add a discount to an event (20 % to "Open Days in Los Angeles" for example) - Go to the eCommerce, buy a ticket to "Open Days in Los Angeles" which as a 20 % discount Since 180866fe1e3b8998cc47ee584abaaff76d4135bb the discount is applied two times. opw-2058709 closes odoo/odoo#36106 Signed-off-by: Nicolas Martinelli (nim) --- addons/website_event_sale/models/sale_order.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/website_event_sale/models/sale_order.py b/addons/website_event_sale/models/sale_order.py index 58c56bc9441..05e81f2605b 100644 --- a/addons/website_event_sale/models/sale_order.py +++ b/addons/website_event_sale/models/sale_order.py @@ -41,7 +41,10 @@ class SaleOrder(models.Model): values['product_id'] = ticket.product_id.id values['event_id'] = ticket.event_id.id values['event_ticket_id'] = ticket.id - values['price_unit'] = ticket.price_reduce + if order.pricelist_id.discount_policy == 'without_discount': + values['price_unit'] = ticket.price + else: + values['price_unit'] = ticket.price_reduce values['name'] = "%s\n%s" % (ticket.event_id.display_name, ticket.name) # avoid writing related values that end up locking the product record