hostel_room.py 1.4 KB

123456789101112131415161718192021222324252627282930313233
  1. from odoo import models, fields, api
  2. class HostelRoom(models.Model):
  3. _name = 'hostel.room'
  4. currency_id = fields.Many2one('res.currency', string='Currency')
  5. rent_amount = fields.Monetary("Rnet Amount", help="Enter rent amount per month")
  6. # optional attribute: currency_field='currency_id' incase currency field have another name then 'currency_id'
  7. class TempClean(models.TransientModel):
  8. # Transient model模型用于临时存储数据,通常用于Wizard,Form视图等
  9. # 创建一个没有任何表的模型
  10. _table = None
  11. # 如果_auto为True,则模型使用SQL表名
  12. _sequence = None
  13. # 用于ID字段的SQL序列
  14. _sql_constraints = []
  15. # SQL约束[(名称, sql定义, 消息)]
  16. _register = True
  17. # 在ORM注册表中不可见
  18. _name = "房间清扫记录"
  19. # 模型名称
  20. _description = "房间清扫记录,每隔两个小时自动清理一次,可以自定义时间间隔"
  21. # 模型描述
  22. _inherit = []
  23. # 继承的模型
  24. fields.Char(string="清扫日期", required=True, readonly=True, help="自动生成清扫时间")
  25. fields.Char(string="房间号", required=True, readonly=True, help="清扫的房间号")
  26. fields.Boolean(string="是否清扫", default=False)
  27. fields.Char(sting="清扫人", required=True, groups="my_hostel.group_hostel_manager")
  28. @api.model
  29. def _is_clean(self):
  30. return []