Commits

Jesús Martín (Zikzakmedia) committed 4bba36b

Added document field to subscription.history model

Comments (0)

Files changed (2)

     @staticmethod
     def default_state():
         return 'draft'
-#
+
     @classmethod
     def get_model(cls):
         cr = Transaction().cursor
     log = fields.Char('Result', readonly=True)
     subscription = fields.Many2One('subscription.subscription',
             'Subscription', ondelete='CASCADE', readonly=True)
-#    document = fields.Reference('Source Document', selection=[],
-#            readonly=True)
+    document = fields.Reference('Source Document', selection='get_model',
+            readonly=True)
 
     @staticmethod
     def default_date():
         return datetime.now()
 
+    @classmethod
+    def get_model(cls):
+        cr = Transaction().cursor
+        cr.execute('''\
+            SELECT
+                m.model,
+                m.name
+            FROM
+                ir_model m
+            ORDER BY
+                m.name
+        ''')
+        return cr.fetchall()
                         <field name="date"/>
                         <label name="subscription"/>
                         <field name="subscription"/>
+                        <newline/>
+                        <label name="document"/>
+                        <field name="document" colspan="3"/>
                         <label name="log"/>
                         <field name="log" colspan="3"/>
                     </form>