Ver Fonte

Improved code as per Travis

Krunal Soni há 9 anos atrás
pai
commit
4b9f6dedec

+ 13 - 10
mass_editing/models/mass_editing.py

@@ -52,18 +52,21 @@ class MassObject(models.Model):
 
     name = fields.Char(string="Name", required=True, select=1)
     model_id = fields.Many2one('ir.model', string='Model', required=True,
-                    help="Model is used for Selecting Fields,"
-                    " This is editable until Sidebar menu is not created")
+                               help="Model is used for Selecting Fields."
+                               "This is editable until Sidebar menu is not"
+                               " created")
     field_ids = fields.Many2many('ir.model.fields', 'mass_field_rel',
                                  'mass_id', 'field_id', string='Fields')
     ref_ir_act_window = fields.Many2one('ir.actions.act_window',
-                        string='Sidebar action',
-                        readonly=True,
-                        help="Sidebar action to make this template available"
-                             "on records of the related document model")
+                                        string='Sidebar action',
+                                        readonly=True,
+                                        help="Sidebar action to make this "
+                                            "template available on records of"
+                                            "the related document model")
     ref_ir_value = fields.Many2one('ir.values', string='Sidebar button',
-                        readonly=True,
-                        help="Sidebar button to open the sidebar action")
+                                   readonly=True,
+                                   help="Sidebar button to open"
+                                        "the sidebar action")
 
     model_list = fields.Char(string='Model List', size=256)
 
@@ -83,8 +86,8 @@ class MassObject(models.Model):
                 for key, val in active_model_obj._inherits.items():
                     inherits_model_list = model_obj.search(
                                             [('model', '=', key)])
-                    model_list.extend(inherits_model_list and \
-                                      inherits_model_list.ids or [])
+                    model_list.extend((inherits_model_list and \
+                                       inherits_model_list.ids or []))
         self.model_list = model_list
 
     @api.multi

+ 23 - 23
mass_editing/wizard/mass_editing_wizard.py

@@ -96,9 +96,9 @@ class mass_editing_wizard(models.Model):
                                       'name': field.name,
                                       'colspan': '6',
                                       'nolabel': '1',
-                                      'attrs': "{'invisible':[('selection__" \
-                                               + field.name + \
-                                               "','=','remove_m2m')]}"
+                                      'attrs': ("{'invisible':[('selection__" \
+                                                + field.name + \
+                                                "','=','remove_m2m')]}")
                                       }
                                      )
                 elif field.ttype == "one2many":
@@ -125,9 +125,9 @@ class mass_editing_wizard(models.Model):
                                        'name': field.name,
                                        'colspan': '6',
                                        'nolabel': '1',
-                                       'attrs': "{'invisible':[('selection__" \
-                                                + field.name + \
-                                                "','=','remove_o2m')]}"
+                                       'attrs': ("{'invisible':[('selection__"\
+                                                 + field.name + \
+                                                 "','=','remove_o2m')]}")
                                         }
                                     )
                 elif field.ttype == "many2one":
@@ -155,9 +155,9 @@ class mass_editing_wizard(models.Model):
                                        'name': field.name,
                                        'nolabel': '1',
                                        'colspan': '4',
-                                       'attrs': "{'invisible':[('selection__" \
-                                                + field.name + \
-                                                "','=','remove')]}"
+                                       'attrs': ("{'invisible':[('selection__"\
+                                                 + field.name + \
+                                                 "','=','remove')]}")
                                        }
                                      )
                 elif field.ttype == "char":
@@ -182,9 +182,9 @@ class mass_editing_wizard(models.Model):
                     etree.SubElement(xml_group, 'field', {
                                        'name': field.name,
                                        'nolabel': '1',
-                                       'attrs': "{'invisible':[('selection__" \
+                                       'attrs': ("{'invisible':[('selection__"\
                                                  + field.name + \
-                                                 "','=','remove')]}",
+                                                 "','=','remove')]}"),
                                        'colspan': '4'
                                        }
                                      )
@@ -206,9 +206,9 @@ class mass_editing_wizard(models.Model):
                                        'name': field.name,
                                        'nolabel': '1',
                                        'colspan': '4',
-                                       'attrs': "{'invisible':[('selection__" \
-                                                + field.name + \
-                                                "','=','remove')]}"
+                                       'attrs': ("{'invisible':[('selection__"\
+                                                 + field.name + \
+                                                 "','=','remove')]}")
                                             }
                                      )
                     all_fields[field.name] = {
@@ -250,9 +250,9 @@ class mass_editing_wizard(models.Model):
                                       'name': field.name,
                                       'colspan': '6',
                                       'nolabel': '1',
-                                      'attrs': "{'invisible':[('selection__" \
-                                              + field.name + \
-                                              "','=','remove')]}"
+                                      'attrs': ("{'invisible':[('selection__" \
+                                                + field.name + \
+                                                "','=','remove')]}")
                                       }
                                 )
                     else:
@@ -272,9 +272,9 @@ class mass_editing_wizard(models.Model):
                         etree.SubElement(xml_group, 'field', {
                                     'name': field.name,
                                     'nolabel': '1',
-                                    'attrs': "{'invisible':[('selection__" \
-                                            + field.name + \
-                                            "','=','remove')]}",
+                                    'attrs': ("{'invisible':[('selection__" \
+                                              + field.name + \
+                                              "','=','remove')]}"),
                                     'colspan': '4',
                                     }
                              )
@@ -305,8 +305,8 @@ class mass_editing_wizard(models.Model):
 
     @api.model
     def create(self, vals):
-        if self._context.get('active_model') \
-            and self._context.get('active_ids'):
+        if (self._context.get('active_model') \
+            and self._context.get('active_ids')):
             model_obj = self.env[self._context.get('active_model')]
             values = {}
             for key, val in vals.items():
@@ -329,4 +329,4 @@ class mass_editing_wizard(models.Model):
 
     @api.v7
     def action_apply(self, cr, uid, ids, context=None):
-        return  {'type': 'ir.actions.act_window_close'}
+        return {'type': 'ir.actions.act_window_close'}