|
@@ -7,19 +7,36 @@ class Hostel(models.Model):
|
|
|
_order = "id desc, name"
|
|
|
_rec_name = 'hostel_code'
|
|
|
_rec_names_search = ["name", "hostel_code"]
|
|
|
+ currency_id = fields.Many2one('res.currency', string='Currency')
|
|
|
+
|
|
|
# _table = 'hostel_hostel'
|
|
|
|
|
|
- name = fields.Char(string='Hostel name', required=True)
|
|
|
+ name = fields.Char(string='宿舍名称', required=True)
|
|
|
hostel_code = fields.Char(string='代码', required=True)
|
|
|
- street = fields.Char('Street')
|
|
|
- street2 = fields.Char('Street2')
|
|
|
- city = fields.Char('City')
|
|
|
- zip = fields.Char('ZIP')
|
|
|
- state_id = fields.Many2one('res.country.state', string='State')
|
|
|
- country_id = fields.Many2one('res.country', string='Country')
|
|
|
- phone = fields.Char('Phone')
|
|
|
- mobile = fields.Char('Mobile')
|
|
|
- email = fields.Char('Email')
|
|
|
+ street = fields.Char('街道')
|
|
|
+ street2 = fields.Char('街道2')
|
|
|
+ city = fields.Char('城市')
|
|
|
+ zip = fields.Char('邮编')
|
|
|
+ state_id = fields.Many2one('res.country.state', string='省份')
|
|
|
+ country_id = fields.Many2one('res.country', string='国家')
|
|
|
+ phone = fields.Char('电话')
|
|
|
+ mobile = fields.Char('手机')
|
|
|
+ email = fields.Char('邮箱')
|
|
|
+ hostel_floors = fields.Integer(string="楼层")
|
|
|
+ image = fields.Binary("宿舍图片")
|
|
|
+ activate = fields.Boolean(string="激活", default=True, help="激活 / 停用宿舍记录")
|
|
|
+ type = fields.Selection(
|
|
|
+ string="类型",
|
|
|
+ selection=[("男性", "男生宿舍"), ("女性", "女生宿舍"), ("混合", "混合宿舍")],
|
|
|
+ help="宿舍类型",
|
|
|
+ required=True,
|
|
|
+ default="混合"
|
|
|
+ )
|
|
|
+ other_info = fields.Text(string="其他信息", help="输入更多信息")
|
|
|
+ description = fields.Html(string="描述")
|
|
|
+ hostel_rating = fields.Float('宿舍平均评分',
|
|
|
+ # digits=(14, 4))
|
|
|
+ digits = "rating value")
|
|
|
|
|
|
@api.depends('hostel_code')
|
|
|
def _compute_display_name(self):
|
|
@@ -27,4 +44,4 @@ class Hostel(models.Model):
|
|
|
name = record.name
|
|
|
if record.hostel_code:
|
|
|
name = f"{name} ({record.hostel_code})"
|
|
|
- record.display_name = name
|
|
|
+ record.display_name = name
|