From 1112ca05ab81ad4a716f042ede21d957dec754a1 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Fri, 12 Jul 2019 15:14:15 +0000 Subject: [PATCH 01/63] [FIX] account: reconciliation model support tags in widget Activate analytic tags Create an reconciliation model on which you set at least one tag Create a bank statement and a line Click on reconcile (or access the reconciliation widget by another means) Quick Create a writeoff line Click on the button corresponding to the reconciliation model Before this commit: The many2many tags was buggy, there was one empty tag, corresponding to nothing clicking on the field triggered errors validating the reconciliation by clicking on reconcile triggered a server traceback in the real backend, opening the tag form view triggered an access error This was because the data were not formatted the right way to be passed to the m2m_tag_field through notifyChanges After this commit, the reconciliation model's tag renders and behaves well Validating the reconciliation works OPW 2033350 As a side note, in the future, the reconciliation widget Model should fully implement basicModel or not at all. Some of the heavy plumbing that the ReconciliationModel does (fetch records, data...) is imitating what fetchRecord does closes odoo/odoo#34838 Signed-off-by: Lucas Perais (lpe) --- .../js/reconciliation/reconciliation_model.js | 75 ++++++++++++++----- .../static/tests/reconciliation_tests.js | 65 +++++++++++++++- 2 files changed, 117 insertions(+), 23 deletions(-) diff --git a/addons/account/static/src/js/reconciliation/reconciliation_model.js b/addons/account/static/src/js/reconciliation/reconciliation_model.js index ede81ea2043..d655d94ed01 100644 --- a/addons/account/static/src/js/reconciliation/reconciliation_model.js +++ b/addons/account/static/src/js/reconciliation/reconciliation_model.js @@ -384,14 +384,7 @@ var StatementModel = BasicModel.extend({ if (context && context.active_model === 'account.journal' && context.active_ids) { domainReconcile.push(['journal_id', 'in', [false].concat(context.active_ids)]); } - var def_reconcileModel = this._rpc({ - model: 'account.reconcile.model', - method: 'search_read', - domain: domainReconcile, - }) - .then(function (reconcileModels) { - self.reconcileModels = reconcileModels; - }); + var def_reconcileModel = this._loadReconciliationModel({domainReconcile: domainReconcile}); var def_account = this._rpc({ model: 'account.account', method: 'search_read', @@ -411,7 +404,59 @@ var StatementModel = BasicModel.extend({ return self._formatLine(self.statement.lines); }); }, - + _readAnalyticTags: function (params) { + var self = this; + this.analyticTags = {}; + if (!params || !params.res_ids || !params.res_ids.length) { + return $.when(); + } + var fields = (params && params.fields || []).concat(['id', 'display_name']); + return this._rpc({ + model: 'account.analytic.tag', + method: 'read', + args: [ + params.res_ids, + fields, + ], + }).then(function (tags) { + for (var i=0; i Date: Mon, 15 Jul 2019 12:57:08 +0000 Subject: [PATCH 02/63] [FIX] point_of_sale: Product description missing on invoice via POS Steps to reproduce the bug: - Create a product and fill in a description for that product (in Sales app, on Sales tab --> description for the client) - Sell the product via POS - Create an invoice via POS Bug: The customer description didn't appear in the invoice line. opw:1771302 closes odoo/odoo#34869 Signed-off-by: Simon Goffin (sig) --- addons/point_of_sale/models/pos_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/point_of_sale/models/pos_order.py b/addons/point_of_sale/models/pos_order.py index ce87fa885a0..29f4de05dd4 100644 --- a/addons/point_of_sale/models/pos_order.py +++ b/addons/point_of_sale/models/pos_order.py @@ -236,7 +236,7 @@ class PosOrder(models.Model): # We convert a new id object back to a dictionary to write to # bridge between old and new api inv_line = invoice_line._convert_to_write({name: invoice_line[name] for name in invoice_line._cache}) - inv_line.update(price_unit=line.price_unit, discount=line.discount, name=inv_name) + inv_line.update(price_unit=line.price_unit, discount=line.discount) return InvoiceLine.sudo().create(inv_line) def _create_account_move_line(self, session=None, move=None): From 19d340c712bb7db76b03ebba28967b7b1e074341 Mon Sep 17 00:00:00 2001 From: Jorge Pinna Puissant Date: Tue, 9 Jul 2019 08:06:01 +0000 Subject: [PATCH 03/63] [FIX] l10n_ch: write access to create invoices - Having a user with access to create an invoice in Accounting, but without the rights to create or modify Currency's objects; - Install the Switzerland localization; - Create an invoice with this user. Before this commit, the user will have an access error. This issue arise because when saving an invoice it will also try to save the name of the currency. In the Switzerland localization a field(l10n_ch_currency_name) is related to the currency's name of the invoice. Now, this field is tagged as read-only, and when saving an invoice, it won't try to save also the currency's name. opw-2032756 closes odoo/odoo#34680 Signed-off-by: Nans Lefebvre (len) --- addons/l10n_ch/models/account_invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/l10n_ch/models/account_invoice.py b/addons/l10n_ch/models/account_invoice.py index 01c8b747329..b8982977552 100644 --- a/addons/l10n_ch/models/account_invoice.py +++ b/addons/l10n_ch/models/account_invoice.py @@ -26,7 +26,7 @@ class AccountInvoice(models.Model): l10n_ch_isr_valid = fields.Boolean(compute='_compute_l10n_ch_isr_valid', help='Boolean value. True iff all the data required to generate the ISR are present') l10n_ch_isr_sent = fields.Boolean(defaut=False, help="Boolean value telling whether or not the ISR corresponding to this invoice has already been printed or sent by mail.") - l10n_ch_currency_name = fields.Char(related='currency_id.name', readonly=False, string="Currency Name", help="The name of this invoice's currency") #This field is used in the "invisible" condition field of the 'Print ISR' button. + l10n_ch_currency_name = fields.Char(related='currency_id.name', readonly=True, string="Currency Name", help="The name of this invoice's currency") #This field is used in the "invisible" condition field of the 'Print ISR' button. @api.depends('partner_bank_id.bank_id.l10n_ch_postal_eur', 'partner_bank_id.bank_id.l10n_ch_postal_chf') def _compute_l10n_ch_isr_postal(self): From 7766b89aa04f31c086f9e967965b2ff3d8d10410 Mon Sep 17 00:00:00 2001 From: Nimesh Jethva Date: Thu, 6 Sep 2018 08:43:32 +0000 Subject: [PATCH 04/63] [FIX] web: restore kanban progressbar animation With BS4 migration, the progressbar 'active' class should have been renamed 'progress-bar-animated'. closes odoo/odoo#26868 Signed-off-by: Quentin Smetz (qsm) --- .../web/static/src/js/views/kanban/kanban_column_progressbar.js | 2 +- addons/web/static/src/xml/kanban.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/js/views/kanban/kanban_column_progressbar.js b/addons/web/static/src/js/views/kanban/kanban_column_progressbar.js index 59f09bc9bb6..4a572739daf 100644 --- a/addons/web/static/src/js/views/kanban/kanban_column_progressbar.js +++ b/addons/web/static/src/js/views/kanban/kanban_column_progressbar.js @@ -158,7 +158,7 @@ var KanbanColumnProgressBar = Widget.extend({ }); // Adapt active state - $bar.toggleClass('active progress-bar-striped', key === self.activeFilter); + $bar.toggleClass('progress-bar-animated progress-bar-striped', key === self.activeFilter); // Adapt width $bar.removeClass('o_bar_has_records transition-off'); diff --git a/addons/web/static/src/xml/kanban.xml b/addons/web/static/src/xml/kanban.xml index 220395fef02..e8522cc5bc1 100644 --- a/addons/web/static/src/xml/kanban.xml +++ b/addons/web/static/src/xml/kanban.xml @@ -110,7 +110,7 @@
-
Date: Thu, 25 Apr 2019 19:39:23 +0000 Subject: [PATCH 05/63] [FIX] sale: ensure Down Payment product exists In case the Down Payment product is removed/not accessible, trying to create a down payment from a sale order to invoice produced an error "Record does not exist or has been deleted. (Records: [42], User: 2)" Add a exists for returning an empty recordset for a better fallback and create a new Down Payment product using the wizard closes odoo/odoo#32965 Signed-off-by: Martin Trigaux (mat) --- addons/sale/wizard/sale_make_invoice_advance.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale/wizard/sale_make_invoice_advance.py b/addons/sale/wizard/sale_make_invoice_advance.py index ee85807201d..193ae90d360 100644 --- a/addons/sale/wizard/sale_make_invoice_advance.py +++ b/addons/sale/wizard/sale_make_invoice_advance.py @@ -30,7 +30,7 @@ class SaleAdvancePaymentInv(models.TransientModel): @api.model def _default_product_id(self): product_id = self.env['ir.config_parameter'].sudo().get_param('sale.default_deposit_product_id') - return self.env['product.product'].browse(int(product_id)) + return self.env['product.product'].browse(int(product_id)).exists() @api.model def _default_deposit_account_id(self): From 956204fe105919c5346e4eca95fa24b7e10ef9be Mon Sep 17 00:00:00 2001 From: Nans Lefebvre Date: Wed, 17 Jul 2019 04:57:49 +0000 Subject: [PATCH 06/63] [FIX] sale: do not crash on _compute_currency_rate if any currency is not defined yet The _get_conversion_rate method crashes if any of its parameters is undefined. Therefore triggering the compute of the currency_rate early* causes it to crash. (* e.g. by putting it in the view with studio) opw 2035604 closes odoo/odoo#34928 Signed-off-by: Nans Lefebvre (len) --- addons/sale/models/sale.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/sale/models/sale.py b/addons/sale/models/sale.py index 2efa2c7d919..4cb02549b38 100644 --- a/addons/sale/models/sale.py +++ b/addons/sale/models/sale.py @@ -220,7 +220,10 @@ class SaleOrder(models.Model): if not order.company_id: order.currency_rate = order.currency_id.with_context(date=order.date_order).rate or 1.0 continue - order.currency_rate = self.env['res.currency']._get_conversion_rate(order.company_id.currency_id, order.currency_id, order.company_id, order.date_order) + elif order.company_id.currency_id and order.currency_id: # the following crashes if any one is undefined + order.currency_rate = self.env['res.currency']._get_conversion_rate(order.company_id.currency_id, order.currency_id, order.company_id, order.date_order) + else: + order.currency_rate = 1.0 def _compute_access_url(self): super(SaleOrder, self)._compute_access_url() From 40bfd596d2cf055c63bdc896b6bc626ff4746311 Mon Sep 17 00:00:00 2001 From: Nathan Olson <921778+lutrome@users.noreply.github.com> Date: Wed, 17 Jul 2019 04:30:15 +0000 Subject: [PATCH 07/63] [CLA] Individual CLA for Nathaniel Olson (Lutrome) closes odoo/odoo#34927 Signed-off-by: Martin Trigaux (mat) --- doc/cla/individual/lutrome.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 doc/cla/individual/lutrome.md diff --git a/doc/cla/individual/lutrome.md b/doc/cla/individual/lutrome.md new file mode 100644 index 00000000000..6f012f2e96e --- /dev/null +++ b/doc/cla/individual/lutrome.md @@ -0,0 +1,11 @@ +United States of America, 07/16/2019 + +I hereby agree to the terms of the Odoo Individual Contributor License +Agreement v1.0. + +I declare that I am authorized and able to make this agreement and sign this +declaration. + +Signed, + +Nathaniel Olson 921778+Lutrome@users.noreply.github.com https://github.com/lutrome From 713df0baf10bac0cafef90979f8adc4f4d64ef31 Mon Sep 17 00:00:00 2001 From: Julien Castiaux Date: Tue, 16 Jul 2019 09:36:01 +0000 Subject: [PATCH 08/63] [FIX] stock: putaway strategy without location Using Studio, create a menu for the Putaway Strategies, access its form view, edit the location field. Traceback. opw-2032144 closes odoo/odoo#34904 Signed-off-by: Julien Castiaux --- addons/stock/views/product_strategy_views.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/stock/views/product_strategy_views.xml b/addons/stock/views/product_strategy_views.xml index 897f7fe2023..93d3eec5d10 100644 --- a/addons/stock/views/product_strategy_views.xml +++ b/addons/stock/views/product_strategy_views.xml @@ -15,14 +15,14 @@ - + - + From 9408cab4a60c9f7eb92c884eb90cf8f0797b70b7 Mon Sep 17 00:00:00 2001 From: Adrien Dieudonne Date: Wed, 17 Jul 2019 12:35:53 +0000 Subject: [PATCH 09/63] [FIX] mail: tabs should appear on mobile Since Chrome 74 or 75, tabs in Discuss suddenly disappeared. Normally, these buttons are displayed at the bottom of the screen when you open the Discuss app. So we had to review this part and it seems more logical to override the "height: 100%" property with "min-height: 0". By doing this, the flex box element can grow from this size. We also set flex-shrink to 1 to reduce the content with a scroll-bar to let enough space to the other static elements (flex 0 0 auto). Note that these rules are only applied on mobile. opw-2030433 closes odoo/odoo#34947 Signed-off-by: Pierre Paridans --- addons/mail/static/src/scss/discuss.scss | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/mail/static/src/scss/discuss.scss b/addons/mail/static/src/scss/discuss.scss index 8d328b028bf..d6f0ec10760 100644 --- a/addons/mail/static/src/scss/discuss.scss +++ b/addons/mail/static/src/scss/discuss.scss @@ -252,7 +252,8 @@ } .o_mail_discuss_content { - flex: 1 0 0; + flex: 1 1 auto; + min-height: 0; margin-left: 10px; margin-right: 10px; background-color: transparent; From ddada7bb9e0bbe8d0a3ef6194b372451a1c71ab7 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Wed, 17 Jul 2019 12:57:38 +0000 Subject: [PATCH 10/63] [FIX] stock_dropshipping: Dropship created after editing an existing quotation Steps to reproduce the bug: - Create a quotation and a SO line SOL with one product and route "Dropship" - Confirm the SO and a PO is created - Validate PO and process the dropship picking - Add 4 units to the SO line SOL Bug: A new PO was created but the related picking was type "Receipts" instead of "Dropship" opw:2034398 closes odoo/odoo#34923 Signed-off-by: Simon Goffin (sig) --- addons/sale_purchase/models/sale_order.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/sale_purchase/models/sale_order.py b/addons/sale_purchase/models/sale_order.py index 8960907f9ed..0b85753411f 100644 --- a/addons/sale_purchase/models/sale_order.py +++ b/addons/sale_purchase/models/sale_order.py @@ -114,8 +114,8 @@ class SaleOrderLine(models.Model): decreased_values = {} if 'product_uom_qty' in values: precision = self.env['decimal.precision'].precision_get('Product Unit of Measure') - increased_lines = self.sudo().filtered(lambda r: r.purchase_line_count and float_compare(r.product_uom_qty, values['product_uom_qty'], precision_digits=precision) == -1) - decreased_lines = self.sudo().filtered(lambda r: r.purchase_line_count and float_compare(r.product_uom_qty, values['product_uom_qty'], precision_digits=precision) == 1) + increased_lines = self.sudo().filtered(lambda r: r.product_id.service_to_purchase and r.purchase_line_count and float_compare(r.product_uom_qty, values['product_uom_qty'], precision_digits=precision) == -1) + decreased_lines = self.sudo().filtered(lambda r: r.product_id.service_to_purchase and r.purchase_line_count and float_compare(r.product_uom_qty, values['product_uom_qty'], precision_digits=precision) == 1) increased_values = {line.id: line.product_uom_qty for line in increased_lines} decreased_values = {line.id: line.product_uom_qty for line in decreased_lines} From 46d12675a7273d2a4e513644016e9a06e9d7ae64 Mon Sep 17 00:00:00 2001 From: Adrian Torres Date: Wed, 10 Jul 2019 08:51:39 +0000 Subject: [PATCH 11/63] [FIX] tests: allow False as value for required booleans in SSF A required boolean accepts two values, True and False, however the SSF and the web-client assume False to be equal to NULL and treat them interchangeably. In the SSF, we verify that a required field is filled by checking that its value is different from False, however False is a valid value for a boolean, this means that setting a required boolean to False would never work in the SSF. This commit overcomes this issue by simply skipping the check for fields of type boolean. closes odoo/odoo#34729 Signed-off-by: Xavier Morel (xmo) --- odoo/addons/test_testing_utilities/ir.model.access.csv | 1 + odoo/addons/test_testing_utilities/models.py | 5 +++++ .../test_testing_utilities/tests/test_form_impl.py | 10 ++++++++++ odoo/tests/common.py | 2 +- 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/odoo/addons/test_testing_utilities/ir.model.access.csv b/odoo/addons/test_testing_utilities/ir.model.access.csv index c43b736c531..1cb9a9f542a 100644 --- a/odoo/addons/test_testing_utilities/ir.model.access.csv +++ b/odoo/addons/test_testing_utilities/ir.model.access.csv @@ -19,3 +19,4 @@ access_model_test_testing_utilities_onchange_count,access_model_test_testing_uti access_test_testing_utilities_onchange_count_sub,access_test_testing_utilities_onchange_count_sub,model_test_testing_utilities_onchange_count_sub,,1,1,1,1 access_o2m_readonly_subfield_parent,access_o2m_readonly_subfield_parent,model_o2m_readonly_subfield_parent,,1,1,1,1 access_o2m_readonly_subfield_child,access_o2m_readonly_subfield_child,model_o2m_readonly_subfield_child,,1,1,1,1 +access_test_testing_utilities_req_bool,access_test_testing_utilities_req_bool,model_test_testing_utilities_req_bool,,1,0,0,0 diff --git a/odoo/addons/test_testing_utilities/models.py b/odoo/addons/test_testing_utilities/models.py index 0c04bc06e8d..0b87c3e66b1 100644 --- a/odoo/addons/test_testing_utilities/models.py +++ b/odoo/addons/test_testing_utilities/models.py @@ -261,3 +261,8 @@ class O2MReadonlySubfieldChild(models.Model): def _inverse_f(self): raise AssertionError("Inverse of f should not be called") + +class ReqBool(models.Model): + _name = _description = 'test_testing_utilities.req_bool' + + f_bool = fields.Boolean(required=True) diff --git a/odoo/addons/test_testing_utilities/tests/test_form_impl.py b/odoo/addons/test_testing_utilities/tests/test_form_impl.py index 0191a4da7ad..c0e5093fd3b 100644 --- a/odoo/addons/test_testing_utilities/tests/test_form_impl.py +++ b/odoo/addons/test_testing_utilities/tests/test_form_impl.py @@ -53,6 +53,16 @@ class TestBasic(TransactionCase): ('1', 0, 0, 0) ) + def test_required_bool(self): + f = Form(self.env['test_testing_utilities.req_bool']) + f.f_bool = False + r = f.save() + self.assertEqual(r.f_bool, 0) + + f2 = Form(self.env['test_testing_utilities.req_bool']) + r2 = f2.save() + self.assertEqual(r2.f_bool, 0) + def test_readonly(self): """ Checks that fields with readonly modifiers (marked as readonly or diff --git a/odoo/tests/common.py b/odoo/tests/common.py index 06906d45086..6fcd68c427c 100644 --- a/odoo/tests/common.py +++ b/odoo/tests/common.py @@ -1385,7 +1385,7 @@ class Form(object): fields = self._view['fields'] for f in fields: v = self._values[f] - if self._get_modifier(f, 'required'): + if self._get_modifier(f, 'required') and not fields[f]['type'] == 'boolean': assert v is not False, "{} is a required field".format(f) # skip unmodified fields From 8533c19a6020461081c952c74bd6e043d26c79c7 Mon Sep 17 00:00:00 2001 From: Nans Lefebvre Date: Tue, 16 Jul 2019 14:15:27 +0000 Subject: [PATCH 12/63] [FIX] payment_authorize: save payment token from form validated transaction https://docs.python.org/3/library/stdtypes.html#truth By default, an object is considered true unless its class defines either a __bool__() method that returns False or a __len__() method that returns zero Since etree elements are iterator, they define a len function. However it turns out that customerProfileId has always no children. So bool(find(x)) is always False; the intended meaning was find(x) is None. opw 1999427 closes odoo/odoo#34922 Signed-off-by: Nans Lefebvre (len) --- addons/payment_authorize/models/authorize_request.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/payment_authorize/models/authorize_request.py b/addons/payment_authorize/models/authorize_request.py index 922d9df1bf1..e3e65648ee0 100644 --- a/addons/payment_authorize/models/authorize_request.py +++ b/addons/payment_authorize/models/authorize_request.py @@ -226,7 +226,7 @@ class AuthorizeAPI(): etree.SubElement(customer, "email").text = partner.email or '' response = self._authorize_request(root) res = dict() - if not response.find('customerProfileId'): + if response.find('customerProfileId') is None: # Warning: do not use bool(etree) as the semantics is very misleading _logger.warning( 'Unable to create customer payment profile, data missing from transaction. Transaction_id: %s - Partner_id: %s' % (transaction_id, partner) From a6805b7280fad64570c8c723983451f7122e11e9 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Wed, 17 Jul 2019 16:42:38 +0000 Subject: [PATCH 13/63] [FIX] stock_zebra: display lot in picking report On picking "Barcodes (ZPL)" report, we show barcode of product for untracked product, and barcode of lot if available. But if we use an existing lot, we have to use lot_id.name to get the lot name instead of lot_name (used in configuration with new lot only) or lot will not be shown in the report. opw-2036894 closes #34958 Signed-off-by: Nicolas Lempereur (nle) --- addons/stock_zebra/report/picking_templates.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/stock_zebra/report/picking_templates.xml b/addons/stock_zebra/report/picking_templates.xml index 8d135dd0c40..d9959b5646d 100644 --- a/addons/stock_zebra/report/picking_templates.xml +++ b/addons/stock_zebra/report/picking_templates.xml @@ -18,11 +18,11 @@ ^FO100,50 ^A0N,44,33^FD^FS ^FO100,100 - -^A0N,44,33^FDLN/SN: ^FS + +^A0N,44,33^FDLN/SN: ^FS ^FO100,150^BY3 ^BCN,100,Y,N,N -^FD^FS +^FD^FS ^BCN,100,Y,N,N From e50800deafb106fec2abef695d7fc81e97092290 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Rahir?= Date: Wed, 17 Jul 2019 14:56:10 +0000 Subject: [PATCH 14/63] [IMP] mail: Add simple partner notification --- .../mail/static/src/js/services/mail_notification_manager.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/mail/static/src/js/services/mail_notification_manager.js b/addons/mail/static/src/js/services/mail_notification_manager.js index a179fddfde7..accef0cfb93 100644 --- a/addons/mail/static/src/js/services/mail_notification_manager.js +++ b/addons/mail/static/src/js/services/mail_notification_manager.js @@ -361,6 +361,9 @@ MailManager.include({ this._handlePartnerMailFailureNotification(data); } else if (data.type === 'user_connection') { this._handlePartnerUserConnectionNotification(data); + } else if (data.type === 'simple_notification') { + var title = _.escape(data.title), message = _.escape(data.message); + data.warning ? this.do_warn(title, message, data.sticky) : this.do_notify(title, message, data.sticky); } else { this._handlePartnerChannelNotification(data); } From 1e4152b25559fd2efd79cce9f90f222e7231a21d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Rahir?= Date: Wed, 17 Jul 2019 14:56:40 +0000 Subject: [PATCH 15/63] [FIX] crm_reveal: warn user on missing GeoIP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The GeoIP lib is necessary for this module to run but there is zero documentation on that specificity. This commit adds a bus notification to inform the user of the absence of the package through the webclient notification system. closes odoo/odoo#34968 Signed-off-by: Rémi Rahir (rar) --- addons/crm_reveal/models/crm_reveal_rule.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/addons/crm_reveal/models/crm_reveal_rule.py b/addons/crm_reveal/models/crm_reveal_rule.py index 52e66972700..39491ce3dd3 100644 --- a/addons/crm_reveal/models/crm_reveal_rule.py +++ b/addons/crm_reveal/models/crm_reveal_rule.py @@ -8,7 +8,7 @@ import re from dateutil.relativedelta import relativedelta from math import floor, log10 -from odoo import api, fields, models, tools, _ +from odoo import api, fields, models, tools, _, _geoip_resolver from odoo.addons.iap import jsonrpc from odoo.addons.crm.models import crm_stage from odoo.exceptions import ValidationError @@ -72,9 +72,18 @@ class CRMRevealRule(models.Model): except Exception: raise ValidationError(_('Enter Valid Regex.')) + @api.model + def _assert_geoip(self): + if not _geoip_resolver: + message = _('Lead Generation requires a GeoIP resolver which could not be found on your system. Please consult https://pypi.org/project/GeoIP/.') + self.env['bus.bus'].sendone( + (self._cr.dbname, 'res.partner', self.env.user.partner_id.id), + {'type': 'simple_notification', 'title': _('Missing Library'), 'message': message, 'sticky': True, 'warning': True}) + @api.model def create(self, vals): self.clear_caches() # Clear the cache in order to recompute _get_active_rules + self._assert_geoip() return super(CRMRevealRule, self).create(vals) def write(self, vals): @@ -83,6 +92,7 @@ class CRMRevealRule(models.Model): } if set(vals.keys()) & fields_set: self.clear_caches() # Clear the cache in order to recompute _get_active_rules + self._assert_geoip() return super(CRMRevealRule, self).write(vals) def unlink(self): From eba0325355c66906438443fb9abc094c756051c8 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Thu, 18 Jul 2019 12:59:39 +0000 Subject: [PATCH 16/63] [FIX] web: add href to main menus This was already the case for sub menus. This allows to right-click and open menu in a new tab. Closes #29345 closes odoo/odoo#34983 Signed-off-by: Julien Mougenot (JUM) --- addons/web/static/src/xml/menu.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/xml/menu.xml b/addons/web/static/src/xml/menu.xml index 6a4749d1c25..086d676e02a 100644 --- a/addons/web/static/src/xml/menu.xml +++ b/addons/web/static/src/xml/menu.xml @@ -20,7 +20,7 @@