Browse Source

[FIX] flake8

pull/9/head
david.beal@akretion.com 10 years ago
parent
commit
07338ea732
  1. 6
      tree_view_record_id/__openerp__.py
  2. 7
      tree_view_record_id/orm.py

6
tree_view_record_id/__openerp__.py

@ -30,9 +30,11 @@
Adds Id field in all tree views of any modules/models, except:
* Arborescent tree views like 'Products by Category', 'Chart of accounts', etc.
* Tree views (like in wizard 'Change password') built on transient models which don't have this column in their table.
* Tree views (like in wizard 'Change password') built on transient models
which don't have this column in their table.
Id field is the primary key of standard sql tables defined by the orm (Odoo model).
Id field is the primary key of standard sql tables
defined by the orm (Odoo model).
""",
'website': 'http://www.akretion.com',
'depends': [

7
tree_view_record_id/orm.py

@ -36,8 +36,8 @@ class DummyModel(orm.Model):
fields_view_get_orginal = orm.BaseModel.fields_view_get
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None,
toolbar=False, submenu=False):
def fields_view_get(self, cr, uid, view_id=None, view_type='form',
context=None, toolbar=False, submenu=False):
res = fields_view_get_orginal(
self, cr, uid, view_id=view_id, view_type=view_type, context=context,
toolbar=toolbar, submenu=submenu)
@ -53,7 +53,8 @@ def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None,
compatible_tree = False
if compatible_tree and DUMMY_MODEL in self.pool.models.keys():
doc = etree.XML(res['arch'])
if doc.xpath("//tree") and len(doc.xpath("//field[@name='id']")) == 0:
if (doc.xpath("//tree") and
len(doc.xpath("//field[@name='id']"))) == 0:
node = doc.xpath("//tree")[0]
node.append(etree.Element("field", name="id", string="Id"))
res['arch'] = etree.tostring(node)

Loading…
Cancel
Save