changeset 75402881aefc in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset;node=75402881aefc
description:
        Fallback to model name as title

        issue9596
        review300381002
diffstat:

 trytond/ir/model.py |  7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diffs (24 lines):

diff -r 8d1f0e31a1c6 -r 75402881aefc trytond/ir/model.py
--- a/trytond/ir/model.py       Thu Sep 24 23:05:04 2020 +0200
+++ b/trytond/ir/model.py       Sun Oct 04 00:35:23 2020 +0200
@@ -72,6 +72,7 @@
         cls.__rpc__.update({
                 'list_models': RPC(),
                 'list_history': RPC(),
+                'get_names': RPC(),
                 'global_search': RPC(),
                 })
 
@@ -143,6 +144,12 @@
             if getattr(model, '_history', False)]
 
     @classmethod
+    def get_names(cls):
+        "Return a dictionary mapping models to names"
+        models = cls.search([])
+        return {m.model: m.name for m in models}
+
+    @classmethod
     def global_search(cls, text, limit, menu='ir.ui.menu'):
         """
         Search on models for text including menu

Reply via email to