【发布时间】:2022-09-28 02:02:39
【问题描述】:
我在使用 xml 笔记本时遇到了一些问题。我想显示保护区的所有信息,而不仅仅是它们的标签。这就是它现在的样子
我希望在第一个视图中显示字段 \"Name\"、\"Room Category\" 等。
这是我想要的结果
这就是我实际拥有代码的方式。
<page name=\"reservation_line\" string=\'Reservation Line\'>
<field name=\"reservation_line\" colspan=\"4\" nolabel=\"1\">
<form string=\"Reservation Line\">
<separator string=\"Room Type\"/>
<field name=\"name\" invisible=\"1\"/>
<field name=\"categ_id\" colspan=\"4\" nolabel=\"1\"/>
<newline/>
<separator string=\"Select Room\"/>
<field
name=\"reserve\"
colspan=\"4\"
string=\"Room Number\"
nolabel=\"1\"
/>
</form>
<tree>
<field
name=\"reserve\"
string=\"Rooms\"
widget=\"many2many_tags\"
/>
</tree>
</field>
</page>
<page name=\"history\" string=\'History\'>
<field name=\'folio_id\' readonly=\'1\'/>
</page>
<page name=\"comments\" string=\'Comments\'>
<field name=\"comments\"/>
</page>
</notebook>
这是python类
Class HotelReservationLine(models.Model):
_name = \"hotel.reservation.line\"
_description = \"Reservation Line\"
name = fields.Char(\"Name\")
line_id = fields.Many2one(\"hotel.reservation\")
reserve = fields.Many2many(
\"hotel.room\",
\"hotel_reservation_line_room_rel\",
\"hotel_reservation_line_id\",
\"room_id\",
domain=\"[(\'isroom\',\'=\',True),\\
(\'categ_id\',\'=\',categ_id)]\",
)
categ_id = fields.Many2one(\"hotel.room.type\", \"Room Type\")