Files
gzth/yuthon_property/models/yuthon_resource_mgmt_config.py
T
2025-04-17 11:05:25 +08:00

249 lines
7.4 KiB
Python

from pkg_resources import require
from odoo import models, fields, api
from pypinyin import pinyin,lazy_pinyin
class YuthonResourceType(models.Model):
_name = 'yuthon.resource.type'
_description = '资产类型'
name = fields.Char(string="资产类型")
class YuthonResourceHouseType(models.Model):
_name = 'yuthon.resource.house.type'
_description = '户型'
name = fields.Char(string="户型")
class YuthonResourcePurpose(models.Model):
_name = 'yuthon.resource.purpose'
_description = '资产用途'
name = fields.Char(string="用途")
class YuthonResourceManagementType(models.Model):
_name = 'yuthon.resource.management.type'
_description = '权属类型'
name = fields.Char(string="权属类型")
class YuthonResourceBillingType(models.Model):
_name = 'yuthon.resource.billing.type'
_description = '开票类型'
name = fields.Char(string="开票类型")
class YuthonPropertySource(models.Model):
_name = 'yuthon.property.source'
_description = '资产来源'
name = fields.Char(string="资产来源")
class YuthonOwnerMessage(models.Model):
_name = 'yuthon.owner.message'
_description = '权属人'
name = fields.Char(string="名称")
class YuthonRentalPurposes(models.Model):
_name = 'yuthon.rental.purpose'
_description = '出租用途'
name = fields.Char(string="出租用途")
class YuthonLiveRoom(models.Model):
_name = 'yuthon.live.room'
_description = '居住用房'
name = fields.Char(string="居住用房")
class YuthonElectricitySetting(models.Model):
_name = 'yuthon.electricity.setting'
_description = '电费标准配置'
name = fields.Char(string="电费标准")
amount = fields.Float(string="金额")
class YuthonWaterSetting(models.Model):
_name = 'yuthon.water.setting'
_description = '水费标准配置'
name = fields.Char(string="水费标准")
amount = fields.Float(string="金额")
class YuthonPropertySetting(models.Model):
_name = 'yuthon.property.setting'
_description = '物业费标准配置'
name = fields.Char(string="物业费标准")
class YuthonLotSetting(models.Model):
_name = 'yuthon.lot.setting'
_description = '地段配置'
name = fields.Char(string="地段")
class YuthonPropertyCompany(models.Model):
_name = 'yuthon.property.company'
_description = '物业公司配置'
_rec_name = 'referred'
_order = 'sequence'
name = fields.Char(string="物业公司")
sequence = fields.Char(string='序号')
referred = fields.Char(string="简称")
rent_account = fields.Char(string="收租公司账号")
start_data = fields.Date(string="开始日期")
end_data = fields.Date(string="结束日期")
class YuthonIndustrySetting(models.Model):
_name = 'yuthon.industry.setting'
_description = '行业配置'
name = fields.Char(string="行业")
class YuthonPurposeEvidence(models.Model):
_name = 'yuthon.purpose.evidence'
_description = '证载用途'
name = fields.Char(string="证载用途")
class YuthonManagementType(models.Model):
_name = 'yuthon.management.type'
_description = '管理类型'
name = fields.Char(string="管理类型")
class YuthonBankSetting(models.Model):
_name = 'yuthon.bank.setting'
_description = '银行'
name = fields.Char(string="银行")
class YuthonPropertyProduce(models.Model):
_name = 'yuthon.property.produce'
_description = '安全生产'
yuthon_property_id = fields.Many2one('yuthon.property', string="关联物业信息")
name = fields.Char(string="检查项目")
check_context = fields.Text(string='检查内容')
check_results = fields.Text(string="检查结果")
check_criteria = fields.Text(string="检查标准")
there_problem = fields.Text(string="存在问题")
problem_suggestion = fields.Text(string="整改措施")
problem_date = fields.Date(string="整改期限")
review_situation = fields.Text(string="复查情况")
check_people = fields.Many2one('hr.employee', string="检查人")
check_date = fields.Date(string="检查日期")
class YuthonPremisesSetting(models.Model):
_name = 'yuthon.premises.setting'
_description = '楼盘配置'
class RentFreeSetting(models.Model):
_name = 'rent.free.setting'
_description = '免租条件配置'
sequence = fields.Char(string='序号', store=True)
property_ids = fields.Many2many('yuthon.property', string='关联物业')
name = fields.Char(string="名称")
rent_type = fields.Selection([('housing', '住宅'), ('not_housing', '非住宅')], string="出租类型")
start_time = fields.Date(string="生效日期", default=fields.Date.today)
end_date = fields.Date(string="失效日期")
rent_free_line_ids = fields.One2many('rent.free.line', 'rent_id', string="免租条件配置明细")
@api.onchange('property_ids')
def onchange_property_ids(self):
for pro in self.property_ids:
reference_list = []
if self.name not in pro.reference_ids.mapped('rent_id.name'):
reference_list.append([0, 0, {
'yuthon_property_id': pro.id.origin,
'rent_id': self.id.origin,
}])
self.env['yuthon.property'].search([('id', '=', pro.id.origin)]).sudo().write({'reference_ids': reference_list})
class RentFreeLine(models.Model):
_name = 'rent.free.line'
_description = '免租条件配置明细'
rent_id = fields.Many2one('rent.free.setting', string='关联免租条件')
minimum_area = fields.Float(string="最小面积")
maximum_area = fields.Float(string="最大面积")
rent_fee_date = fields.Integer(string="免租期不超过")
class FeatureSetting(models.Model):
_name = 'feature.setting'
_description = '特色配置'
name = fields.Char(string="名称")
class MajorEventSetting(models.Model):
_name = 'major.event.setting'
_description = '重大事项配置'
name = fields.Char(string="名称")
inspector_html = fields.Html(string="内容")
documents_ids = fields.Many2many('ir.attachment', string="附件")
start_date = fields.Date(string="生效日期", default=fields.Date.today())
class PropertyFloorSetting(models.Model):
_name = 'property.floor.setting'
_description = '楼层配置'
_order = 'first_letter'
name = fields.Char('名称', required=True)
parent_id = fields.Many2one('property.floor.setting', string='父级')
child_ids = fields.One2many('property.floor.setting', 'parent_id', string='子级')
type = fields.Selection([('floor', '楼层'), ('building', '楼盘')], string='类型')
first_letter = fields.Char(string="首字母", compute='_compute_first_letter', store=True)
@api.depends('name')
def _compute_first_letter(self):
for record in self:
name = record.name
if name:
first_char = name[0]
pinyin_list = lazy_pinyin(first_char)
if pinyin_list:
record.first_letter = pinyin_list[0][0].upper()
else:
record.first_letter = ''
else:
record.first_letter = ''
class EvaluationCompany(models.Model):
_name = 'evaluation.company'
_description = '评估公司配置'
name = fields.Char(string="名称")
class AmountWay(models.Model):
_name = 'amount.way'
_description = '交易方式'
name = fields.Char(string="名称")