|
@@ -10,7 +10,7 @@ class Hostel(models.Model):
|
|
|
currency_id = fields.Many2one('res.currency', string='Currency')
|
|
|
|
|
|
# _table = 'hostel_hostel'
|
|
|
-
|
|
|
+ custom_domain = "hostel_code"
|
|
|
name = fields.Char(string='宿舍名称', required=True)
|
|
|
hostel_code = fields.Char(string='代码', required=True)
|
|
|
street = fields.Char('街道')
|
|
@@ -24,7 +24,7 @@ class Hostel(models.Model):
|
|
|
email = fields.Char('邮箱')
|
|
|
hostel_floors = fields.Integer(string="楼层")
|
|
|
image = fields.Binary("宿舍图片")
|
|
|
- activate = fields.Boolean(string="激活", default=True, help="激活 / 停用宿舍记录")
|
|
|
+ active = fields.Boolean(string="可用", default=True, help="激活/停用 宿舍记录")
|
|
|
type = fields.Selection(
|
|
|
string="类型",
|
|
|
selection=[("男性", "男生宿舍"), ("女性", "女生宿舍"), ("混合", "混合宿舍")],
|
|
@@ -35,6 +35,7 @@ class Hostel(models.Model):
|
|
|
other_info = fields.Text(string="其他信息", help="输入更多信息")
|
|
|
description = fields.Html(string="描述")
|
|
|
hostel_rating = fields.Float('宿舍平均排名', digits="rating value")
|
|
|
+ company_dependent = fields.Boolean(string="公司依赖", default=True)
|
|
|
|
|
|
@api.depends('hostel_code')
|
|
|
def _compute_display_name(self):
|
|
@@ -53,4 +54,15 @@ class Hostel(models.Model):
|
|
|
elif record.hostel_floors > 50:
|
|
|
# record.hostel_floors = 50
|
|
|
raise models.ValidationError("楼层数不能超过50层")
|
|
|
- # record.message_post(body="楼层数不能超过50层")
|
|
|
+ # record.message_post(body="楼层数不能超过50层")
|
|
|
+
|
|
|
+ # 此函数用于在当前字段分组时扩展read_group结果
|
|
|
+ # @api.model
|
|
|
+ # def _read_group_selection_field(self, values, domain, order):
|
|
|
+ # return ["choice1", "choice2"]
|
|
|
+
|
|
|
+ # 此函数也用于在当前字段分组时扩展read_group结果
|
|
|
+ # @api.model
|
|
|
+ # def _read_group_many2one_field(self, records, domain, order):
|
|
|
+ # return records + self.search([custom_domain])
|
|
|
+
|