[IMP]: base : Improvements in base module
authorjas <jas@tinyerp.com>
Wed, 29 Sep 2010 07:58:01 +0000 (13:28 +0530)
committerjas <jas@tinyerp.com>
Wed, 29 Sep 2010 07:58:01 +0000 (13:28 +0530)
bzr revid: jas@tinyerp.com-20100929075801-l569rvj9tiq2ha9w

bin/addons/base/base_menu.xml
bin/addons/base/ir/ir_model.py
bin/addons/base/module/wizard/base_module_import_view.xml
bin/addons/base/module/wizard/base_module_update.py
bin/addons/base/module/wizard/base_module_update_view.xml
bin/addons/base/module/wizard/base_module_upgrade_view.xml
bin/addons/base/module/wizard/base_update_translations.py
bin/addons/base/res/res_config.xml
bin/addons/base/res/res_lang_view.xml
bin/addons/base/res/res_log.py
bin/addons/base/res/res_log_view.xml

index 5da9702..3049fbb 100644 (file)
         <menuitem id="menu_custom_action" name="Actions" parent="base.menu_custom" groups="base.group_extended" sequence="20"/>
         <menuitem id="menu_config" name="Configuration" parent="base.menu_administration" sequence="1"/>
         <menuitem id="menu_translation" name="Translations" parent="base.menu_administration" sequence="4"/>
-        <menuitem id="menu_translation_app" name="Application Terms" parent="base.menu_translation" sequence="4"/>
+        <menuitem id="menu_translation_app" name="Application Terms" parent="base.menu_translation" sequence="4" groups="base.group_extended"/>
         <menuitem id="menu_translation_export" name="Import / Export"
-            groups="base.group_extended"
-            parent="base.menu_translation" sequence="4"/>
+            groups="base.group_extended" parent="base.menu_translation" sequence="3"/>
         <menuitem id="menu_users" name="Users" parent="base.menu_administration" sequence="6"/>
         <menuitem id="menu_security" name="Security" parent="base.menu_administration" sequence="8"
             groups="base.group_extended"/>
-        <menuitem id="menu_management" name="Modules Management" parent="base.menu_administration" sequence="10"
+        <menuitem id="menu_management" name="Modules" parent="base.menu_administration" sequence="10"
             groups="base.group_extended"/>
         <menuitem icon="terp-graph" id="reporting_menu" name="Reporting" sequence="45"
             groups="group_extended"/>
index 69a9e29..27ccb92 100644 (file)
@@ -142,103 +142,6 @@ class ir_model(osv.osv):
         x_custom_model._rec_name = x_name
 ir_model()
 
-
-class ir_model_grid(osv.osv):
-    _name = 'ir.model.grid'
-    _table = 'ir_model'
-    _inherit = 'ir.model'
-    _description = "Objects Security Grid"
-
-    def create(self, cr, uid, vals, context=None):
-        raise osv.except_osv('Error !', 'You cannot add an entry to this view !')
-
-    def unlink(self, *args, **argv):
-        raise osv.except_osv('Error !', 'You cannot delete an entry of this view !')
-
-    def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'):
-        result = super(osv.osv, self).read(cr, uid, ids, fields, context, load)
-        allgr = self.pool.get('res.groups').search(cr, uid, [], context=context)
-        acc_obj = self.pool.get('ir.model.access')
-
-        if not isinstance(result,list):
-            result=[result]
-
-        for res in result:
-            rules = acc_obj.search(cr, uid, [('model_id', '=', res['id'])])
-            rules_br = acc_obj.browse(cr, uid, rules, context=context)
-            for g in allgr:
-                res['group_'+str(g)] = ''
-            for rule in rules_br:
-                perm_list = []
-                if rule.perm_read:
-                    perm_list.append('r')
-                if rule.perm_write:
-                    perm_list.append('w')
-                if rule.perm_create:
-                    perm_list.append('c')
-                if rule.perm_unlink:
-                    perm_list.append('u')
-                perms = ",".join(perm_list)
-                if rule.group_id:
-                    res['group_%d'%rule.group_id.id] = perms
-                else:
-                    res['group_0'] = perms
-        return result
-
-    #
-    # This function do not write fields from ir.model because
-    # access rights may be different for managing models and
-    # access rights
-    #
-    def write(self, cr, uid, ids, vals, context=None):
-        vals_new = vals.copy()
-        acc_obj = self.pool.get('ir.model.access')
-        for grid in self.browse(cr, uid, ids, context=context):
-            model_id = grid.id
-            perms_rel = ['read','write','create','unlink']
-            for val in vals:
-                if not val[:6]=='group_':
-                    continue
-                group_id = int(val[6:]) or False
-                rules = acc_obj.search(cr, uid, [('model_id', '=', model_id),('group_id', '=', group_id)])
-                if not rules:
-                    rules = [acc_obj.create(cr, uid, {
-                        'name': grid.name,
-                        'model_id':model_id,
-                        'group_id':group_id
-                    }) ]
-                vals2 = dict(map(lambda x: ('perm_'+x, x[0] in (vals[val] or '')), perms_rel))
-                acc_obj.write(cr, uid, rules, vals2, context=context)
-        return True
-
-    def fields_get(self, cr, uid, fields=None, context=None):
-        result = super(ir_model_grid, self).fields_get(cr, uid, fields, context)
-        groups = self.pool.get('res.groups').search(cr, uid, [])
-        groups_br = self.pool.get('res.groups').browse(cr, uid, groups)
-        result['group_0'] = {'string': 'All Users','type': 'char','size': 7}
-        for group in groups_br:
-            result['group_%d'%group.id] = {'string': '%s'%group.name,'type': 'char','size': 7}
-        return result
-
-    def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False, submenu=False):
-        result = super(ir_model_grid, self).fields_view_get(cr, uid, view_id, view_type, context=context, toolbar=toolbar, submenu=submenu)
-        groups = self.pool.get('res.groups').search(cr, uid, [])
-        groups_br = self.pool.get('res.groups').browse(cr, uid, groups)
-        cols = ['model', 'name']
-        xml = '''<?xml version="1.0"?>
-<%s editable="bottom">
-    <field name="name" select="1" readonly="1" required="1"/>
-    <field name="model" select="1" readonly="1" required="1"/>
-    <field name="group_0"/>
-    ''' % (view_type,)
-        for group in groups_br:
-            xml += '''<field name="group_%d"/>''' % (group.id, )
-        xml += '''</%s>''' % (view_type,)
-        result['arch'] = xml
-        result['fields'] = self.fields_get(cr, uid, cols, context)
-        return result
-ir_model_grid()
-
 class ir_model_fields(osv.osv):
     _name = 'ir.model.fields'
     _description = "Fields"
@@ -327,7 +230,7 @@ class ir_model_access(osv.osv):
         'perm_read': fields.boolean('Read Access'),
         'perm_write': fields.boolean('Write Access'),
         'perm_create': fields.boolean('Create Access'),
-        'perm_unlink': fields.boolean('Delete Permission'),
+        'perm_unlink': fields.boolean('Delete Access'),
     }
 
     def check_groups(self, cr, uid, group):
index 8cb9741..9d1aa1b 100644 (file)
@@ -7,7 +7,7 @@
             <field name="model">base.module.import</field>
             <field name="type">form</field>
             <field name="arch" type="xml">
-            <form string="Module import">
+            <form string="Import module">
             <separator string="Module Import" colspan="4"/>
             <label string="Please give your module .ZIP file to import." colspan="4"/>
             <field name="module_file"/>
index 29e897b..eea5f5a 100644 (file)
@@ -92,7 +92,7 @@ class base_module_update_open(osv.osv_memory):
         """
         res = {
             'domain': str([]),
-            'name': 'Module List',
+            'name': 'Modules',
             'view_type': 'form',
             'view_mode': 'tree,form',
             'res_model': 'ir.module.module',
index 0857600..9091b5a 100644 (file)
@@ -8,7 +8,7 @@
             <field name="type">form</field>
             <field name="arch" type="xml">
             <form string="Scan for new modules">
-            <label string="This function will check for new modules in the 'addons' path" colspan="4" align="0.0"/>
+           <label string="This wizard will scan all module repositories (on the server side) to detect any new or updated modules. Please be patient as this operation may take a few seconds..." colspan="4" align="0.0"/>
             <separator string="" colspan="4" />
             <newline/>
             <group colspan="6" >
index ce7d2e6..75e635b 100644 (file)
@@ -47,7 +47,7 @@
             <field name="model">base.module.upgrade</field>
             <field name="type">form</field>
             <field name="arch" type="xml">
-            <form string="System update done">
+            <form string="Apply Scheduled Upgrades">
             <separator string="System update completed" colspan="4"/>
             <label align="0.0" string="The selected modules have been updated / installed !" colspan="4"/>
             <label align="0.0" string="We suggest to reload the menu tab to see the new menus (Ctrl+T then Ctrl+R)." colspan="4"/>
index 7e61c0a..cc7a336 100644 (file)
@@ -50,6 +50,12 @@ class base_update_translations(osv.osv_memory):
         buf.close()
         return {'type': 'ir.actions.act_window_close'}
 
+    def default_get(self, cr, uid, fields, context=None):
+        lang_obj = self.pool.get('res.lang')
+        record_id = context and context.get('active_id', False) or False
+        lang=lang_obj.browse(cr,uid,record_id).code
+        return {'lang':lang}
+
     _name = 'base.update.translations'
     _columns = {
         'lang': fields.selection(_get_languages, 'Language', required=True),
index 5adbfb4..28bfa0d 100644 (file)
@@ -19,7 +19,7 @@
            </group>
          </group>
          <group colspan="8" col="8">
-           <separator string="" colspan="8"/>
+           <separator string="" colspan="6"/>
            <group colspan="4" width="220">
              <field name="progress" widget="progressbar" nolabel="1" colspan="2"/>
            </group>
index bf1e611..cbe5fb3 100644 (file)
             <field name="type">form</field>
             <field name="arch" type="xml">
                 <form string="Languages">
-                       <group col="4" colspan="4">
-                    <field name="name" colspan="4"/>
-                    <field name="code" />
-                    <field name="iso_code"/>
-                    <field name="active" />
-                    <field name="translatable"/>
-                    <field name="grouping" />
-                    <field name="direction" />
-                    <newline/>
-                    <field name="date_format"/>
-                    <field name="time_format"/>
-                    <field name="decimal_point"/>
-                    <field name="thousands_sep"/>
-                    <newline/>
-                    </group>
-                    <separator colspan="4" string="Legends for Date and Time Formats"/>
+                       <group col="6" colspan="4">
+                       <field name="name"/>
+                               <field name="code" />
+                       <field name="iso_code"/>
+                       <newline/>
+                       <field name="grouping" />
+                       <field name="date_format"/>
+                           <field name="time_format"/>
+                           <newline/>
+                                               <field name="direction" />
+                               <field name="decimal_point"/>
+                               <field name="thousands_sep"/>
+                               <newline/>
+                               <field name="active" />
+                           <field name="translatable"/>
+                           </group>
+                                       <separator colspan="4" string="Legends for Date and Time Formats"/>
                     <group col="4" colspan="4">
                             <label align="0.0" string="%%a - Abbreviated weekday name."/>
                             <label align="0.0" string="%%A - Full weekday name."/>
             <field name="type">search</field>
             <field name="arch" type="xml">
                 <search string="Languages">
-                                       <field name="name"/>
-                                       <field name="code"/>
-                                       <field name="iso_code"/>
-                                       <field name="direction"/>
+                        <group>
+                               <filter string="Translatable" icon="terp-tools" domain="[('translatable','=',True)]"/>
+                           <separator orientation="vertical"/>
+                                               <field name="name"/>
+                                               <field name="code"/>
+                                               <field name="iso_code"/>
+                                               <field name="direction"/>
+                                       </group>
                 </search>
             </field>
         </record>
             <field name="context">{'active_test': False}</field>
             <field name="search_view_id" ref="res_lang_search"/>
         </record>
-        <menuitem action="res_lang_act_window" id="menu_res_lang_act_window" parent="menu_translation"/>
+        <menuitem action="res_lang_act_window" id="menu_res_lang_act_window" parent="menu_translation" groups="base.group_extended" sequence="1"/>
     </data>
 </openerp>
index 886221a..97ee249 100644 (file)
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 ##############################################################################
-#    
+#
 #    OpenERP, Open Source Management Solution
 #    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
 #
@@ -20,7 +20,7 @@
 ##############################################################################
 
 from osv import fields, osv
-import tools 
+import tools
 
 class res_log(osv.osv_memory):
     _name = 'res.log'
@@ -29,7 +29,8 @@ class res_log(osv.osv_memory):
         'user_id': fields.many2one('res.users','User', required=True),
         'res_model': fields.char('Object', size=128),
         'res_id': fields.integer('Object ID'),
-        'secondary': fields.boolean('Secondary Log', help='Do not display this log if it belongs to the same object the user is working on')
+        'secondary': fields.boolean('Secondary Log', help='Do not display this log if it belongs to the same object the user is working on'),
+        'create_date': fields.datetime('Created Date', readonly=True),
     }
     _defaults = {
         'user_id': lambda self,cr,uid,ctx: uid
index 046d93f..2485783 100644 (file)
@@ -23,6 +23,7 @@
                 <tree string="Logs">
                     <field name="name"/>
                     <field name="user_id"/>
+                    <field name="create_date"/>
                 </tree>
             </field>
         </record>
             <field name="type">form</field>
             <field name="arch" type="xml">
                 <form string="Logs">
-                    <group colspan="4" col="6">
-                        <field name="name" colspan="4"/>
+                 <field name="name" colspan="3"/>
+                 <newline/>
+                    <group colspan="4" col="8">
                         <field name="user_id" />
                         <field name="res_model"/>
                         <field name="res_id"/>
+                        <field name="create_date" colspan="1"/>
                     </group>
                 </form>
             </field>