Reviewers: nicoe, ced,


Please review this at http://codereview.tryton.org/414003/

Affected files:
  M trytond/model/modelsql.py
  M trytond/model/modelview.py


Index: trytond/model/modelsql.py
===================================================================
--- a/trytond/model/modelsql.py
+++ b/trytond/model/modelsql.py
@@ -41,6 +41,8 @@

         assert self._table[-9:] != '__history', \
                 'Model _table %s cannot end with "__history"' % self._table
+
+        self._rpc['get_history_tables'] = False

     def init(self, module_name):
         super(ModelSQL, self).init(module_name)
@@ -206,6 +208,14 @@
         for _, _, error in self._sql_constraints:
             res.append(error)
         return res
+
+    def get_history_tables(self, record_id):
+        cursor = Transaction().cursor
+        sql = 'SELECT write_date FROM ' + self._table + '__history WHERE \
+            (id = ' + str(record_id) + ' and write_uid = 1)'
+        cursor.execute(sql)
+        dates = cursor.fetchall()
+        return [value[0] for value in dates]

     def table_query(self):
         '''
Index: trytond/model/modelview.py
===================================================================
--- a/trytond/model/modelview.py
+++ b/trytond/model/modelview.py
@@ -143,6 +143,7 @@
             result['view_id'] = view_id
             result['arch'] = sql_res[0]
             result['field_childs'] = sql_res[1] or False
+            result['history'] = self._history and view_type == 'form'

             # Check if view is not from an inherited model
             if sql_res[5] != self._name:


--
[email protected] mailing list

Reply via email to