From 19276549774023128da681821d6cf088ed34524b Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Thu, 6 Jul 2017 13:19:29 +0200 Subject: [PATCH 01/11] [FIX] web_editor: typo locale lost promise 7cb865f There was a lost promise which made website_form loaded before the languages informations (such as date format) was loaded. The server expect the format of the client thus that could lead to wrong or invalid dates. opw-749544 closes #18074 --- addons/web_editor/static/src/js/base.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/js/base.js b/addons/web_editor/static/src/js/base.js index e4e2fcd6cad..4368f6de274 100644 --- a/addons/web_editor/static/src/js/base.js +++ b/addons/web_editor/static/src/js/base.js @@ -36,7 +36,7 @@ data.ready = function () { // TODO find a better way to find if we are in the backend or not // We don't load translation if we are in the backend since it's already done by the webclient if (!$(document).find('.o_web_client').length) { - load_translations(); + return load_translations(); } }); } else if(all_ready.state() === "resolved") { // can add async template From 53762814d8b1f6eb8a24a24fea4e7d7343317085 Mon Sep 17 00:00:00 2001 From: Miku Laitinen Date: Thu, 6 Jul 2017 15:49:06 +0300 Subject: [PATCH 02/11] [CLA] updated CCLA for avoinsystems Done at #18068 --- doc/cla/corporate/avoinsystems.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/cla/corporate/avoinsystems.md b/doc/cla/corporate/avoinsystems.md index 13209ca53a3..4009dc466e5 100644 --- a/doc/cla/corporate/avoinsystems.md +++ b/doc/cla/corporate/avoinsystems.md @@ -17,3 +17,6 @@ Svante Suominen svante.suominen@avoin.systems https://github.com/svantesuominen Erno Iipponen erno.iipponen@avoin.systems https://github.com/iipponen Tuomo Aura tuomo.aura@avoin.systems https://github.com/tuomoaura Atte Isopuro atte.isopuro@avoin.systems https://github.com/aisopuro +Mikko Närjänen mikko.narjanen@avoin.systems https://github.com/mtnarjan +Toni Pesola toni.pesola@avoin.systems https://github.com/tonipes +Santeri Valjakka santeri.valjakka@avoin.systems https://github.com/hegenator From 464fe4a185316cf9af9ae15385bd55662534109b Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Thu, 6 Jul 2017 15:58:01 +0200 Subject: [PATCH 03/11] [FIX] doc: clarify: `record[field]` is valid/recommended --- doc/reference/orm.rst | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/reference/orm.rst b/doc/reference/orm.rst index 876d74f65cc..00b284f9cb2 100644 --- a/doc/reference/orm.rst +++ b/doc/reference/orm.rst @@ -45,14 +45,20 @@ Field access ------------ Recordsets provide an "Active Record" interface: model fields can be read and -written directly from the record, but only on singletons (single-record -recordsets). Setting a field's value triggers an update to the database:: +written directly from the record as attributes, but only on singletons +(single-record recordsets). +Field values can also be accessed like dict items, which is more elegant and +safer than ``getattr()`` for dynamic field names. +Setting a field's value triggers an update to the database:: >>> record.name Example Name >>> record.company_id.name Company Name >>> record.name = "Bob" + >>> field = "name" + >>> record[field] + Bob Trying to read or write a field on multiple records will raise an error. From 1f277a3572e709a3f5fabc1b8a3c7672c27b2d82 Mon Sep 17 00:00:00 2001 From: Yannick Tivisse Date: Thu, 6 Jul 2017 15:47:17 +0200 Subject: [PATCH 04/11] [FIX] account: Bring back the 'Invoice' stat button on partner form It has accidentally disappeared in saas-15. --- addons/account/models/partner.py | 9 +++++++++ addons/account/views/partner_view.xml | 11 +++++++++++ 2 files changed, 20 insertions(+) diff --git a/addons/account/models/partner.py b/addons/account/models/partner.py index 6372b054ad1..ed700cce965 100644 --- a/addons/account/models/partner.py +++ b/addons/account/models/partner.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- +from ast import literal_eval from operator import itemgetter import time @@ -436,3 +437,11 @@ class ResPartner(models.Model): return super(ResPartner, self)._commercial_fields() + \ ['debit_limit', 'property_account_payable_id', 'property_account_receivable_id', 'property_account_position_id', 'property_payment_term_id', 'property_supplier_payment_term_id', 'last_time_entries_checked'] + + @api.multi + def action_view_partner_invoices(self): + self.ensure_one() + action = self.env.ref('account.action_invoice_refund_out_tree').read()[0] + action['domain'] = literal_eval(action['domain']) + action['domain'].append(('partner_id', 'child_of', self.id)) + return action diff --git a/addons/account/views/partner_view.xml b/addons/account/views/partner_view.xml index 24377f47075..3f1f3f13ad4 100644 --- a/addons/account/views/partner_view.xml +++ b/addons/account/views/partner_view.xml @@ -95,6 +95,17 @@ +
+ +
From afefa1b7717b47f5d5c2c156be82d4aaed789bf7 Mon Sep 17 00:00:00 2001 From: Yannick Tivisse Date: Thu, 6 Jul 2017 16:46:17 +0200 Subject: [PATCH 05/11] [FIX] account: Display the correct records on 'Invoice' button Currently it shows all the invoices, not the sales invoices that are paid or validated --- addons/account/models/partner.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/account/models/partner.py b/addons/account/models/partner.py index 7794c2490d1..253a2e2b680 100644 --- a/addons/account/models/partner.py +++ b/addons/account/models/partner.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- +from ast import literal_eval from operator import itemgetter import time @@ -442,7 +443,7 @@ class ResPartner(models.Model): ''' This function returns an action that display invoices/refunds made for the given partners. ''' - action = self.env.ref('account.action_invoice_refund_out_tree') - result = action.read()[0] - result['domain'] = [('partner_id', 'child_of', self.ids)] - return result + action = self.env.ref('account.action_invoice_refund_out_tree').read()[0] + action['domain'] = literal_eval(action['domain']) + action['domain'].append(('partner_id', 'child_of', self.ids)) + return action From 2454dce7c5738750bee343b59e82cf611392d754 Mon Sep 17 00:00:00 2001 From: pashute Date: Thu, 6 Jul 2017 18:01:24 +0300 Subject: [PATCH 06/11] [CLA] signature for pashute Done at #18082 --- doc/cla/individual/pashute.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 doc/cla/individual/pashute.md diff --git a/doc/cla/individual/pashute.md b/doc/cla/individual/pashute.md new file mode 100644 index 00000000000..e0dde9fed9a --- /dev/null +++ b/doc/cla/individual/pashute.md @@ -0,0 +1,11 @@ +Israel, 2017-07-06 + +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, + +Moshe Flam pashute@gmail.com https://github.com/pashute From 1fda2168872348e66c26bc92dc63f58c2d13ad92 Mon Sep 17 00:00:00 2001 From: qdp-odoo Date: Thu, 6 Jul 2017 17:01:33 +0200 Subject: [PATCH 07/11] [FIX] l10n_fr_certification: set auto_install to False Due to recent decision by the French government this might not be mandatory for french companies --- addons/l10n_fr_certification/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/l10n_fr_certification/__openerp__.py b/addons/l10n_fr_certification/__openerp__.py index e83e9102914..7e2ea327d54 100644 --- a/addons/l10n_fr_certification/__openerp__.py +++ b/addons/l10n_fr_certification/__openerp__.py @@ -9,7 +9,7 @@ """, 'depends': ['l10n_fr'], 'installable': True, - 'auto_install': True, + 'auto_install': False, 'application': True, 'data': [ 'views/no_cancel.xml', From c1e154bee1fb49a102250048204b4e01c3def313 Mon Sep 17 00:00:00 2001 From: Christophe Monniez Date: Thu, 6 Jul 2017 14:00:09 +0200 Subject: [PATCH 08/11] [FIX] tools: ensure xlsx worksheet names are valid When xlsx is used, the worksheet name may be longer than 31 chars and raise an exception. This fix will troncate the name up to 31 chars and will remove invalid chars. Similar patch was already done at 0122c05eff95 for xlwt xlsxwriter 0.9.8 has added a parameter worksheet_class=None so adding **kw to be compatible with installs with the latest version (requirements.txt asks for version 0.9.3) Closes #18077 opw-751157 --- odoo/tools/misc.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/odoo/tools/misc.py b/odoo/tools/misc.py index c54af653a00..cb0c662ca49 100644 --- a/odoo/tools/misc.py +++ b/odoo/tools/misc.py @@ -363,6 +363,28 @@ except ImportError: xlwt = None +try: + import xlsxwriter + + # add some sanitizations to respect the excel sheet name restrictions + # as the sheet name is often translatable, can not control the input + class PatchedXlsxWorkbook(xlsxwriter.Workbook): + + # TODO when xlsxwriter bump to 0.9.8, add worksheet_class=None parameter instead of kw + def add_worksheet(self, name=None, **kw): + # invalid Excel character: []:*?/\ + name = re.sub(r'[\[\]:*?/\\]', '', name) + + # maximum size is 31 characters + name = name[:31] + return super(PatchedXlsxWorkbook, self).add_worksheet(name, **kw) + + xlsxwriter.Workbook = PatchedXlsxWorkbook + +except ImportError: + xlsxwriter = None + + class UpdateableStr(local): """ Class that stores an updateable string (used in wizards) """ From a1f1f85be2039b6f3443e2f1b504373f4e62e4d8 Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Mon, 26 Jun 2017 14:44:20 +0200 Subject: [PATCH 09/11] [FIX] workflow: insertion of duplicates in many2many relation --- openerp/workflow/workitem.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/workflow/workitem.py b/openerp/workflow/workitem.py index 29d3294dc0f..6a8e2d600fc 100644 --- a/openerp/workflow/workitem.py +++ b/openerp/workflow/workitem.py @@ -242,7 +242,7 @@ class WorkflowItem(object): transitions.append((transition['id'], self.workitem['inst_id'])) if test and transitions: - cr.executemany('insert into wkf_witm_trans (trans_id,inst_id) values (%s,%s)', transitions) + cr.executemany('insert into wkf_witm_trans (trans_id,inst_id) values (%s,%s) except (select trans_id,inst_id from wkf_witm_trans)', transitions) cr.execute('delete from wkf_workitem where id=%s', (self.workitem['id'],)) for t in transitions: self._join_test(t[0], t[1], stack) From 63ad8b95976ef0514168cbfb101a370bd857be87 Mon Sep 17 00:00:00 2001 From: Richard Mathot Date: Thu, 6 Jul 2017 14:58:23 +0200 Subject: [PATCH 10/11] [FIX] tools: prevent crashes with Pillow >= 4.2.0 From Pillow 4.2, it is forbidden to save RGBA images as JPEG ( https://github.com/python-pillow/Pillow/commit/e4d6223c944cf44c468cc65a560b94dfcf351a62 ) A crash was occurring when loading demo JPGs as image_resize_and_sharpen() was silently changing image mode to RGBA. Now we ensure that we return the original image mode. We also avoid crashes when converting from PNG to JPG --- openerp/tools/image.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openerp/tools/image.py b/openerp/tools/image.py index 251569c7247..ce50298b094 100644 --- a/openerp/tools/image.py +++ b/openerp/tools/image.py @@ -93,7 +93,7 @@ def image_resize_image(base64_source, size=(1024, 1024), encoding='base64', file if image.size != size: image = image_resize_and_sharpen(image, size) - if image.mode not in ["1", "L", "P", "RGB", "RGBA"]: + if image.mode not in ["1", "L", "P", "RGB", "RGBA"] or (filetype == 'JPEG' and image.mode == 'RGBA'): image = image.convert("RGB") background_stream = StringIO.StringIO() @@ -110,6 +110,7 @@ def image_resize_and_sharpen(image, size, preserve_aspect_ratio=False, factor=2. :param preserve_aspect_ratio: boolean (default: False) :param factor: Sharpen factor (default: 2.0) """ + origin_mode = image.mode if image.mode != 'RGBA': image = image.convert('RGBA') image.thumbnail(size, Image.ANTIALIAS) @@ -120,6 +121,8 @@ def image_resize_and_sharpen(image, size, preserve_aspect_ratio=False, factor=2. # create a transparent image for background and paste the image on it image = Image.new('RGBA', size, (255, 255, 255, 0)) image.paste(resized_image, ((size[0] - resized_image.size[0]) / 2, (size[1] - resized_image.size[1]) / 2)) + if image.mode != origin_mode: + image = image.convert(origin_mode) return image def image_save_for_web(image, fp=None, format=None): From 15aa164eaf3819e46fa796bcfa6427c7014bb1dd Mon Sep 17 00:00:00 2001 From: Yannick Tivisse Date: Fri, 7 Jul 2017 11:38:16 +0200 Subject: [PATCH 11/11] [FIX] account: Fix forward-port mismatch on res_config.py --- addons/account/models/res_config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/models/res_config.py b/addons/account/models/res_config.py index 6ffcee636e5..0b7284bcc54 100644 --- a/addons/account/models/res_config.py +++ b/addons/account/models/res_config.py @@ -129,6 +129,6 @@ class AccountConfigSettings(models.TransientModel): company = self.env['res.company'].browse(values.get('company_id')) if company.currency_id.id == values.get('currency_id'): values.pop('currency_id') - if company.accounts_code_digits == vals.get('code_digits'): - vals.pop('code_digits') + if company.accounts_code_digits == values.get('code_digits'): + values.pop('code_digits') return super(AccountConfigSettings, self).create(values)