From 67aa9fa31a7c64bf59a1b942ecbe6dc83c878241 Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Wed, 11 Jul 2012 12:44:05 +0530 Subject: [PATCH 01/45] [IMP] load translation using 'translation' http service bzr revid: tpa@tinyerp.com-20120711071405-g0biuqlctedlbcs9 --- addons/web/controllers/main.py | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 412ea9abda2..5d7aa93f3a5 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -353,25 +353,15 @@ class WebClient(openerpweb.Controller): langs = lang.split(separator) langs = [separator.join(langs[:x]) for x in range(1, len(langs) + 1)] - transs = {} - for addon_name in mods: - transl = {"messages":[]} - transs[addon_name] = transl - addons_path = openerpweb.addons_manifest[addon_name]['addons_path'] - for l in langs: - f_name = os.path.join(addons_path, addon_name, "i18n", l + ".po") - if not os.path.exists(f_name): - continue - try: - with open(f_name) as t_file: - po = babel.messages.pofile.read_po(t_file) - except Exception: - continue - for x in po: - if x.id and x.string and "openerp-web" in x.auto_comments: - transl["messages"].append({'id': x.id, 'string': x.string}) - return {"modules": transs, - "lang_parameters": lang_obj} + messages = {} + for mod in mods: + messages[mod] = {"messages":[]} + proxy = req.session.proxy("translation") + trans = proxy.load(req.session._db, [mod], langs, "web") + if trans: + messages[mod] = trans + return {"modules": {'messages': messages}, + "lang_parameters": lang_obj} @openerpweb.jsonrequest def version_info(self, req): From f0f4ba6d413ce89e016b26895f1e3fb62450d2ae Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Thu, 12 Jul 2012 16:11:10 +0530 Subject: [PATCH 02/45] [IMP] improved code. bzr revid: tpa@tinyerp.com-20120712104110-wot1evq0affpx2tp --- addons/web/controllers/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 5d7aa93f3a5..eb60b178ad2 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -360,7 +360,7 @@ class WebClient(openerpweb.Controller): trans = proxy.load(req.session._db, [mod], langs, "web") if trans: messages[mod] = trans - return {"modules": {'messages': messages}, + return {"modules": messages, "lang_parameters": lang_obj} @openerpweb.jsonrequest From 4bbbef1929fc41b9928690ac77112ec5aa3db452 Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Thu, 12 Jul 2012 16:29:55 +0530 Subject: [PATCH 03/45] [IMP] improved code for load translation when run web without embedded mode. bzr revid: tpa@tinyerp.com-20120712105955-szwm5vb49va6o4dp --- addons/web/controllers/main.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index eb60b178ad2..75feed44c69 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -360,6 +360,24 @@ class WebClient(openerpweb.Controller): trans = proxy.load(req.session._db, [mod], langs, "web") if trans: messages[mod] = trans + # keep loading from .po (Reason to run web without embedded mode) + if not messages['web']['messages']: + for addon_name in mods: + transl = {'messages':[]} + messages[addon_name] = transl + addons_path = openerpweb.addons_manifest[addon_name]['addons_path'] + for l in langs: + f_name = os.path.join(addons_path, addon_name, "i18n", l + ".po") + if not os.path.exists(f_name): + continue + try: + with open(f_name) as t_file: + po = babel.messages.pofile.read_po(t_file) + except Exception: + continue + for x in po: + if x.id and x.string and "openerp-web" in x.auto_comments: + transl["messages"].append({'id': x.id, 'string': x.string}) return {"modules": messages, "lang_parameters": lang_obj} From e9c78767dd87c003c6e93f679e531e34b90d04c7 Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Thu, 12 Jul 2012 18:55:42 +0530 Subject: [PATCH 04/45] [IMP] improved code bzr revid: tpa@tinyerp.com-20120712132542-c19ysod7jm5jmukc --- addons/web/controllers/main.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 75feed44c69..6c0e2e4dc9b 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -357,9 +357,7 @@ class WebClient(openerpweb.Controller): for mod in mods: messages[mod] = {"messages":[]} proxy = req.session.proxy("translation") - trans = proxy.load(req.session._db, [mod], langs, "web") - if trans: - messages[mod] = trans + messages[mod] = proxy.load(req.session._db, [mod], langs, "web") # keep loading from .po (Reason to run web without embedded mode) if not messages['web']['messages']: for addon_name in mods: From 0d4bd736e1bd8c8acb78f63e190111b1c72b05af Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Fri, 13 Jul 2012 12:30:48 +0530 Subject: [PATCH 05/45] [IMP] improved code to get formeted traslation from server. bzr revid: tpa@tinyerp.com-20120713070048-7yxm3fcajemiingc --- addons/web/controllers/main.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 6c0e2e4dc9b..7cde4040e4f 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -353,11 +353,8 @@ class WebClient(openerpweb.Controller): langs = lang.split(separator) langs = [separator.join(langs[:x]) for x in range(1, len(langs) + 1)] - messages = {} - for mod in mods: - messages[mod] = {"messages":[]} - proxy = req.session.proxy("translation") - messages[mod] = proxy.load(req.session._db, [mod], langs, "web") + proxy = req.session.proxy("translation") + messages = proxy.load(req.session._db, mods, langs, "web") # keep loading from .po (Reason to run web without embedded mode) if not messages['web']['messages']: for addon_name in mods: From 58e20e9c8f0f40b93a0d4dd1ff68666d49311949 Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Mon, 16 Jul 2012 11:30:56 +0530 Subject: [PATCH 06/45] [IMP] improved code to load data from po. bzr revid: tpa@tinyerp.com-20120716060056-3az6awpd6gw39hii --- addons/web/controllers/main.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 7cde4040e4f..024360ce5e6 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -355,14 +355,11 @@ class WebClient(openerpweb.Controller): proxy = req.session.proxy("translation") messages = proxy.load(req.session._db, mods, langs, "web") - # keep loading from .po (Reason to run web without embedded mode) - if not messages['web']['messages']: - for addon_name in mods: - transl = {'messages':[]} - messages[addon_name] = transl - addons_path = openerpweb.addons_manifest[addon_name]['addons_path'] + for mod in messages: + if not messages[mod]['messages']: + addons_path = openerpweb.addons_manifest[mod]['addons_path'] for l in langs: - f_name = os.path.join(addons_path, addon_name, "i18n", l + ".po") + f_name = os.path.join(addons_path, mod, "i18n", l + ".po") if not os.path.exists(f_name): continue try: @@ -372,7 +369,7 @@ class WebClient(openerpweb.Controller): continue for x in po: if x.id and x.string and "openerp-web" in x.auto_comments: - transl["messages"].append({'id': x.id, 'string': x.string}) + messages[mod]["messages"].append({'id': x.id, 'string': x.string}) return {"modules": messages, "lang_parameters": lang_obj} From ca9c79727541fbf87f316906887e920e79b9550c Mon Sep 17 00:00:00 2001 From: Amit Parik Date: Wed, 5 Sep 2012 17:03:13 +0530 Subject: [PATCH 07/45] [FIX]:project_timesheet impossible to edit task work bzr revid: pja@tinyerp.com-20120905113313-c2cbi37xqr6mnvrc --- addons/project_timesheet/project_timesheet.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/project_timesheet/project_timesheet.py b/addons/project_timesheet/project_timesheet.py index 1e50848201c..12d1eedbeb2 100644 --- a/addons/project_timesheet/project_timesheet.py +++ b/addons/project_timesheet/project_timesheet.py @@ -166,10 +166,7 @@ class project_work(osv.osv): vals_line['name'] = '%s: %s' % (tools.ustr(task.task_id.name), tools.ustr(vals['name']) or '/') if 'user_id' in vals: vals_line['user_id'] = vals['user_id'] - result = self.get_user_related_details(cr, uid, vals.get('user_id', task.user_id.id)) - for fld in ('product_id', 'general_account_id', 'journal_id', 'product_uom_id'): - if result.get(fld, False): - vals_line[fld] = result[fld] + if 'date' in vals: vals_line['date'] = vals['date'][:10] @@ -177,7 +174,10 @@ class project_work(osv.osv): default_uom = self.pool.get('res.users').browse(cr, uid, uid).company_id.project_time_mode_id.id vals_line['unit_amount'] = vals['hours'] prod_id = vals_line.get('product_id', line_id.product_id.id) # False may be set - + result = self.get_user_related_details(cr, uid, vals.get('user_id', task.user_id.id)) + for fld in ('product_id', 'general_account_id', 'journal_id', 'product_uom_id'): + if result.get(fld, False): + vals_line[fld] = result[fld] if result.get('product_uom_id',False) and (not result['product_uom_id'] == default_uom): vals_line['unit_amount'] = uom_obj._compute_qty(cr, uid, default_uom, vals['hours'], result['product_uom_id']) From a3a2ec416b3fb4be2dbf6ed0333b3d1417ddc206 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Tue, 18 Sep 2012 09:28:02 +0200 Subject: [PATCH 08/45] [IMP] translation: load translations from ir.translation after authenticating, use local POs for bootstrap only (login page) bzr revid: odo@openerp.com-20120918072802-568n19bg1ecm1m2t --- addons/web/controllers/main.py | 161 ++++++++++++++------------ addons/web/static/src/js/coresetup.js | 7 +- addons/web/static/src/xml/base.xml | 2 +- 3 files changed, 93 insertions(+), 77 deletions(-) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index d420ba9175d..35698d1085d 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -19,7 +19,6 @@ import zlib from xml.etree import ElementTree from cStringIO import StringIO -import babel.messages.pofile import werkzeug.utils import werkzeug.wrappers try: @@ -203,47 +202,8 @@ def module_installed(req): sorted_modules = module_topological_sort(modules) return sorted_modules -def module_installed_bypass_session(dbname): - loadable = openerpweb.addons_manifest.keys() - modules = {} - try: - import openerp.modules.registry - registry = openerp.modules.registry.RegistryManager.get(dbname) - with registry.cursor() as cr: - m = registry.get('ir.module.module') - # TODO The following code should move to ir.module.module.list_installed_modules() - domain = [('state','=','installed'), ('name','in', loadable)] - ids = m.search(cr, 1, [('state','=','installed'), ('name','in', loadable)]) - for module in m.read(cr, 1, ids, ['name', 'dependencies_id']): - modules[module['name']] = [] - deps = module.get('dependencies_id') - if deps: - deps_read = registry.get('ir.module.module.dependency').read(cr, 1, deps, ['name']) - dependencies = [i['name'] for i in deps_read] - modules[module['name']] = dependencies - except Exception,e: - pass - sorted_modules = module_topological_sort(modules) - return sorted_modules - def module_boot(req): - serverside = [] - dbside = [] - for i in req.config.server_wide_modules: - if i in openerpweb.addons_manifest: - serverside.append(i) - # if only one db load every module at boot - dbs = [] - try: - dbs = db_list(req) - except xmlrpclib.Fault: - # ignore access denied - pass - if len(dbs) == 1: - dbside = module_installed_bypass_session(dbs[0]) - dbside = [i for i in dbside if i not in serverside] - addons = serverside + dbside - return addons + return [m for m in req.config.server_wide_modules if m in openerpweb.addons_manifest] def concat_xml(file_list): """Concatenate xml files @@ -531,6 +491,38 @@ def parse_context(context, session): except ValueError: return common.nonliterals.Context(session, context) + +# PO file parsing - only used to boostrap translations on the login page +try: + # Use the faster PO parser from OpenERP server when available + from openerp.tools.translate import TinyPoFile + def _local_web_translations(trans_file): + messages = [] + try: + with open(trans_file) as t_file: + po = TinyPoFile(t_file) + for _, _, _, source, value, comments in po: + if "openerp-web" in comments: + messages.append({'id': source, 'string': value}) + except Exception: + pass + return messages +except ImportError: + # Otherwise fallback to Babel's slightly slower PO parser + import babel.messages.pofile + def _local_web_translations(trans_file): + messages = [] + try: + with open(trans_file) as t_file: + po = babel.messages.pofile.read_po(t_file) + except Exception: + return + for x in po: + if x.id and x.string and "openerp-web" in x.auto_comments: + messages.append({'id': x.id, 'string': x.string}) + return messages + + #---------------------------------------------------------- # OpenERP Web web Controllers #---------------------------------------------------------- @@ -576,6 +568,7 @@ class Home(openerpweb.Controller): def login(self, req, db, login, key): return login_and_redirect(req, db, login, key) + class WebClient(openerpweb.Controller): _cp_path = "/web/webclient" @@ -658,41 +651,59 @@ class WebClient(openerpweb.Controller): last_modified, checksum) @openerpweb.jsonrequest - def translations(self, req, mods, lang): - lang_model = req.session.model('res.lang') - ids = lang_model.search([("code", "=", lang)]) - if ids: - lang_obj = lang_model.read(ids[0], ["direction", "date_format", "time_format", - "grouping", "decimal_point", "thousands_sep"]) - else: - lang_obj = None + def bootstrap_translations(self, req, mods): + """ Load local translations from *.po files, as a temporary solution + until we have established a valid session. This is meant only + for translating the login page and db management chrome, using + the browser's language. """ + lang = req.httprequest.accept_languages.best or 'en' + # For performance reasons we only load a single translation, so for + # sub-languages (that should only be partially translated) we load the + # main language PO instead - that should be enough for the login screen. + if '-' in lang: # RFC2616 uses '-' separators for sublanguages + lang = [lang.split('-',1)[0], lang] - if "_" in lang: - separator = "_" - else: - separator = "@" - langs = lang.split(separator) - langs = [separator.join(langs[:x]) for x in range(1, len(langs) + 1)] - - proxy = req.session.proxy("translation") - messages = proxy.load(req.session._db, mods, langs, "web") + translations_per_module = {} for addon_name in mods: - if not messages[addon_name]['messages']: - addons_path = openerpweb.addons_manifest[addon_name]['addons_path'] - for l in langs: - f_name = os.path.join(addons_path, addon_name, "i18n", l + ".po") - if not os.path.exists(f_name): - continue - try: - with open(f_name) as t_file: - po = babel.messages.pofile.read_po(t_file) - except Exception: - continue - for x in po: - if x.id and x.string and "openerp-web" in x.auto_comments: - messages[addon_name]["messages"].append({'id': x.id, 'string': x.string}) - return {"modules": messages, - "lang_parameters": lang_obj} + addons_path = openerpweb.addons_manifest[addon_name]['addons_path'] + f_name = os.path.join(addons_path, addon_name, "i18n", lang + ".po") + if not os.path.exists(f_name): + continue + translations_per_module[addon_name] = {'messages': _local_web_translations(f_name)} + + return {"modules": translations_per_module, + "lang_parameters": None} + + @openerpweb.jsonrequest + def translations(self, req, mods, lang): + res_lang = req.session.model('res.lang') + ids = res_lang.search([("code", "=", lang)]) + lang_params = None + if ids: + lang_params = res_lang.read(ids[0], ["direction", "date_format", "time_format", + "grouping", "decimal_point", "thousands_sep"]) + + # Regional languages (ll_CC) must inherit/override their parent lang (ll), but this is + # done server-side when the language is loaded, so we only need to load the user's lang. + start = datetime.datetime.now() + ir_translation = req.session.model('ir.translation') + translations_per_module = {} + messages = ir_translation.search_read([('module','in',mods),('lang','=',lang), + ('comments','like','openerp-web'),('value','!=',False), + ('value','!=','')], + ['module','src','value','lang'], order='module') + for mod, msg_group in itertools.groupby(messages, key=operator.itemgetter('module')): + translations_per_module.setdefault(mod,{'messages':[]}) + translations_per_module[mod]['messages'].extend({'id': m['src'], + 'string': m['value']} \ + for m in msg_group) + + print "Loaded translations in ", datetime.datetime.now()-start + import pprint + pprint.pprint(translations_per_module) + + return {"modules": translations_per_module, + "lang_parameters": lang_params} @openerpweb.jsonrequest def version_info(self, req): @@ -769,7 +780,7 @@ class Database(openerpweb.Controller): {'fileToken': int(token)} ) except xmlrpclib.Fault, e: - return simplejson.dumps([[],[{'error': e.faultCode, 'title': 'backup Database'}]]) + return simplejson.dumps([[],[{'error': e.faultCode, 'title': 'backup Database'}]]) @openerpweb.httprequest def restore(self, req, db_file, restore_pwd, new_db): diff --git a/addons/web/static/src/js/coresetup.js b/addons/web/static/src/js/coresetup.js index ea160d6faee..826275bfa0f 100644 --- a/addons/web/static/src/js/coresetup.js +++ b/addons/web/static/src/js/coresetup.js @@ -57,7 +57,12 @@ instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Sess if(self.session_is_valid()) { return deferred.pipe(function() { return self.load_modules(); }); } - return deferred; + return $.when( + deferred, + self.rpc('/web/webclient/bootstrap_translations', {mods: instance._modules}).pipe(function(trans) { + instance.web._t.database.set_bundle(trans); + }) + ); }); }, /** diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index b6b89a4f1ec..d1d028aa3f5 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -407,7 +407,7 @@
From 13dfee0de0fdca7edfc0eae157ebcb8904a6a8df Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Tue, 18 Sep 2012 15:51:11 +0200 Subject: [PATCH 09/45] [IMP] translations: keep only one method for loading translations bzr revid: odo@openerp.com-20120918135111-o6ylzs1n36kqkh4c --- addons/web/controllers/main.py | 41 ++++++++++------------------------ 1 file changed, 12 insertions(+), 29 deletions(-) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 35698d1085d..234d765d5c7 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -19,6 +19,7 @@ import zlib from xml.etree import ElementTree from cStringIO import StringIO +import babel.messages.pofile import werkzeug.utils import werkzeug.wrappers try: @@ -492,35 +493,17 @@ def parse_context(context, session): return common.nonliterals.Context(session, context) -# PO file parsing - only used to boostrap translations on the login page -try: - # Use the faster PO parser from OpenERP server when available - from openerp.tools.translate import TinyPoFile - def _local_web_translations(trans_file): - messages = [] - try: - with open(trans_file) as t_file: - po = TinyPoFile(t_file) - for _, _, _, source, value, comments in po: - if "openerp-web" in comments: - messages.append({'id': source, 'string': value}) - except Exception: - pass - return messages -except ImportError: - # Otherwise fallback to Babel's slightly slower PO parser - import babel.messages.pofile - def _local_web_translations(trans_file): - messages = [] - try: - with open(trans_file) as t_file: - po = babel.messages.pofile.read_po(t_file) - except Exception: - return - for x in po: - if x.id and x.string and "openerp-web" in x.auto_comments: - messages.append({'id': x.id, 'string': x.string}) - return messages +def _local_web_translations(trans_file): + messages = [] + try: + with open(trans_file) as t_file: + po = babel.messages.pofile.read_po(t_file) + except Exception: + return + for x in po: + if x.id and x.string and "openerp-web" in x.auto_comments: + messages.append({'id': x.id, 'string': x.string}) + return messages #---------------------------------------------------------- From f0a883e6d6b942fc54dea0db0bcb8f3f33170098 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Mon, 24 Sep 2012 12:26:13 +0200 Subject: [PATCH 10/45] [FIX] point_of_sale: Show the opening_control & closing_control bzr revid: stw@openerp.com-20120924102613-twii7ba34wctx6c6 --- addons/point_of_sale/point_of_sale_view.xml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/addons/point_of_sale/point_of_sale_view.xml b/addons/point_of_sale/point_of_sale_view.xml index 9c92145ed89..d88e1f73cc2 100644 --- a/addons/point_of_sale/point_of_sale_view.xml +++ b/addons/point_of_sale/point_of_sale_view.xml @@ -896,8 +896,11 @@ - + + + @@ -917,7 +920,7 @@ -
+
From 24a4e57171fd0ce371260370226f4c90607f390b Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Mon, 24 Sep 2012 13:53:20 +0200 Subject: [PATCH 11/45] [FIX] point_of_sale: show the opening cash control bzr revid: stw@openerp.com-20120924115320-nkbfhfnyab4bhxrc --- addons/point_of_sale/point_of_sale_view.xml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/addons/point_of_sale/point_of_sale_view.xml b/addons/point_of_sale/point_of_sale_view.xml index d88e1f73cc2..131909a1fd3 100644 --- a/addons/point_of_sale/point_of_sale_view.xml +++ b/addons/point_of_sale/point_of_sale_view.xml @@ -896,11 +896,7 @@ - - - + From 4f74d0aee15da72d386b03ba721b8ac67c4ea5a5 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Thu, 27 Sep 2012 14:19:54 +0200 Subject: [PATCH 12/45] [FIX] point_of_sale: show the cash_register_balance when we are in closing_control bzr revid: stw@openerp.com-20120927121954-1safkpgurh4nu9kc --- addons/point_of_sale/point_of_sale_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/point_of_sale/point_of_sale_view.xml b/addons/point_of_sale/point_of_sale_view.xml index c08695ee993..5b30ced93dd 100644 --- a/addons/point_of_sale/point_of_sale_view.xml +++ b/addons/point_of_sale/point_of_sale_view.xml @@ -934,7 +934,7 @@
- + From ff211c375a2bc589082d6dd05484fd01c2068d6e Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Thu, 27 Sep 2012 14:20:22 +0200 Subject: [PATCH 13/45] [FIX] point_of_sale: return the session id in the context for the call of the pos.ui bzr revid: stw@openerp.com-20120927122022-fy2gx1z1xtkk14xt --- addons/point_of_sale/point_of_sale.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index 590718b48f0..920e70b7b7d 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -439,10 +439,10 @@ class pos_session(osv.osv): context = {} if not ids: return {} - context.update({'session_id' : ids[0]}) + context.update({'active_id': ids[0]}) return { 'type' : 'ir.actions.client', - 'name' : 'Start Point Of Sale', + 'name' : _('Start Point Of Sale'), 'tag' : 'pos.ui', 'context' : context, } From f742d3b213e36df0e6b826fb3d0de610251db4fc Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Fri, 28 Sep 2012 23:00:07 +0200 Subject: [PATCH 14/45] [FIX] web: minor improvements to some translateable terms bzr revid: odo@openerp.com-20120928210007-ukf4u20rpwmugfwt --- addons/web/static/src/js/coresetup.js | 3 +-- addons/web/static/src/js/search.js | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/addons/web/static/src/js/coresetup.js b/addons/web/static/src/js/coresetup.js index 826275bfa0f..4a30a312b7a 100644 --- a/addons/web/static/src/js/coresetup.js +++ b/addons/web/static/src/js/coresetup.js @@ -605,8 +605,7 @@ var messages_by_seconds = function() { [120, _t("Don't leave yet,
it's still loading...")], [300, _t("You may not believe it,
but the application is actually loading...")], [420, _t("Take a minute to get a coffee,
because it's loading...")], - [600, _t("It's loading...
By the way, did you tried the kitten mode?")], - [3600, _t("Maybe you should consider pressing F5...")], + [3600, _t("Maybe you should consider reloading the application by pressing F5...")], ]; }; diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index 8e9a31922b8..cd3611366e4 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -1496,7 +1496,7 @@ instance.web.search.ManyToOneField = instance.web.search.CharField.extend({ if (value.length > 1) { // more than one search_default m2o id? Should we OR them? throw new Error( - _("M2O search fields do not currently handle multiple default values")); + _t("M2O search fields do not currently handle multiple default values")); } // there are many cases of {search_default_$m2ofield: [id]}, need // to handle this as if it were a single value. @@ -1581,7 +1581,7 @@ instance.web.search.CustomFilters = instance.web.search.Input.extend({ $filter.unbind('click').click(function () { self.view.query.reset([{ - category: _("Custom Filter"), + category: _t("Custom Filter"), icon: 'M', field: { get_context: function () { return filter.context; }, From 3bd0b43e8103193bb1461bbf1877eeaaf405a9f1 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Mon, 1 Oct 2012 11:52:54 +0200 Subject: [PATCH 15/45] [FIX] point_of_sale: We use a callback for the 'Validate & Open Session' button, because we want to open the PoS UI. [FIX] point_of_sale: Hide/Show the opening/closing cash control bzr revid: stw@openerp.com-20121001095254-bcteq9amp0eurn3g --- addons/point_of_sale/point_of_sale.py | 23 +++++++++++++++++++++ addons/point_of_sale/point_of_sale_view.xml | 13 ++++++------ 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index 920e70b7b7d..dfd0d73ad55 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -348,6 +348,29 @@ class pos_session(osv.osv): statement.unlink(context=context) return True + + def open_cb(self, cr, uid, ids, context=None): + """ + call the Point Of Sale interface and set the pos.session to 'opened' (in progress) + """ + if context is None: + context = dict() + + if isinstance(ids, (int, long)): + ids = [ids] + + this_record = self.browse(cr, uid, ids[0], context=context) + this_record._workflow_signal('open') + + context.update(active_id=this_record.id) + + return { + 'type' : 'ir.actions.client', + 'name' : _('Start Point Of Sale'), + 'tag' : 'pos.ui', + 'context' : context, + } + def wkf_action_open(self, cr, uid, ids, context=None): # second browse because we need to refetch the data from the DB for cash_register_id for record in self.browse(cr, uid, ids, context=context): diff --git a/addons/point_of_sale/point_of_sale_view.xml b/addons/point_of_sale/point_of_sale_view.xml index 5b30ced93dd..66b7e3b6eb5 100644 --- a/addons/point_of_sale/point_of_sale_view.xml +++ b/addons/point_of_sale/point_of_sale_view.xml @@ -862,7 +862,7 @@
-
+
From 49956d869e5c360b936a0dc0e63e89ffe3b8ef6b Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Wed, 3 Oct 2012 00:02:58 +0200 Subject: [PATCH 18/45] restore monodb mode, disabled until we split translation/code loading bzr revid: al@openerp.com-20121002220258-51w0lm0cn12l74p5 --- addons/web/controllers/main.py | 41 ++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 14b8d4391c2..5ef7f3013e8 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -203,8 +203,49 @@ def module_installed(req): sorted_modules = module_topological_sort(modules) return sorted_modules +def module_installed_bypass_session(dbname): + loadable = openerpweb.addons_manifest.keys() + modules = {} + try: + import openerp.modules.registry + registry = openerp.modules.registry.RegistryManager.get(dbname) + with registry.cursor() as cr: + m = registry.get('ir.module.module') + # TODO The following code should move to ir.module.module.list_installed_modules() + domain = [('state','=','installed'), ('name','in', loadable)] + ids = m.search(cr, 1, [('state','=','installed'), ('name','in', loadable)]) + for module in m.read(cr, 1, ids, ['name', 'dependencies_id']): + modules[module['name']] = [] + deps = module.get('dependencies_id') + if deps: + deps_read = registry.get('ir.module.module.dependency').read(cr, 1, deps, ['name']) + dependencies = [i['name'] for i in deps_read] + modules[module['name']] = dependencies + except Exception,e: + pass + sorted_modules = module_topological_sort(modules) + return sorted_modules + def module_boot(req): return [m for m in req.config.server_wide_modules if m in openerpweb.addons_manifest] + # TODO the following will be enabled once we separate the module code and translation loading + serverside = [] + dbside = [] + for i in req.config.server_wide_modules: + if i in openerpweb.addons_manifest: + serverside.append(i) + # if only one db load every module at boot + dbs = [] + try: + dbs = db_list(req) + except xmlrpclib.Fault: + # ignore access denied + pass + if len(dbs) == 1: + dbside = module_installed_bypass_session(dbs[0]) + dbside = [i for i in dbside if i not in serverside] + addons = serverside + dbside + return addons def concat_xml(file_list): """Concatenate xml files From c28a29c44c638504f201a90107c7cc189c2ffda4 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Wed, 3 Oct 2012 09:28:45 +0200 Subject: [PATCH 19/45] [IMP]mail: expandable py bzr revid: chm@openerp.com-20121003072845-64bufx2dj3qdpjm2 --- addons/mail/mail_message.py | 167 +++++++++++---------------------- addons/mail/tests/test_mail.py | 42 --------- 2 files changed, 55 insertions(+), 154 deletions(-) diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py index bbf68509277..ff91a771cde 100644 --- a/addons/mail/mail_message.py +++ b/addons/mail/mail_message.py @@ -221,70 +221,64 @@ class mail_message(osv.Model): 'unread': msg.unread and msg.unread['unread'] or False } - def message_read_tree_get_expandable(self, cr, uid, parent_message, last_message, domain=[], current_level=0, level=0, context=None): - """ . """ - base_domain = [('id', '<', last_message['id'])] - if parent_message and current_level < level: - base_domain += [('parent_id', '=', parent_message['id'])] - elif parent_message: - base_domain += [('id', 'child_of', parent_message['id']), ('id', '!=', parent_message['id'])] - if domain: - base_domain += domain - extension = { 'type': 'expandable', - 'domain': base_domain, - 'thread_level': current_level, - 'context': context, - 'id': -1, - } - return extension - - def message_read_tree_flatten(self, cr, uid, parent_message, messages, domain=[], level=0, current_level=0, context=None, limit=None, add_expandable=True): - """ Given a tree with several roots of following structure : - [ {'id': 1, 'child_ids': [ - {'id': 11, 'child_ids': [...] },], - {...} ] - Flatten it to have a maximum number of levels, 0 being flat and - sort messages in a level according to a key of the messages. - Perform the flattening at leafs if above the maximum depth, then get - back in the tree. - :param context: ``sort_key``: key for sorting (id by default) - :param context: ``sort_reverse``: reverser order for sorting (True by default) + def message_read_expandable(self, cr, uid, tree, result, message_loaded, domain, context, parent_id, limit): + """ + create the expandable message for all parent message read """ - def _flatten(msg_dict): - """ from {'id': x, 'child_ids': [{child1}, {child2}]} - get [{'id': x, 'child_ids': []}, {child1}, {child2}] - """ - child_ids = msg_dict.pop('child_ids', []) - msg_dict['child_ids'] = [] - return [msg_dict] + child_ids - context = context or {} - limit = limit or self._message_read_limit + tree_not = [] + # expandable for not show message + for id_msg in tree: + # get all childs + not_loaded_ids = self.search(cr, SUPERUSER_ID, [['parent_id','=',id_msg],['id','not in',message_loaded]], None, limit=1000) + # group childs not read + id_min=None + id_max=None + nb=0 + for not_loaded_id in not_loaded_ids: + if not_loaded_id not in tree: + nb+=1 + if id_min==None or id_min>not_loaded_id: + id_min=not_loaded_id + if id_max==None or id_max0: + result.append({ + 'domain': [['id','>=',id_min],['id','<=',id_max],['parent_id','=',id_msg]], + 'nb_messages': nb, + 'type': 'expandable', + 'parent_id': id_msg, + 'id': id_min + }) + nb=0 + if nb>0: + result.append({ + 'domain': [['id','>=',id_min],['parent_id','=',id_msg]], + 'nb_messages': nb, + 'type': 'expandable', + 'parent_id': id_msg, + 'id': id_min + }) - # Depth-first flattening - for message in messages: - if message.get('type') == 'expandable': - continue - message['child_ids'] = self.message_read_tree_flatten(cr, uid, message, message['child_ids'], domain, level, current_level + 1, context=context, limit=limit) - for child in message['child_ids']: - if child.get('type') == 'expandable': - continue - message['child_nbr'] += child['child_nbr'] - # Flatten if above maximum depth - if current_level < level: - return_list = messages - else: - return_list = [flat_message for message in messages for flat_message in _flatten(message)] - # Add expandable - return_list = sorted(return_list, key=itemgetter(context.get('sort_key', 'id')), reverse=context.get('sort_reverse', True)) - if return_list and current_level == 0 and add_expandable: - expandable = self.message_read_tree_get_expandable(cr, uid, parent_message, return_list and return_list[-1] or parent_message, domain, current_level, level, context=context) - return_list.append(expandable) - elif return_list and current_level <= level and add_expandable: - expandable = self.message_read_tree_get_expandable(cr, uid, parent_message, return_list and return_list[-1] or parent_message, domain, current_level, level, context=context) - return_list.append(expandable) - return return_list + # expandable for limit max + ids = self.search(cr, SUPERUSER_ID, domain+[['id','not in',message_loaded+tree+tree_not]], context=context, limit=1) + if len(ids) > 0: + result.append( + { + 'domain': domain, + 'nb_messages': 0, + 'type': 'expandable', + 'parent_id': parent_id, + 'id': -1 + }); + + + result = sorted(result, key=lambda k: k['id']) + + return result def message_read(self, cr, uid, ids=False, domain=[], level=0, context=None, parent_id=False, limit=None): """ Read messages from mail.message, and get back a structured tree @@ -341,58 +335,7 @@ class mail_message(osv.Model): result = sorted(result, key=lambda k: k['id']) - - tree_not = [] - # expandable for not show message - for id_msg in tree: - # get all childs - not_loaded_ids = self.search(cr, SUPERUSER_ID, [['parent_id','=',id_msg],['id','not in',message_loaded]], None, limit=1000) - # group childs not read - id_min=None - id_max=None - nb=0 - for not_loaded_id in not_loaded_ids: - if not_loaded_id not in tree: - nb+=1 - if id_min==None or id_min>not_loaded_id: - id_min=not_loaded_id - if id_max==None or id_max0: - result.append({ - 'domain': [['id','>=',id_min],['id','<=',id_max],['parent_id','=',id_msg]], - 'nb_messages': nb, - 'type': 'expandable', - 'parent_id': id_msg, - 'id': id_min - }) - nb=0 - if nb>0: - result.append({ - 'domain': [['id','>=',id_min],['parent_id','=',id_msg]], - 'nb_messages': nb, - 'type': 'expandable', - 'parent_id': id_msg, - 'id': id_min - }) - - - # expandable for limit max - ids = self.search(cr, SUPERUSER_ID, domain+[['id','not in',message_loaded+tree+tree_not]], context=context, limit=1) - if len(ids) > 0: - result.append( - { - 'domain': domain, - 'nb_messages': 0, - 'type': 'expandable', - 'parent_id': parent_id, - 'id': -1 - }); - - - result = sorted(result, key=lambda k: k['id']) + result = self.message_read_expandable(cr, uid, tree, result, message_loaded, domain, context, parent_id, limit) return result diff --git a/addons/mail/tests/test_mail.py b/addons/mail/tests/test_mail.py index 7ec37d952bc..1485c40570b 100644 --- a/addons/mail/tests/test_mail.py +++ b/addons/mail/tests/test_mail.py @@ -550,48 +550,6 @@ class test_mail(TestMailMockups): # _compare_structures(struct1[x]['child_ids'], struct2[x]['child_ids'], n + 1) # # print '%send compare' % ('\t' * n) - # # ---------------------------------------- - # # CASE1: Flattening test - # # ---------------------------------------- - - # # Create dummy message structure - # import copy - # tree = [{'id': 2, 'child_nbr': 1, 'child_ids': [ - # {'id': 6, 'child_nbr': 1, 'child_ids': [ - # {'id': 8, 'child_nbr': 0, 'child_ids': []}, - # ]}, - # ]}, - # {'id': 1, 'child_nbr': 3, 'child_ids':[ - # {'id': 7, 'child_nbr': 1, 'child_ids': [ - # {'id': 9, 'child_nbr': 0, 'child_ids': []}, - # ]}, - # {'id': 4, 'child_nbr': 2, 'child_ids': [ - # {'id': 10, 'child_nbr': 0, 'child_ids': []}, - # {'id': 5, 'child_nbr': 0, 'child_ids': []}, - # ]}, - # {'id': 3, 'child_nbr': 0, 'child_ids': []}, - # ]}, - # ] - # # Test: completely flat - # new_tree = self.mail_message.message_read_tree_flatten(cr, uid, None, copy.deepcopy(tree), [('type', 'in', 'borderlands')], 0, limit=15, add_expandable=False) - # _compare_structures(new_tree, new_tree) - # self.assertEqual(len(new_tree), 10, 'message_read_tree_flatten wrong in flat') - # # Test: 1 thread level - # tree_test = [{'id': 2, 'child_ids': [ - # {'id': 8, 'child_ids': []}, {'id': 6, 'child_ids': []}, - # ]}, - # {'id': 1, 'child_ids': [ - # {'id': 10, 'child_ids': []}, {'id': 9, 'child_ids': []}, - # {'id': 7, 'child_ids': []}, {'id': 5, 'child_ids': []}, - # {'id': 4, 'child_ids': []}, {'id': 3, 'child_ids': []}, - # ]}, - # ] - # new_tree = self.mail_message.message_read_tree_flatten(cr, uid, None, copy.deepcopy(tree), [('type', 'in', 'borderlands')], 1, limit=15, add_expandable=False) - # _compare_structures(new_tree, tree_test) - # # Test: 2 thread levels - # new_tree = self.mail_message.message_read_tree_flatten(cr, uid, None, copy.deepcopy(tree), [('type', 'in', 'borderlands')], 2, limit=15, add_expandable=False) - # _compare_structures(new_tree, tree) - # # ---------------------------------------- # # CASE2: message_read test # # ---------------------------------------- From 775f0d32de0b905c0cf0a83fe0c52a757a13d14f Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Wed, 3 Oct 2012 10:40:29 +0200 Subject: [PATCH 20/45] [IMP]mail: domain/search bzr revid: chm@openerp.com-20121003084029-jc184upr1i1bmk4l --- addons/mail/mail_message.py | 6 ++++-- addons/mail/static/src/js/mail.js | 22 +++++++++------------- addons/mail/static/src/xml/mail.xml | 4 ++-- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py index ff91a771cde..e589d8b56cb 100644 --- a/addons/mail/mail_message.py +++ b/addons/mail/mail_message.py @@ -224,6 +224,7 @@ class mail_message(osv.Model): def message_read_expandable(self, cr, uid, tree, result, message_loaded, domain, context, parent_id, limit): """ create the expandable message for all parent message read + this function is used by message_read """ tree_not = [] @@ -252,10 +253,12 @@ class mail_message(osv.Model): 'parent_id': id_msg, 'id': id_min }) + id_min=None + id_max=None nb=0 if nb>0: result.append({ - 'domain': [['id','>=',id_min],['parent_id','=',id_msg]], + 'domain': [['id','>=',id_min],['id','<=',id_max],['parent_id','=',id_msg]], 'nb_messages': nb, 'type': 'expandable', 'parent_id': id_msg, @@ -294,7 +297,6 @@ class mail_message(osv.Model): further parents :return list: list of trees of messages """ - message_loaded = context and context.get('message_loaded') or [0] # don't read the message display by .js, in context message_loaded list diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index e0c9ac9b7fc..462e4e2ecb8 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -256,10 +256,10 @@ openerp.mail = function(session) { default_res_id: 0, default_parent_id: false }, options.context || {}); - this.id = -1; + this.id = options.parameters.id || -1; this.parent_id= options.parameters.parent_id || false; this.nb_messages = options.parameters.nb_messages || 0; - this.type = options.parameters.type || false; + this.type = 'expandable'; // record options and data this.parent_thread= parent.messages!= undefined ? parent : options.options.thread._parents[0] ; @@ -501,9 +501,6 @@ openerp.mail = function(session) { } else { self.destroy(); } - for(var i in this.thread.messages){ - this.thread.messages[i].animated_destroy({fadeTime:0}); - } }, on_message_delete: function (event) { @@ -598,8 +595,8 @@ openerp.mail = function(session) { display_vote: function () { var self = this; var vote_element = session.web.qweb.render('mail.thread.message.vote', {'widget': self}); - self.$(".placeholder-mail-vote").empty(); - self.$(".placeholder-mail-vote").html(vote_element); + self.$(".placeholder-mail-vote:first").empty(); + self.$(".placeholder-mail-vote:first").html(vote_element); }, }); @@ -879,7 +876,7 @@ openerp.mail = function(session) { fetch_domain = replace_domain ? replace_domain : this.domain; fetch_context = replace_context ? replace_context : this.context; fetch_context.message_loaded= [this.id||0].concat( self.options.thread._parents[0].get_child_ids() ); - + return this.ds_message.call('message_read', [ids, fetch_domain, (this.options.thread.thread_level+1), fetch_context, this.context.default_parent_id || undefined] ).then(this.proxy('switch_new_message')); }, @@ -945,11 +942,11 @@ openerp.mail = function(session) { } } - if(parent_newer) - message.insertAfter(parent_newer.$el); - else if(parent_older) + if(parent_older) message.insertBefore(parent_older.$el); - else + else if(parent_newer) + message.insertAfter(parent_newer.$el); + else message.prependTo(thread.list_ul); return message @@ -1139,7 +1136,6 @@ openerp.mail = function(session) { message_render: function (search) { var domain = this.options.domain.concat(this.search_results['domain']); - var domain = _.extend(this.options.domain, search&&search.domain? search.domain : {}); var context = _.extend(this.options.context, search&&search.context ? search.context : {}); this.thread = new mail.Thread(this, { diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index 07c9b406cdc..e04a72ae664 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -104,7 +104,7 @@
-
  • +
    • @@ -171,7 +171,7 @@ -
    • +
    • Load more messages ( messages not display)... From d653b76e5d4d84e437cc4dc3e23e6eb4645009db Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Wed, 3 Oct 2012 10:51:10 +0200 Subject: [PATCH 21/45] [FIX] mail thread follower: follow/unfollow bzr revid: chm@openerp.com-20121003085110-du30higfqr9x0n26 --- addons/mail/static/src/js/mail_followers.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 953b8cd9fc8..ab6a63ea6fa 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -149,7 +149,6 @@ openerp_mail_followers = function(session, mail) { var self = this; var node_user_list = this.$('ul.oe_mail_followers_display').empty(); this.$('div.oe_mail_recthread_followers h4').html(this.options.title + (records.length>=5 ? ' (' + records.length + ')' : '') ); - console.log(records); for(var i=0; i Date: Wed, 3 Oct 2012 11:19:37 +0200 Subject: [PATCH 22/45] [FIX] doc: use relative path for image::, doc root is different on our doc builder bzr revid: odo@openerp.com-20121003091937-vse9xdptdgdtoblf --- doc/templates.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/templates.rst b/doc/templates.rst index 3977682399a..3f7a3a18743 100644 --- a/doc/templates.rst +++ b/doc/templates.rst @@ -40,6 +40,6 @@ This block demonstrates a common pattern in OpenERP views and widgets: a highlighted button, and a discard button styled as a link to cancel the action: -.. image:: /images/templates/ui.Header.* +.. image:: ./images/templates/ui.Header.* In this case, both buttons are OpenERP action buttons. From 40f04361c047801bf1723dbd1910e19bf65b3ece Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Wed, 3 Oct 2012 12:09:52 +0200 Subject: [PATCH 23/45] fixes bzr revid: chm@openerp.com-20121003100952-e5v8ncgshra3uitc --- addons/mail/mail_message.py | 6 ++++-- addons/mail/mail_message_view.xml | 9 ++++++++- addons/mail/mail_thread_view.xml | 10 ++++++++-- addons/mail/static/src/js/mail.js | 9 +++------ addons/mail/static/src/js/mail_followers.js | 5 ++--- addons/mail/static/src/xml/mail.xml | 5 ++--- 6 files changed, 27 insertions(+), 17 deletions(-) diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py index e589d8b56cb..26d85aa68e9 100644 --- a/addons/mail/mail_message.py +++ b/addons/mail/mail_message.py @@ -134,6 +134,7 @@ class mail_message(osv.Model): 'subtype_id': fields.many2one('mail.message.subtype', 'Subtype'), 'vote_user_ids': fields.many2many('res.users', 'mail_vote', 'message_id', 'user_id', string='Votes', help='Users that voted for this message'), + 'is_private': fields.boolean('Private message'), } def _needaction_domain_get(self, cr, uid, context=None): @@ -150,6 +151,7 @@ class mail_message(osv.Model): 'date': lambda *a: fields.datetime.now(), 'author_id': lambda self, cr, uid, ctx={}: self._get_default_author(cr, uid, ctx), 'body': '', + 'is_private': False, } #------------------------------------------------------ @@ -221,7 +223,7 @@ class mail_message(osv.Model): 'unread': msg.unread and msg.unread['unread'] or False } - def message_read_expandable(self, cr, uid, tree, result, message_loaded, domain, context, parent_id, limit): + def _message_read_expandable(self, cr, uid, tree, result, message_loaded, domain, context, parent_id, limit): """ create the expandable message for all parent message read this function is used by message_read @@ -337,7 +339,7 @@ class mail_message(osv.Model): result = sorted(result, key=lambda k: k['id']) - result = self.message_read_expandable(cr, uid, tree, result, message_loaded, domain, context, parent_id, limit) + result = self._message_read_expandable(cr, uid, tree, result, message_loaded, domain, context, parent_id, limit) return result diff --git a/addons/mail/mail_message_view.xml b/addons/mail/mail_message_view.xml index cc0419352af..fd0192d4496 100644 --- a/addons/mail/mail_message_view.xml +++ b/addons/mail/mail_message_view.xml @@ -87,7 +87,14 @@ Inbox mail.wall - + + + + Wall + mail.wall + diff --git a/addons/mail/mail_thread_view.xml b/addons/mail/mail_thread_view.xml index 3507e7c449f..f607238276b 100644 --- a/addons/mail/mail_thread_view.xml +++ b/addons/mail/mail_thread_view.xml @@ -18,15 +18,21 @@ + + Wall + + + + Archives - + Sent - + diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 462e4e2ecb8..fbfe74768fd 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -1134,13 +1134,10 @@ openerp.mail = function(session) { /** Clean and display the threads */ message_render: function (search) { - var domain = this.options.domain.concat(this.search_results['domain']); - - var context = _.extend(this.options.context, search&&search.context ? search.context : {}); - + //console this.thread = new mail.Thread(this, { - 'domain' : domain, - 'context' : context, + 'domain' : this.options.domain.concat(this.search_results['domain']), + 'context' : _.extend(this.options.context, this.search_results&&this.search_results['context'] ? this.search_results['context'] : {}), 'options': { 'thread' :{ 'thread_level': this.options.thread_level, diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 953b8cd9fc8..ab6a63ea6fa 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -149,7 +149,6 @@ openerp_mail_followers = function(session, mail) { var self = this; var node_user_list = this.$('ul.oe_mail_followers_display').empty(); this.$('div.oe_mail_recthread_followers h4').html(this.options.title + (records.length>=5 ? ' (' + records.length + ')' : '') ); - console.log(records); for(var i=0; i
    • W
    • h
    • -
    • )
    • -
    • )
    • +
    • )
    • @@ -124,7 +123,7 @@ Hide '' for this document
    • -->
    • Full reply
    • -
    • Full reply
    • +
    • Full reply by mail
    • Details
    From a83724caae1e968268e330ca8b2051763056b7e4 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 3 Oct 2012 12:29:55 +0200 Subject: [PATCH 24/45] [REM] weird al stuff nobody understands not even him bzr revid: xmo@openerp.com-20121003102955-rkqo31dmb575bvf1 --- addons/web/static/src/js/views.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 9e7db823bc0..9d12faf608f 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -307,15 +307,6 @@ instance.web.ActionManager = instance.web.Widget.extend({ } }, ir_actions_act_window: function (action, on_close, clear_breadcrumbs) { - var self = this; - if (action.target !== 'new') { - if(action.menu_id) { - this.dialog_stop(); - return this.getParent().do_action(action, function () { - instance.webclient.menu.open_menu(action.menu_id); - }, clear_breadcrumbs); - } - } return this.ir_actions_common(action, on_close, clear_breadcrumbs); }, ir_actions_client: function (action, on_close, clear_breadcrumbs) { From 96e26073e5a6efd14086e1c7f1236b8c20f85635 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 3 Oct 2012 12:35:44 +0200 Subject: [PATCH 25/45] [REM] weird al stuff nobody understands again bzr revid: xmo@openerp.com-20121003103544-wjhkyjjcasu5n6i6 --- addons/web/static/src/js/chrome.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 014313d5428..3fe5e9c952c 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -1137,15 +1137,6 @@ instance.web.WebClient = instance.web.Client.extend({ }); }); }, - do_action: function(action) { - var self = this; - // TODO replace by client action menuclick - if(action.menu_id) { - this.do_reload().then(function () { - self.menu.menu_click(action.menu_id); - }); - } - }, set_content_full_screen: function(fullscreen) { if (fullscreen) { $(".oe_webclient", this.$el).addClass("oe_content_full_screen"); From b0d1ba9c005be1a24c54191766f26ca2d3726798 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 3 Oct 2012 13:01:12 +0200 Subject: [PATCH 26/45] [IMP] split code specific to resp. client and window action out of action_common there's little reason to have this absolutely-non-common code shoved into common. And it makes common less specific to boot. So pass that stuff in from the caller, which is the actual action handler. bzr revid: xmo@openerp.com-20121003110112-y57quir59xj838ju --- addons/web/static/src/js/views.js | 100 +++++++++++++++++------------- 1 file changed, 58 insertions(+), 42 deletions(-) diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 9d12faf608f..715da126f0d 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -255,20 +255,69 @@ instance.web.ActionManager = instance.web.Widget.extend({ this.dialog_stop(); this.clear_breadcrumbs(); }, - ir_actions_common: function(action, on_close, clear_breadcrumbs) { - var self = this, klass, widget, post_process; - if (this.inner_widget && (action.type === 'ir.actions.client' || action.target !== 'new')) { + /** + * + * @param {Object} executor + * @param {Object} executor.action original action + * @param {Function} executor.widget function used to fetch the widget instance + * @param {String} executor.klass CSS class to add on the dialog root, if action.target=new + * @param {Function} executor.post_process cleanup called after a widget has been added as inner_widget + * @param on_close + * @param clear_breadcrumbs + * @return {*} + */ + ir_actions_common: function(executor, on_close, clear_breadcrumbs) { + if (this.inner_widget && executor.action.target !== 'new') { if (this.getParent().has_uncommitted_changes()) { return $.Deferred().reject(); } else if (clear_breadcrumbs) { this.clear_breadcrumbs(); } } - if (action.type === 'ir.actions.client') { - var ClientWidget = instance.web.client_actions.get_object(action.tag); - widget = new ClientWidget(this, action.params); - klass = 'oe_act_client'; - post_process = function() { + var widget = executor.widget(); + if (executor.action.target === 'new') { + if (this.dialog === null) { + // These buttons will be overwrited by