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