From 2295cffb7094480c994912eb2ed183a765b12c32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Honor=C3=A9=20=28Acsone=29?= <30529208+acsonefho@users.noreply.github.com> Date: Thu, 19 Oct 2017 09:12:30 +0200 Subject: [PATCH 01/13] [CLA] Add acsonefho into Acsone CCLA Closes #20291 --- doc/cla/corporate/acsone.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/cla/corporate/acsone.md b/doc/cla/corporate/acsone.md index cb97dc6b20d..1060d7ccc02 100644 --- a/doc/cla/corporate/acsone.md +++ b/doc/cla/corporate/acsone.md @@ -25,3 +25,4 @@ Philippe Schmidt philippe.schmidt@acsone.eu https://github.com/phschmidt Stéphane Bidoul stephane.bidoul@acsone.eu https://github.com/sbidoul Thomas Binsfeld thomas.binsfeld@acsone.eu https://github.com/ThomasBinsfeld Benjamin Willig benjamin.willig@acsone.eu https://github.com/benwillig +François Honoré francois.honore@acsone.eu https://github.com/acsonefho From 3f3e41e9f5b89f2b079204ce3adee73d48aba541 Mon Sep 17 00:00:00 2001 From: Joao Alfredo Gama Batista Date: Thu, 19 Oct 2017 03:24:53 -0400 Subject: [PATCH 02/13] [CLA] Update Savoir-faire Linux CLA Add new collaborators, remove old ones Closes #20258 --- doc/cla/corporate/savoirfairelinux.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/doc/cla/corporate/savoirfairelinux.md b/doc/cla/corporate/savoirfairelinux.md index 784518b093e..6dca085c4ce 100644 --- a/doc/cla/corporate/savoirfairelinux.md +++ b/doc/cla/corporate/savoirfairelinux.md @@ -1,4 +1,4 @@ -Canada, France, 2017-05-12 +Canada, France, 2017-10-17 Savoir-faire Linux agrees to the terms of the Odoo Corporate Contributor License Agreement v1.0. @@ -8,17 +8,22 @@ declaration. Signed, -Jérome Boisvert-Chouinard jerome.boisvertchouinard@savoirfairelinux.com https://github.com/jbchouinard +João Alfredo Gama Batista joao.gama@savoirfairelinux.com https://github.com/joaoalf List of contributors: Agathe Mollé agathe.molle@savoirfairelinux.com https://github.com/Ehtaga Bruno Joliveau bruno.joliveau@savoirfairelinux.com https://github.com/bjoliveau David Dufresne david.dufresne@savoirfairelinux.com https://github.com/dufresnedavid -Jérome Boisvert-Chouinard jerome.boisvertchouinard@savoirfairelinux.com https://github.com/jbchouinard -Joao Alfredo Gama Batista joao.gama@savoirfairelinux.com https://github.com/joaoalf -Julie Moussu julie.mousse@savoirfairelinux.com https://github.com/JulieSFL -Pierre Lamarche pierre.lamarche@savoirfairelinux.com https://github.com/plamarche +Istvan SZALAÏ istvan.szalai@savoirfairelinux.com https://github.com/ventilooo +João Alfredo Gama Batista joao.gama@savoirfairelinux.com https://github.com/joaoalf +Julien Jezequel-Breard julien.jezequel-breard@savoirfairelinux.com https://github.com/jjbreard +Quentin Lavallée-Bourdeau quentin.lavallee@savoirfairelinux.com https://github.com/qtiplb +Rim Ben Dhaou rim.bendhaou@savoirfairelinux.com https://github.com/rimbendhaou +Yasmine El Mrini yasmine.elmrini@savoirfairelinux.com https://github.com/yasmineelmrini +Jérome Boisvert-Chouinard jerome.boisvertchouinard@savoirfairelinux.com https://github.com/jbchouinard (up to 2017-10-17) +Julie Moussu julie.mousse@savoirfairelinux.com https://github.com/JulieSFL (up to 2017-10-17) +Pierre Lamarche pierre.lamarche@savoirfairelinux.com https://github.com/plamarche (up to 2017-10-17) David Cormier david.cormier@savoirfairelinux.com https://github.com/cormier (up to 2017-05-12) Davin Baragiotta davin.baragiotta@savoirfairelinux.com https://github.com/giotta (up to 2017-05-12) El Hadji Dem elhadji.dem@savoirfairelinux.com https://github.com/ehdem (up to 2017-05-12) From 4f921d668aba626475c2acf75ecc28af16905d52 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 18 Oct 2017 10:50:18 +0200 Subject: [PATCH 03/13] [FIX] account_asset: asset on refund - Create a vendor bill with a line linked to an asset category - Validate the bill => an asset is created - Refund the bill The refund is also linked to an asset category. Therefore, upon validation, a negative asset will be created. The refund should not be linked to the asset category in a first place. The user should cancel/modify the asset manually. opw-775933 --- addons/account_asset/models/account_invoice.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/addons/account_asset/models/account_invoice.py b/addons/account_asset/models/account_invoice.py index f3726a798c0..7d20127b969 100644 --- a/addons/account_asset/models/account_invoice.py +++ b/addons/account_asset/models/account_invoice.py @@ -12,6 +12,16 @@ import odoo.addons.decimal_precision as dp class AccountInvoice(models.Model): _inherit = 'account.invoice' + @api.model + def _refund_cleanup_lines(self, lines): + result = super(AccountInvoice, self)._refund_cleanup_lines(lines) + for i, line in enumerate(lines): + for name, field in line._fields.items(): + if name == 'asset_category_id': + result[i][2][name] = False + break + return result + @api.multi def action_cancel(self): res = super(AccountInvoice, self).action_cancel() From f18f8e401baf4762f1c9ceb4f1a89fee4b1a599b Mon Sep 17 00:00:00 2001 From: Denis Vermylen Date: Wed, 18 Oct 2017 19:00:24 +0200 Subject: [PATCH 04/13] [FIX] sale: pricelist price base Fine tuning of 1108c150d9a61bc437a07f03a809c8907714edf4 When setting a pricelist to show the public price discount, it ignored the pricelist item's base field (if not 'Other Pricelist') and set it by default on the lst_price instead. This did not work when you based your discount on the standard_price (= cost price) with public price discount. Now it does. opw:775275 --- addons/sale/models/sale.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/sale/models/sale.py b/addons/sale/models/sale.py index 2c24bee1549..3fef7117eb0 100644 --- a/addons/sale/models/sale.py +++ b/addons/sale/models/sale.py @@ -857,7 +857,8 @@ class SaleOrderLine(models.Model): return price else: from_currency = self.order_id.company_id.currency_id - return from_currency.compute(pricelist_item and product[pricelist_item.base] or product.lst_price, self.order_id.pricelist_id.currency_id) + product_price = product[pricelist_item.base] if (pricelist_item and pricelist_item.base != 'pricelist') else product.lst_price + return from_currency.compute(product_price, self.order_id.pricelist_id.currency_id) @api.multi @api.onchange('product_id') From e72fc9a7f370d3e0fa6bd26c9b9e9c4608786c97 Mon Sep 17 00:00:00 2001 From: amoyaux Date: Wed, 18 Oct 2017 16:16:10 +0200 Subject: [PATCH 05/13] [FIX] stock: pack operation lots truncate decimal precision A bug happens when you enter a number with more than 2 decimal if you unfocus/focus the field it will truncate it. This commit change the decimal precision and use the same digits than other fields used in stock. opw-775791 --- addons/stock/models/stock_pack_operation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/stock/models/stock_pack_operation.py b/addons/stock/models/stock_pack_operation.py index b06a977a90b..f82109c170f 100644 --- a/addons/stock/models/stock_pack_operation.py +++ b/addons/stock/models/stock_pack_operation.py @@ -268,10 +268,10 @@ class PackOperationLot(models.Model): _description = "Lot/Serial number for pack ops" operation_id = fields.Many2one('stock.pack.operation') - qty = fields.Float('Done', default=1.0) + qty = fields.Float('Done', default=1.0, digits=dp.get_precision('Product Unit of Measure')) lot_id = fields.Many2one('stock.production.lot', 'Lot/Serial Number') lot_name = fields.Char('Lot/Serial Number') - qty_todo = fields.Float('To Do', default=0.0) + qty_todo = fields.Float('To Do', default=0.0, digits=dp.get_precision('Product Unit of Measure')) plus_visible = fields.Boolean(compute='_compute_plus_visible', default=True) _sql_constraints = [ From 2deb95b852208a8dbfb9640ac8947533c1ad428b Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 17 Oct 2017 09:49:22 +0200 Subject: [PATCH 06/13] [FIX] base_vat, website_sale: Verification of vat number in EU country We have problems when trying to validate our EU VAT report because some vat number are wrongly encoded in Odoo. There are 2 problems: 1) We use vatnumber library to check the validity of the VAT number entered by the user on website. That library removes the following characters '.' and '-' in order to perform the check and thus can return True for a number like 123.123.123.13 or -123-3454-34 And those VAT number are then saved in our database but are rejected by the state as VAT number should only contains alphanumeric character -> Solution: prevent entering vat number with other characters than alphanumeric for users that are located in EUROPE! 2) Usually VAT is prefixed by country code, however some people in europe managed to bypass the system by prefixing their VAT number with CC instead of their country code, CC is consider valid in odoo (it means Country Code) but is not a valid European country code in general, which means that those people that should have pay some tax have not. Which is a huge problem. -> Solution: prevent the use of CC as country code by the user when entering a vatnumber only if the user country is in EUROPE! source: https://en.wikipedia.org/wiki/VAT_identification_number opw:772621 --- addons/base_vat/base_vat.py | 22 ++++++++++++++++++++++ addons/website_sale/controllers/main.py | 2 ++ 2 files changed, 24 insertions(+) diff --git a/addons/base_vat/base_vat.py b/addons/base_vat/base_vat.py index 9e1dcba46e4..98a988beae7 100644 --- a/addons/base_vat/base_vat.py +++ b/addons/base_vat/base_vat.py @@ -14,10 +14,17 @@ except ImportError: "Install it to support more countries, for example with `easy_install vatnumber`.") vatnumber = None +from openerp import api from openerp.osv import osv from openerp.tools.misc import ustr from openerp.tools.translate import _ +_eu_country_vat = { + 'GR': 'EL' +} + +_eu_country_vat_inverse = {v: k for k, v in _eu_country_vat.items()} + _ref_vat = { 'at': 'ATU12345675', 'be': 'BE0477472701', @@ -79,6 +86,7 @@ class res_partner(osv.osv): # may have a VATIN starting with "EU" instead of a country code. return True res_country = self.pool.get('res.country') + country_code = _eu_country_vat_inverse.get(country_code, country_code) return bool(res_country.search(cr, uid, [('code', '=ilike', country_code)], context=context)) return check_func(vat_number) @@ -95,6 +103,20 @@ class res_partner(osv.osv): # country code or empty VAT number), so we fall back to the simple check. return self.simple_vat_check(cr, uid, country_code, vat_number, context=context) + @api.model + def fix_eu_vat_number(self, country_id, vat): + in_europe = False + europe = self.env.ref('base.europe') + country = self.env["res.country"].browse(country_id) + if not europe: + europe = self.env["res.country.group"].search([('name', '=', 'Europe')], limit=1) + if europe and country and country.id in europe.country_ids.ids: + vat = re.sub('[^A-Za-z0-9]', '', vat).upper() + country_code = _eu_country_vat.get(country.code, country.code).upper() + if vat[:2] != country_code: + vat = country_code + vat + return vat + def check_vat(self, cr, uid, ids, context=None): user_company = self.pool.get('res.users').browse(cr, uid, uid).company_id if user_company.vat_check_vies: diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py index e7820976747..44c35ff3c1f 100644 --- a/addons/website_sale/controllers/main.py +++ b/addons/website_sale/controllers/main.py @@ -569,6 +569,8 @@ class website_sale(http.Controller): # vat validation if data.get("vat") and hasattr(registry["res.partner"], "check_vat"): + if data.get("country_id"): + data["vat"] = registry["res.partner"].fix_eu_vat_number(cr, uid, data.get("country_id"), data.get("vat"), context) if request.website.company_id.vat_check_vies: # force full VIES online check check_func = registry["res.partner"].vies_vat_check From c57fb01a3e779cd292152bf5e4c894bf7bcd1f41 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Thu, 19 Oct 2017 12:45:47 +0200 Subject: [PATCH 07/13] [FIX] web: iOS content in modal disappear As can be seen in https://github.com/scottjehl/Device-Bugs/issues/8 a combination of "-webkit-overflow-scrolling:touch", "position:relative" and "overflow:auto" can have unexpected behavior on iOS. The issue solved here is that writing in a form view inside a modal in iOS (at least version 10.3) would make the whole form body invisible until edition is ended. This commit fixes this by adding a CSS rule which avoid the iOS bug. opw-774396 closes #20314 --- addons/web/static/src/less/modal.less | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/web/static/src/less/modal.less b/addons/web/static/src/less/modal.less index bca950796fc..ec12c47381c 100644 --- a/addons/web/static/src/less/modal.less +++ b/addons/web/static/src/less/modal.less @@ -52,6 +52,8 @@ .modal-body { overflow: auto; + // fix iOS issue https://github.com/scottjehl/Device-Bugs/issues/8 + -webkit-transform: translate3d(0, 0, 0); } } } From 59b010ac366e0826fb314b2a89ca47f26906e185 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Pigeon=20=28ACSONE=29?= Date: Thu, 19 Oct 2017 15:00:52 +0200 Subject: [PATCH 08/13] [FIX] sale_stock: refactor badly written method causing performances issues (#20193) --- addons/sale_stock/models/sale_order.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/addons/sale_stock/models/sale_order.py b/addons/sale_stock/models/sale_order.py index 5ae2b039839..5ce3be00b9a 100644 --- a/addons/sale_stock/models/sale_order.py +++ b/addons/sale_stock/models/sale_order.py @@ -109,11 +109,13 @@ class SaleOrderLine(models.Model): @api.multi @api.depends('product_id') def _compute_qty_delivered_updateable(self): - for line in self: - if line.product_id.type not in ('consu', 'product'): - super(SaleOrderLine, line)._compute_qty_delivered_updateable() - else: - line.qty_delivered_updateable = False + # prefetch field before filtering + self.mapped('product_id') + # on consumable or stockable products, qty_delivered_updateable defaults + # to False; on other lines use the original computation + lines = self.filtered(lambda line: line.product_id.type not in ('consu', 'product')) + lines = lines.with_prefetch(self._prefetch) + super(SaleOrderLine, lines)._compute_qty_delivered_updateable() @api.onchange('product_id') def _onchange_product_id_set_customer_lead(self): From 2c829870f12c969c43782ae88ea2c140eb8ca37c Mon Sep 17 00:00:00 2001 From: Dharmang Soni Date: Mon, 31 Jul 2017 13:01:42 +0530 Subject: [PATCH 09/13] [FIX] web: prevent iOS from zooming in on input fields When a user clicks on an input or a select field in Safari on IOS, Safari has a behavior of zooming-in on the field when the keyboard opens. Even after the user dismisses the keyboard, the screen still stays zoomed-in. The user has to then zoom out manually. Now, the user is not allow to zoom-in at all. This is already the case with the Android application. We now have the same behavior between the two apps. --- addons/web/views/webclient_templates.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/views/webclient_templates.xml b/addons/web/views/webclient_templates.xml index cffc4321808..4b5c4c8bdc7 100644 --- a/addons/web/views/webclient_templates.xml +++ b/addons/web/views/webclient_templates.xml @@ -193,7 +193,7 @@ - + <link type="image/x-icon" rel="shortcut icon" t-att-href="x_icon or '/web/static/src/img/favicon.ico'"/> From d49983b23dd5ff12382d5c9eaa47291822ea42a7 Mon Sep 17 00:00:00 2001 From: qsm-odoo <qsm@odoo.com> Date: Thu, 19 Oct 2017 11:58:18 +0200 Subject: [PATCH 10/13] [FIX] web_editor: open link dialog on dblclick on real links When double-clicking on a link/button, the link dialog is opened. The problem was that the "btn" class is sometimes used on non-link elements. While this should not be, the editor can easily be adapted to this. --- addons/web_editor/static/src/js/rte.summernote.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/js/rte.summernote.js b/addons/web_editor/static/src/js/rte.summernote.js index a3bf079aa30..866d0d68e84 100644 --- a/addons/web_editor/static/src/js/rte.summernote.js +++ b/addons/web_editor/static/src/js/rte.summernote.js @@ -771,7 +771,7 @@ eventHandler.attach = function (oLayoutInfo, options) { * Open Link Dialog on double click on a link/button. * Shows a tooltip on click to say to the user he can double click. */ - create_dblclick_feature("a[href], .btn", function () { + create_dblclick_feature("a[href], a.btn, button.btn", function () { eventHandler.modules.linkDialog.show(oLayoutInfo); }); From 8ead5f9610b94d2e9e4305d6baf2b21d9729896f Mon Sep 17 00:00:00 2001 From: Christophe Simonis <chs@odoo.com> Date: Thu, 19 Oct 2017 21:03:00 +0200 Subject: [PATCH 11/13] [FIX] sale_stock: do not mix indentation with tab & spaces --- addons/sale_stock/models/sale_order.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/sale_stock/models/sale_order.py b/addons/sale_stock/models/sale_order.py index 5ce3be00b9a..06f1ef715ba 100644 --- a/addons/sale_stock/models/sale_order.py +++ b/addons/sale_stock/models/sale_order.py @@ -110,12 +110,12 @@ class SaleOrderLine(models.Model): @api.depends('product_id') def _compute_qty_delivered_updateable(self): # prefetch field before filtering - self.mapped('product_id') - # on consumable or stockable products, qty_delivered_updateable defaults - # to False; on other lines use the original computation - lines = self.filtered(lambda line: line.product_id.type not in ('consu', 'product')) - lines = lines.with_prefetch(self._prefetch) - super(SaleOrderLine, lines)._compute_qty_delivered_updateable() + self.mapped('product_id') + # on consumable or stockable products, qty_delivered_updateable defaults + # to False; on other lines use the original computation + lines = self.filtered(lambda line: line.product_id.type not in ('consu', 'product')) + lines = lines.with_prefetch(self._prefetch) + super(SaleOrderLine, lines)._compute_qty_delivered_updateable() @api.onchange('product_id') def _onchange_product_id_set_customer_lead(self): From 4af5e03d803831ee6c6a8f47974bfb01118b24da Mon Sep 17 00:00:00 2001 From: Christophe Simonis <chs@odoo.com> Date: Thu, 19 Oct 2017 22:25:31 +0200 Subject: [PATCH 12/13] [ADD] hw_proxy: do not mix indentation with tab & spaces --- addons/hw_proxy/controllers/main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/hw_proxy/controllers/main.py b/addons/hw_proxy/controllers/main.py index cd90ffd16ed..d79d4bdf8be 100644 --- a/addons/hw_proxy/controllers/main.py +++ b/addons/hw_proxy/controllers/main.py @@ -17,9 +17,9 @@ _logger = logging.getLogger(__name__) # Those are the builtin raspberry pi USB modules, they should # not appear in the list of connected devices. BANNED_DEVICES = set([ - "0424:9514", # Standard Microsystem Corp. Builtin Ethernet module - "1d6b:0002", # Linux Foundation 2.0 root hub - "0424:ec00", # Standard Microsystem Corp. Other Builtin Ethernet module + "0424:9514", # Standard Microsystem Corp. Builtin Ethernet module + "1d6b:0002", # Linux Foundation 2.0 root hub + "0424:ec00", # Standard Microsystem Corp. Other Builtin Ethernet module ]) @@ -106,7 +106,7 @@ class Proxy(http.Controller): device_name = device[device.find('ID')+2:] device_id = device_name.split()[0] if not (device_id in BANNED_DEVICES): - resp+= "<div class='device' data-device='"+device+"'>"+device_name+"</div>\n" + resp+= "<div class='device' data-device='"+device+"'>"+device_name+"</div>\n" count += 1 if count == 0: From 9b4447e9aa5f172fb9fd35ba4213a925288c74ef Mon Sep 17 00:00:00 2001 From: Christophe Simonis <chs@odoo.com> Date: Thu, 19 Oct 2017 22:33:37 +0200 Subject: [PATCH 13/13] [IMP] test_pylint: check for mixed-indentation --- odoo/addons/test_pylint/tests/test_pylint.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/odoo/addons/test_pylint/tests/test_pylint.py b/odoo/addons/test_pylint/tests/test_pylint.py index 38fa4c3d51a..22573c699a2 100644 --- a/odoo/addons/test_pylint/tests/test_pylint.py +++ b/odoo/addons/test_pylint/tests/test_pylint.py @@ -25,6 +25,8 @@ class TestPyLint(TransactionCase): 'E0601', # using variable before assignment 'W0123', # eval used 'W0101', # unreachable code + + 'mixed-indentation', ] def _skip_test(self, reason):