From ea35b9901778ae076e4cef41124bf865404a9552 Mon Sep 17 00:00:00 2001 From: "dle@openerp.com" <> Date: Mon, 17 Dec 2012 10:36:43 +0100 Subject: [PATCH 01/16] [FIX]Raise exception when Bank account with no journal bzr revid: dle@openerp.com-20121217093643-s0hhro1gdk66u87h --- addons/l10n_be_coda/wizard/account_coda_import.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/addons/l10n_be_coda/wizard/account_coda_import.py b/addons/l10n_be_coda/wizard/account_coda_import.py index 23b2775357c..0745bd410d6 100644 --- a/addons/l10n_be_coda/wizard/account_coda_import.py +++ b/addons/l10n_be_coda/wizard/account_coda_import.py @@ -89,19 +89,20 @@ class account_coda_import(osv.osv_memory): raise osv.except_osv(_('Error') + ' R1002', _('Foreign bank accounts with IBAN structure are not supported ')) else: # Something else, not supported raise osv.except_osv(_('Error') + ' R1003', _('Unsupported bank account structure ')) + statement['journal_id'] = False + statement['bank_account'] = False bank_ids = self.pool.get('res.partner.bank').search(cr, uid, [('acc_number', '=', statement['acc_number'])]) - not_found_except = osv.except_osv(_('Error') + ' R1004', _("No matching Bank Account.\n\nPlease set-up a Bank Account with as Account Number '%s' and as Currency '%s'.") % (statement['acc_number'], statement['currency'])) if bank_ids and len(bank_ids) > 0: bank_accs = self.pool.get('res.partner.bank').browse(cr, uid, bank_ids) for bank_acc in bank_accs: - if (bank_acc.journal_id.currency and bank_acc.journal_id.currency.name != statement['currency']) and (not bank_acc.journal_id.currency and bank_acc.journal_id.company_id.currency_id.name != statement['currency']): - raise not_found_except - else: + if not (bank_acc.journal_id.currency and bank_acc.journal_id.currency.name != statement['currency']) and (not bank_acc.journal_id.currency and bank_acc.journal_id.company_id.currency_id.name != statement['currency']): statement['journal_id'] = bank_acc.journal_id statement['bank_account'] = bank_acc break - else: - raise not_found_except + if statement['bank_account'] == False: + raise osv.except_osv(_('Error') + ' R1004', _("No matching Bank Account.\n\nPlease set-up a Bank Account with as Account Number '%s' and as Currency '%s'.") % (statement['acc_number'], statement['currency'])) + elif statement['journal_id'] == False: + raise osv.except_osv(_('Error') + ' R1005', _("Your bank account '%s' has been found, but no Account Journal is set for it.\n\nPlease set it.") % (statement['acc_number'])) statement['description'] = rmspaces(line[90:125]) statement['balance_start'] = float(rmspaces(line[43:58])) / 1000 statement['balance_start_date'] = time.strftime(tools.DEFAULT_SERVER_DATE_FORMAT, time.strptime(rmspaces(line[58:64]), '%d%m%y')) From 09a4a59eb8599f9153b30f49427a003905358ecb Mon Sep 17 00:00:00 2001 From: "dle@openerp.com" <> Date: Mon, 17 Dec 2012 11:38:14 +0100 Subject: [PATCH 02/16] [FIX]Not not well placed bzr revid: dle@openerp.com-20121217103814-8f30cy0w2v7m1wy7 --- addons/l10n_be_coda/wizard/account_coda_import.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/l10n_be_coda/wizard/account_coda_import.py b/addons/l10n_be_coda/wizard/account_coda_import.py index 0745bd410d6..948b6e79f11 100644 --- a/addons/l10n_be_coda/wizard/account_coda_import.py +++ b/addons/l10n_be_coda/wizard/account_coda_import.py @@ -95,7 +95,7 @@ class account_coda_import(osv.osv_memory): if bank_ids and len(bank_ids) > 0: bank_accs = self.pool.get('res.partner.bank').browse(cr, uid, bank_ids) for bank_acc in bank_accs: - if not (bank_acc.journal_id.currency and bank_acc.journal_id.currency.name != statement['currency']) and (not bank_acc.journal_id.currency and bank_acc.journal_id.company_id.currency_id.name != statement['currency']): + if not ((bank_acc.journal_id.currency and bank_acc.journal_id.currency.name != statement['currency']) and (not bank_acc.journal_id.currency and bank_acc.journal_id.company_id.currency_id.name != statement['currency'])): statement['journal_id'] = bank_acc.journal_id statement['bank_account'] = bank_acc break From 2810ca9c31a0d8e05c5cb8ced026717dc177539a Mon Sep 17 00:00:00 2001 From: "dle@openerp.com" <> Date: Tue, 18 Dec 2012 10:44:39 +0100 Subject: [PATCH 03/16] [FIX]Handle IBAN Format and check journal_id is set for bank account bzr revid: dle@openerp.com-20121218094439-jj1o2c53cu7w90mu --- addons/l10n_be_coda/wizard/account_coda_import.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/addons/l10n_be_coda/wizard/account_coda_import.py b/addons/l10n_be_coda/wizard/account_coda_import.py index 948b6e79f11..865d096a71d 100644 --- a/addons/l10n_be_coda/wizard/account_coda_import.py +++ b/addons/l10n_be_coda/wizard/account_coda_import.py @@ -91,18 +91,21 @@ class account_coda_import(osv.osv_memory): raise osv.except_osv(_('Error') + ' R1003', _('Unsupported bank account structure ')) statement['journal_id'] = False statement['bank_account'] = False - bank_ids = self.pool.get('res.partner.bank').search(cr, uid, [('acc_number', '=', statement['acc_number'])]) + if len(statement['acc_number']) >= 12: + cr.execute("select id from res_partner_bank where replace(acc_number,' ','') like '%" + statement['acc_number'] + "%'") + else: + cr.execute("select id from res_partner_bank where replace(acc_number,' ','') = '" + statement['acc_number'] + "'") + bank_ids = [id[0] for id in cr.fetchall()] + print bank_ids if bank_ids and len(bank_ids) > 0: bank_accs = self.pool.get('res.partner.bank').browse(cr, uid, bank_ids) for bank_acc in bank_accs: - if not ((bank_acc.journal_id.currency and bank_acc.journal_id.currency.name != statement['currency']) and (not bank_acc.journal_id.currency and bank_acc.journal_id.company_id.currency_id.name != statement['currency'])): + if not (bank_acc.journal_id and (bank_acc.journal_id.currency and bank_acc.journal_id.currency.name != statement['currency']) and (not bank_acc.journal_id.currency and bank_acc.journal_id.company_id.currency_id.name != statement['currency'])): statement['journal_id'] = bank_acc.journal_id statement['bank_account'] = bank_acc break if statement['bank_account'] == False: - raise osv.except_osv(_('Error') + ' R1004', _("No matching Bank Account.\n\nPlease set-up a Bank Account with as Account Number '%s' and as Currency '%s'.") % (statement['acc_number'], statement['currency'])) - elif statement['journal_id'] == False: - raise osv.except_osv(_('Error') + ' R1005', _("Your bank account '%s' has been found, but no Account Journal is set for it.\n\nPlease set it.") % (statement['acc_number'])) + raise osv.except_osv(_('Error') + ' R1004', _("No matching Bank Account (with Account Journal) found.\n\nPlease set-up a Bank Account with as Account Number '%s' and as Currency '%s' and an Account Journal.") % (statement['acc_number'], statement['currency'])) statement['description'] = rmspaces(line[90:125]) statement['balance_start'] = float(rmspaces(line[43:58])) / 1000 statement['balance_start_date'] = time.strftime(tools.DEFAULT_SERVER_DATE_FORMAT, time.strptime(rmspaces(line[58:64]), '%d%m%y')) From 9e0df9b5d15e85e87f1f5473f956b2663e27bac2 Mon Sep 17 00:00:00 2001 From: "dle@openerp.com" <> Date: Tue, 18 Dec 2012 11:05:00 +0100 Subject: [PATCH 04/16] [FIX]Prevent sql injection and remove print bzr revid: dle@openerp.com-20121218100500-fd1j2rr5flfzgrse --- addons/l10n_be_coda/wizard/account_coda_import.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/l10n_be_coda/wizard/account_coda_import.py b/addons/l10n_be_coda/wizard/account_coda_import.py index 865d096a71d..e0c0be40c8c 100644 --- a/addons/l10n_be_coda/wizard/account_coda_import.py +++ b/addons/l10n_be_coda/wizard/account_coda_import.py @@ -92,11 +92,10 @@ class account_coda_import(osv.osv_memory): statement['journal_id'] = False statement['bank_account'] = False if len(statement['acc_number']) >= 12: - cr.execute("select id from res_partner_bank where replace(acc_number,' ','') like '%" + statement['acc_number'] + "%'") + cr.execute("select id from res_partner_bank where replace(acc_number,' ','') like '%%%s%%'" % statement['acc_number']) else: - cr.execute("select id from res_partner_bank where replace(acc_number,' ','') = '" + statement['acc_number'] + "'") + cr.execute("select id from res_partner_bank where replace(acc_number,' ','') = '%s'" % statement['acc_number']) bank_ids = [id[0] for id in cr.fetchall()] - print bank_ids if bank_ids and len(bank_ids) > 0: bank_accs = self.pool.get('res.partner.bank').browse(cr, uid, bank_ids) for bank_acc in bank_accs: From 79552522598f49389af873d6d4d5fde66dadab16 Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Tue, 18 Dec 2012 11:10:49 +0100 Subject: [PATCH 05/16] [FIX] account_followup: restrict an inherited view to a group. This view causes an access right error in the web client, because the it reads a field with followup lines, on which the user has no access right. bzr revid: rco@openerp.com-20121218101049-nuzguzwcnokn118b --- addons/account_followup/account_followup_customers.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/account_followup/account_followup_customers.xml b/addons/account_followup/account_followup_customers.xml index 0471eb52fbe..8a27730b003 100644 --- a/addons/account_followup/account_followup_customers.xml +++ b/addons/account_followup/account_followup_customers.xml @@ -62,6 +62,7 @@ res.partner.followup.form.inherit res.partner + From d98b1b0ff55223ae118e8461a84f908995d6c736 Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Tue, 18 Dec 2012 11:19:16 +0100 Subject: [PATCH 06/16] [IMP] res_groups: add m2m field to see view restrictions with given group bzr revid: rco@openerp.com-20121218101916-r97xja82556schfg --- openerp/addons/base/res/res_users.py | 1 + openerp/addons/base/res/res_users_view.xml | 3 +++ 2 files changed, 4 insertions(+) diff --git a/openerp/addons/base/res/res_users.py b/openerp/addons/base/res/res_users.py index 0ee7c9b3d6b..a2301cec37e 100644 --- a/openerp/addons/base/res/res_users.py +++ b/openerp/addons/base/res/res_users.py @@ -67,6 +67,7 @@ class groups(osv.osv): 'rule_groups': fields.many2many('ir.rule', 'rule_group_rel', 'group_id', 'rule_group_id', 'Rules', domain=[('global', '=', False)]), 'menu_access': fields.many2many('ir.ui.menu', 'ir_ui_menu_group_rel', 'gid', 'menu_id', 'Access Menu'), + 'view_access': fields.many2many('ir.ui.view', 'ir_ui_view_group_rel', 'group_id', 'view_id', 'Views'), 'comment' : fields.text('Comment', size=250, translate=True), 'category_id': fields.many2one('ir.module.category', 'Application', select=True), 'full_name': fields.function(_get_full_name, type='char', string='Group Name', fnct_search=_search_group), diff --git a/openerp/addons/base/res/res_users_view.xml b/openerp/addons/base/res/res_users_view.xml index 1b0138ddbe5..9a4f88cd1fc 100644 --- a/openerp/addons/base/res/res_users_view.xml +++ b/openerp/addons/base/res/res_users_view.xml @@ -32,6 +32,9 @@ + + + From 4a07e497da6f43b99e701301fff90ec4fb64a4d0 Mon Sep 17 00:00:00 2001 From: "dle@openerp.com" <> Date: Tue, 18 Dec 2012 11:25:01 +0100 Subject: [PATCH 07/16] =?UTF-8?q?[FIX]Prevent=20sql=20injection=C2=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bzr revid: dle@openerp.com-20121218102501-mguye0rnkl0yjgm1 --- addons/l10n_be_coda/wizard/account_coda_import.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/l10n_be_coda/wizard/account_coda_import.py b/addons/l10n_be_coda/wizard/account_coda_import.py index e0c0be40c8c..33ab9a64aa0 100644 --- a/addons/l10n_be_coda/wizard/account_coda_import.py +++ b/addons/l10n_be_coda/wizard/account_coda_import.py @@ -92,9 +92,9 @@ class account_coda_import(osv.osv_memory): statement['journal_id'] = False statement['bank_account'] = False if len(statement['acc_number']) >= 12: - cr.execute("select id from res_partner_bank where replace(acc_number,' ','') like '%%%s%%'" % statement['acc_number']) + cr.execute("select id from res_partner_bank where replace(acc_number,' ','') like %s", ('%' + statement['acc_number'] + '%',)) else: - cr.execute("select id from res_partner_bank where replace(acc_number,' ','') = '%s'" % statement['acc_number']) + cr.execute("select id from res_partner_bank where replace(acc_number,' ','') = %s", (statement['acc_number'],)) bank_ids = [id[0] for id in cr.fetchall()] if bank_ids and len(bank_ids) > 0: bank_accs = self.pool.get('res.partner.bank').browse(cr, uid, bank_ids) From 9041fb2c0594da4dc756f36bc3a4e9e1381f88e7 Mon Sep 17 00:00:00 2001 From: "dle@openerp.com" <> Date: Tue, 18 Dec 2012 11:45:32 +0100 Subject: [PATCH 08/16] [ADD]Comments bzr revid: dle@openerp.com-20121218104532-jvugb4cm2g1w90g8 --- .../l10n_be_coda/wizard/account_coda_import.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/addons/l10n_be_coda/wizard/account_coda_import.py b/addons/l10n_be_coda/wizard/account_coda_import.py index 33ab9a64aa0..f3d21064276 100644 --- a/addons/l10n_be_coda/wizard/account_coda_import.py +++ b/addons/l10n_be_coda/wizard/account_coda_import.py @@ -91,10 +91,24 @@ class account_coda_import(osv.osv_memory): raise osv.except_osv(_('Error') + ' R1003', _('Unsupported bank account structure ')) statement['journal_id'] = False statement['bank_account'] = False + """ + Belgian Account Numbers are composed of 12 digits. + In OpenERP, the user can fill the bank number in any format: With or without IBan code, with or without spaces, with or without '-' + The two following sql requests handle those cases. + """ if len(statement['acc_number']) >= 12: - cr.execute("select id from res_partner_bank where replace(acc_number,' ','') like %s", ('%' + statement['acc_number'] + '%',)) + """ + If the Account Number is >= 12 digits, it is mostlikely a Belgian Account Number (With or without IBAN). + The following request try to find the Account Number using a 'like' operator. + So, if the Account Number is stored with IBAN code, it can be found thanks to this. + """ + cr.execute("select id from res_partner_bank where replace('-','',replace(acc_number,' ','')) like %s", ('%' + statement['acc_number'] + '%',)) else: - cr.execute("select id from res_partner_bank where replace(acc_number,' ','') = %s", (statement['acc_number'],)) + """ + This case is necessary to avoid cases like the Account Number in the CODA file is set to a single or few digits, + and so a 'like' operator would return the first account number in the database which matches. + """ + cr.execute("select id from res_partner_bank where replace('-','',replace(acc_number,' ','')) = %s", (statement['acc_number'],)) bank_ids = [id[0] for id in cr.fetchall()] if bank_ids and len(bank_ids) > 0: bank_accs = self.pool.get('res.partner.bank').browse(cr, uid, bank_ids) From 1ac1a6508a5b81f02e436eceeb2fbfbdb84810e8 Mon Sep 17 00:00:00 2001 From: "dle@openerp.com" <> Date: Tue, 18 Dec 2012 12:01:05 +0100 Subject: [PATCH 09/16] [FIX]Replace missplaced bzr revid: dle@openerp.com-20121218110105-pt18zaefasmkiaky --- addons/l10n_be_coda/wizard/account_coda_import.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/l10n_be_coda/wizard/account_coda_import.py b/addons/l10n_be_coda/wizard/account_coda_import.py index f3d21064276..05dd7d5141c 100644 --- a/addons/l10n_be_coda/wizard/account_coda_import.py +++ b/addons/l10n_be_coda/wizard/account_coda_import.py @@ -102,13 +102,13 @@ class account_coda_import(osv.osv_memory): The following request try to find the Account Number using a 'like' operator. So, if the Account Number is stored with IBAN code, it can be found thanks to this. """ - cr.execute("select id from res_partner_bank where replace('-','',replace(acc_number,' ','')) like %s", ('%' + statement['acc_number'] + '%',)) + cr.execute("select id from res_partner_bank where replace(replace(acc_number,' ',''),'-','') like %s", ('%' + statement['acc_number'] + '%',)) else: """ This case is necessary to avoid cases like the Account Number in the CODA file is set to a single or few digits, and so a 'like' operator would return the first account number in the database which matches. """ - cr.execute("select id from res_partner_bank where replace('-','',replace(acc_number,' ','')) = %s", (statement['acc_number'],)) + cr.execute("select id from res_partner_bank where replace(replace(acc_number,' ',''),'-','') = %s", (statement['acc_number'],)) bank_ids = [id[0] for id in cr.fetchall()] if bank_ids and len(bank_ids) > 0: bank_accs = self.pool.get('res.partner.bank').browse(cr, uid, bank_ids) From db00d1f61a19455f0b6ae71965e7e49f3cace2fd Mon Sep 17 00:00:00 2001 From: "dle@openerp.com" <> Date: Tue, 18 Dec 2012 12:10:09 +0100 Subject: [PATCH 10/16] [IMP]Comments with # instead of """ bzr revid: dle@openerp.com-20121218111009-6tegxgjgh04hfint --- .../wizard/account_coda_import.py | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/addons/l10n_be_coda/wizard/account_coda_import.py b/addons/l10n_be_coda/wizard/account_coda_import.py index 05dd7d5141c..67ac742c6b6 100644 --- a/addons/l10n_be_coda/wizard/account_coda_import.py +++ b/addons/l10n_be_coda/wizard/account_coda_import.py @@ -91,23 +91,17 @@ class account_coda_import(osv.osv_memory): raise osv.except_osv(_('Error') + ' R1003', _('Unsupported bank account structure ')) statement['journal_id'] = False statement['bank_account'] = False - """ - Belgian Account Numbers are composed of 12 digits. - In OpenERP, the user can fill the bank number in any format: With or without IBan code, with or without spaces, with or without '-' - The two following sql requests handle those cases. - """ + # Belgian Account Numbers are composed of 12 digits. + # In OpenERP, the user can fill the bank number in any format: With or without IBan code, with or without spaces, with or without '-' + # The two following sql requests handle those cases. if len(statement['acc_number']) >= 12: - """ - If the Account Number is >= 12 digits, it is mostlikely a Belgian Account Number (With or without IBAN). - The following request try to find the Account Number using a 'like' operator. - So, if the Account Number is stored with IBAN code, it can be found thanks to this. - """ + # If the Account Number is >= 12 digits, it is mostlikely a Belgian Account Number (With or without IBAN). + # The following request try to find the Account Number using a 'like' operator. + # So, if the Account Number is stored with IBAN code, it can be found thanks to this. cr.execute("select id from res_partner_bank where replace(replace(acc_number,' ',''),'-','') like %s", ('%' + statement['acc_number'] + '%',)) else: - """ - This case is necessary to avoid cases like the Account Number in the CODA file is set to a single or few digits, - and so a 'like' operator would return the first account number in the database which matches. - """ + # This case is necessary to avoid cases like the Account Number in the CODA file is set to a single or few digits, + # and so a 'like' operator would return the first account number in the database which matches. cr.execute("select id from res_partner_bank where replace(replace(acc_number,' ',''),'-','') = %s", (statement['acc_number'],)) bank_ids = [id[0] for id in cr.fetchall()] if bank_ids and len(bank_ids) > 0: From fcf4d4040fbcae0fd5ddf3fccd0951c58fb8df66 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Tue, 18 Dec 2012 12:17:34 +0100 Subject: [PATCH 11/16] [ADD] Allow admin to edit the company logo bzr revid: fme@openerp.com-20121218111734-wu02xaifqyqz1g20 --- addons/web/static/src/css/base.css | 19 +++++++++++++++++++ addons/web/static/src/css/base.sass | 14 ++++++++++++++ addons/web/static/src/js/chrome.js | 27 ++++++++++++++++++++++++++- addons/web/static/src/xml/base.xml | 5 ++++- 4 files changed, 63 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index c76403a1443..39bb5d8c5d9 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -1182,6 +1182,7 @@ padding-bottom: 16px; } .openerp a.oe_logo { + position: relative; width: 220px; display: block; text-align: center; @@ -1190,6 +1191,24 @@ margin: 14px 0; border: 0; } +.openerp a.oe_logo .oe_logo_edit { + margin: 14px 0; + position: absolute; + top: 1px; + padding: 4px; + width: 100%; + display: none; + text-align: center; + color: #eeeeee; + background: rgba(37, 37, 37, 0.9); + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; +} +.openerp a.oe_logo:hover .oe_logo_edit_admin { + display: block; +} .openerp .oe_footer { position: fixed; bottom: 0; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index bf0ff4cece4..eab40a5b5bd 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -958,12 +958,26 @@ $sheet-padding: 16px text-shadow: 0 1px 1px white padding-bottom: 16px a.oe_logo + position: relative width: 220px display: block text-align: center img margin: 14px 0 border: 0 + .oe_logo_edit + margin: 14px 0 + position: absolute + top: 1px + padding: 4px + width: 100% + display: none + text-align: center + color: #eee + background: rgba(37,37,37,0.9) + @include box-sizing(border) + &:hover .oe_logo_edit_admin + display: block .oe_footer position: fixed bottom: 0 diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 9e5a5936089..4ad159e3ac5 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -1118,6 +1118,9 @@ instance.web.Client = instance.web.Widget.extend({ instance.web.WebClient = instance.web.Client.extend({ _template: 'WebClient', + events: { + 'click .oe_logo_edit_admin': 'logo_edit' + }, init: function(parent) { this._super(parent); this._current_state = null; @@ -1188,7 +1191,29 @@ instance.web.WebClient = instance.web.Client.extend({ }, update_logo: function() { var img = this.session.url('/web/binary/company_logo'); - this.$el.find('.oe_logo img').attr('src', '').attr('src', img); + this.$('.oe_logo img').attr('src', '').attr('src', img); + this.$('.oe_logo_edit').toggleClass('oe_logo_edit_admin', this.session.uid === 1); + }, + logo_edit: function(ev) { + var self = this; + new instance.web.Model("res.users").get_func("read")(this.session.uid, ["company_id"]).then(function(res) { + self.rpc("/web/action/load", { action_id: "base.action_res_company_form" }).done(function(result) { + result.res_id = res['company_id'][0]; + result.target = "new"; + result.views = [[false, 'form']]; + result.flags = { + action_buttons: true, + }; + self.action_manager.do_action(result); + var form = self.action_manager.dialog_widget.views.form.controller; + form.on("on_button_cancel", self.action_manager.dialog, self.action_manager.dialog.close); + form.on('record_saved', self, function() { + self.action_manager.dialog.close(); + self.update_logo(); + }); + }); + }); + return false; }, check_timezone: function() { var self = this; diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index dc31a24dc31..5afadaeffd0 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -439,7 +439,10 @@ - +