odoo/doc/howtos/website/course-o2m

34 lines
1.0 KiB
Plaintext
Raw Normal View History

# HG changeset patch
# Parent c3619e60d819e746dcaae49a99d7ca1f4c58593c
diff -r c3619e60d819 -r 957395d27f63 academy/models.py
--- a/academy/models.py Wed Aug 13 14:29:45 2014 +0200
+++ b/academy/models.py Wed Aug 13 15:06:30 2014 +0200
@@ -7,6 +7,8 @@ class Teachers(models.Model):
name = fields.Char()
biography = fields.Html()
+ course_ids = fields.One2many('academy.courses', 'teacher_id', string="Courses")
+
class Courses(models.Model):
_name = 'academy.courses'
diff -r c3619e60d819 -r 957395d27f63 academy/views.xml
--- a/academy/views.xml Wed Aug 13 14:29:45 2014 +0200
+++ b/academy/views.xml Wed Aug 13 15:06:30 2014 +0200
@@ -11,8 +11,15 @@
<form>
<sheet>
<label for="name"/> <field name="name"/>
+
<label for="biography"/>
<field name="biography"/>
+
+ <field name="course_ids">
+ <tree string="Courses" editable="bottom">
+ <field name="name"/>
+ </tree>
+ </field>
</sheet>
</form>
</field>