diff --git a/yuthon_property/__manifest__.py b/yuthon_property/__manifest__.py index 1fe6787be..104215a05 100644 --- a/yuthon_property/__manifest__.py +++ b/yuthon_property/__manifest__.py @@ -46,7 +46,9 @@ 'views/property_check_decorate_views.xml', 'views/property_other_list_views.xml', 'views/property_bank_statements_views.xml', - 'views/property_meter_reading_views.xml', + 'views/property_water_reading_views.xml', + 'views/property_electric_reading_views.xml', + 'views/property_deposit_list_views.xml', 'wizard/yuthon_property_wizard_views.xml', 'wizard/property_meter_wizard_views.xml', 'wizard/property_tenant_wizard_views.xml', diff --git a/yuthon_property/models/__init__.py b/yuthon_property/models/__init__.py index ddd3a6cb5..10d1a2069 100644 --- a/yuthon_property/models/__init__.py +++ b/yuthon_property/models/__init__.py @@ -30,9 +30,11 @@ from . import property_check_lobby from . import property_check_project from . import property_check_room from . import property_check_stairs -from . import property_meter_reading +from . import property_electric_reading from . import property_message_fee from . import yuthon_property_setting from . import yuthon_precinct_message from . import yuthon_property_message -from . import property_bank_statements \ No newline at end of file +from . import property_bank_statements +from . import property_water_reading +from . import property_deposit_list \ No newline at end of file diff --git a/yuthon_property/models/property_assess.py b/yuthon_property/models/property_assess.py index 145c2a37c..6de46d5b1 100644 --- a/yuthon_property/models/property_assess.py +++ b/yuthon_property/models/property_assess.py @@ -21,3 +21,7 @@ class PropertyType(models.Model): class PropertyProspectiveCustomers(models.Model): _name = 'property.prospective.customers' + + +class PropertyMeterReading(models.Model): + _name = 'property.meter.reading' \ No newline at end of file diff --git a/yuthon_property/models/property_deposit_list.py b/yuthon_property/models/property_deposit_list.py new file mode 100644 index 000000000..4073aa170 --- /dev/null +++ b/yuthon_property/models/property_deposit_list.py @@ -0,0 +1,9 @@ +from odoo import models, fields, api + + +class PropertyDepositList(models.Model): + _name = 'property.deposit.list' + _description = '押金列表' + + property_id = fields.Many2one('yuthon.property', string='物业') + lessee_id = fields.Many2one(related='property_id.lessee_id', string='承租方') \ No newline at end of file diff --git a/yuthon_property/models/property_electric_reading.py b/yuthon_property/models/property_electric_reading.py new file mode 100644 index 000000000..bd415f42c --- /dev/null +++ b/yuthon_property/models/property_electric_reading.py @@ -0,0 +1,53 @@ +from odoo import models, fields, api + + +class PropertyElectricReading(models.Model): + _name = 'property.electric.reading' + _inherit = ['mail.thread.main.attachment', 'mail.activity.mixin'] + _description = '抄表' + + code = fields.Char(string='编号') + position = fields.Char(string='单元编号') + property_id = fields.Many2one('yuthon.property', string='地址') + users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id) + contract = fields.Char(string='合同') + lessee_id = fields.Many2one(related='property_id.lessee_id', string="承租方") + state = fields.Char(string='状态') + employee_ids = fields.Many2many('hr.employee', string='抄表人') + meter_type = fields.Selection([('electric', '电表'), ('water', '水表')], string='仪表类型') + payment_account = fields.Selection([('prepaid', '电费'), ('postpaid', '水费')], string='缴费科目') + other = fields.Char(string='其他') + billing_period = fields.Date(string='账期') + meter_date= fields.Date(string='抄表年月') + last_meter = fields.Date(string='上次') + current_meter = fields.Float(string='本次', tracking=True) + apply_standards = fields.Char(string='应用标准') + price_unit = fields.Float(string='单价') + ratio = fields.Float(string='倍率') + amount_wastage = fields.Float(string='损耗量') + dosage = fields.Float(string='用量') + is_push = fields.Boolean(string='已推送') + generate_charges = fields.Float(string='生成费用') + type = fields.Selection([('public', '公共'), ('fees', '收费')], string='收费类型') + reading_type = fields.Selection([('done', '已抄'), ('undone', '待抄')], string='类型') + + def reading_publish(self): + menu_id = self.env['ir.ui.menu'].search([('name', '=', '电表抄表')]) + str = 'https://oa.thtzjt.com/web#id={}&cids=1&menu_id={}&action={}&model=property.electric.reading&view_type=form'.format(self.id, menu_id.id, menu_id.action.id) + reading_ids = self.env["property.electric.reading"].browse(self._context.get('active_ids', self._context.get('active_id'))) + for record in reading_ids: + for employee_id in record.employee_ids: + we_id = self.env['hr.employee'].search([('id', '=', employee_id)]).wecom_userid + self.sudo().env["wecom.apps"].sync_send_message_textcard(category='notice', user_id=we_id, + title="通知公告", + description="您有抄表待处理,请及时处理", + url=str, btntxt="详细信息") + + def button_details(self): + return { + 'name': '抄表详情', + 'type': 'ir.actions.act_window', + 'view_mode': 'form', + 'res_model': 'property.electric.reading', + 'res_id': self.id, + } diff --git a/yuthon_property/models/property_meter_archives.py b/yuthon_property/models/property_meter_archives.py index 2e90463ae..dc7ca915d 100644 --- a/yuthon_property/models/property_meter_archives.py +++ b/yuthon_property/models/property_meter_archives.py @@ -1,7 +1,7 @@ from email.policy import default from odoo import models, fields, api - +from odoo.exceptions import UserError, ValidationError class PropertyMeterArchives(models.Model): _name = 'property.meter.archives' @@ -18,7 +18,6 @@ class PropertyMeterArchives(models.Model): maker = fields.Char(string='制造商') meter_gateways = fields.Char(string='仪表网关') #选择字段 后续优化 is_state = fields.Boolean(string='是否启用') - gauge_type = fields.Char(string='仪表类型', default='电表') type = fields.Selection([('public', '公共'), ('fees', '收费')], string='类型') gauge_magnification = fields.Float(string='仪表倍率') maximum_count = fields.Float(string='最大计数', default=99999) @@ -29,6 +28,7 @@ class PropertyMeterArchives(models.Model): meter_reading_type = fields.Selection([('readout','最后读数'),('accumulation','本次用量')], string='抄表类型') gauge_labels = fields.Text(string='仪表标签') meter_remarks = fields.Text(string='仪表备注') + is_push = fields.Boolean(string='是否推送') pre_existing_balances = fields.Float(string='预存结余') start_time = fields.Date(string="开始时间") end_time = fields.Date(string="结束时间") @@ -61,4 +61,37 @@ class PropertyMeterArchives(models.Model): "res_model": "property.meter.wizard", "view_mode": "form", "target": "new", - } \ No newline at end of file + } + + def button_reading_push(self): + for rec in self: + rec.write({ + 'is_push': True, + }) + if rec.is_push: + raise UserError("该仪表已经推送,不能重复推送") + self.env["property.electric.reading"].create({ + 'code': rec.name, + 'property_id': rec.yuthon_property_id.id if rec.yuthon_property_id else None, + 'ratio': rec.gauge_magnification, + 'position': rec.unit_number, + 'type': rec.type, + 'is_push': True, + }) + + def batch_reading_push(self): + archives_ids = self.env["property.meter.archives"].browse(self._context.get('active_ids', self._context.get('active_id'))) + for record in archives_ids: + record.write({ + 'is_push': True, + }) + if record.is_push: + raise UserError(f"该{record.name}仪表已经推送,不能重复推送") + self.env["property.electric.reading"].create({ + 'code': record.name, + 'property_id': record.yuthon_property_id.id if record.yuthon_property_id else None, + 'ratio': record.gauge_magnification, + 'position': record.unit_number, + 'type': record.type, + 'is_push': True, + }) \ No newline at end of file diff --git a/yuthon_property/models/property_meter_water.py b/yuthon_property/models/property_meter_water.py index e8ed4dabd..843e69dbd 100644 --- a/yuthon_property/models/property_meter_water.py +++ b/yuthon_property/models/property_meter_water.py @@ -1,4 +1,5 @@ from odoo import models, fields, api +from odoo.exceptions import UserError, ValidationError class PropertyMeterWater(models.Model): @@ -16,7 +17,6 @@ class PropertyMeterWater(models.Model): maker = fields.Char(string='制造商') meter_gateways = fields.Char(string='仪表网关') #选择字段 后续优化 is_state = fields.Boolean(string='是否启用') - gauge_type = fields.Char(string='仪表类型', default='水表') other = fields.Char(string='其他') type = fields.Selection([('public', '公共'), ('fees', '收费')], string='类型') gauge_magnification = fields.Float(string='仪表倍率') @@ -28,6 +28,7 @@ class PropertyMeterWater(models.Model): meter_reading_type = fields.Selection([('readout','最后读数'),('accumulation','本次用量')], string='抄表类型') gauge_labels = fields.Text(string='仪表标签') meter_remarks = fields.Text(string='仪表备注') + is_push = fields.Boolean(string='是否推送') pre_existing_balances = fields.Float(string='预存结余') start_time = fields.Date(string="开始时间") end_time = fields.Date(string="结束时间") @@ -59,4 +60,37 @@ class PropertyMeterWater(models.Model): "res_model": "property.water.wizard", "view_mode": "form", "target": "new", - } \ No newline at end of file + } + + def button_reading_water_push(self): + for rec in self: + rec.write({ + 'is_push': True, + }) + if rec.is_push: + raise UserError(f"该仪表已经推送,不能重复推送") + self.env["property.water.reading"].create({ + 'code': rec.name , + 'property_id': rec.yuthon_property_id.id if rec.yuthon_property_id else None, + 'ratio': rec.gauge_magnification, + 'position': rec.unit_number , + 'type': rec.type, + 'is_push': True, + }) + + def batch_reading_water_push(self): + water_ids = self.env["property.meter.water"].browse(self._context.get('active_ids', self._context.get('active_id'))) + for record in water_ids: + record.write({ + 'is_push': True, + }) + if record.is_push: + raise UserError(f"该{record.unit_number}仪表已经推送,不能重复推送") + self.env["property.water.reading"].create({ + 'code': record.name, + 'property_id': record.yuthon_property_id.id if record.yuthon_property_id else None, + 'ratio': record.gauge_magnification, + 'position': record.unit_number, + 'type': record.type, + 'is_push': True, + }) \ No newline at end of file diff --git a/yuthon_property/models/property_rent_list.py b/yuthon_property/models/property_rent_list.py index 8a0052855..063fde13a 100644 --- a/yuthon_property/models/property_rent_list.py +++ b/yuthon_property/models/property_rent_list.py @@ -35,7 +35,7 @@ class PropertyRentList(models.Model): is_billing = fields.Boolean(string='开票') is_reconciliation = fields.Boolean(string='对账') is_push = fields.Boolean(string='已推送') - management_type_id = fields.Many2one('yuthon.management.type', string='管理费类型') + management_type_id = fields.Many2one('yuthon.management.type', string='应收类型') last_update_time = fields.Datetime(string='最后修改时间') def write(self, vals): @@ -52,4 +52,5 @@ class PropertyRentList(models.Model): rent_ids = self.env["property.rent.list"].browse( self._context.get('active_ids', self._context.get('active_id'))) for record in rent_ids: - record.is_push = True \ No newline at end of file + record.is_push = True + diff --git a/yuthon_property/models/property_tenant_information.py b/yuthon_property/models/property_tenant_information.py index d480c8420..45d79365e 100644 --- a/yuthon_property/models/property_tenant_information.py +++ b/yuthon_property/models/property_tenant_information.py @@ -26,6 +26,7 @@ class PropertyTenantInformation(models.Model): business_license_id = fields.Many2one('ir.attachment', string='营业执照') power_attorney_id = fields.Many2one('ir.attachment', string='委托代理书') attorne_card_id = fields.Many2one('ir.attachment', string='委托代理人身份证') + bank_ids = fields.One2many('property.bank.line', 'tenant_id', string='银行信息') def update_tenant_wizard(self): return { @@ -36,6 +37,11 @@ class PropertyTenantInformation(models.Model): "target": "new", } +class PropertyBankLine(models.Model): + _name = 'property.bank.line' + _description = '银行账户明细' - - + tenant_id = fields.Many2one('property.tenant.information', string='关联承租方信息') + name = fields.Char(string="账户") + user = fields.Char(string="用户") + bank = fields.Char(string="开户行") \ No newline at end of file diff --git a/yuthon_property/models/property_meter_reading.py b/yuthon_property/models/property_water_reading.py similarity index 81% rename from yuthon_property/models/property_meter_reading.py rename to yuthon_property/models/property_water_reading.py index 6adb7fb97..bc2027162 100644 --- a/yuthon_property/models/property_meter_reading.py +++ b/yuthon_property/models/property_water_reading.py @@ -1,10 +1,10 @@ from odoo import models, fields, api -class PropertyMeterReading(models.Model): - _name = 'property.meter.reading' +class PropertyWaterReading(models.Model): + _name = 'property.water.reading' _inherit = ['mail.thread.main.attachment', 'mail.activity.mixin'] - _description = '抄表' + _description = '水表抄表' code = fields.Char(string='编号') position = fields.Char(string='单元编号') @@ -32,9 +32,9 @@ class PropertyMeterReading(models.Model): reading_type = fields.Selection([('done', '已抄'), ('undone', '待抄')], string='类型') def reading_publish(self): - menu_id = self.env['ir.ui.menu'].search([('name', '=', '电表抄表')]) - str = 'https://oa.thtzjt.com/web#id={}&cids=1&menu_id={}&action={}&model=property.meter.reading&view_type=form'.format(self.id, menu_id.id, menu_id.action.id) - reading_ids = self.env["property.meter.reading"].browse(self._context.get('active_ids', self._context.get('active_id'))) + menu_id = self.env['ir.ui.menu'].search([('name', '=', '水表抄表')]) + str = 'https://oa.thtzjt.com/web#id={}&cids=1&menu_id={}&action={}&model=property.water.reading&view_type=form'.format(self.id, menu_id.id, menu_id.action.id) + reading_ids = self.env["property.water.reading"].browse(self._context.get('active_ids', self._context.get('active_id'))) for record in reading_ids: for employee_id in record.employee_ids: we_id = self.env['hr.employee'].search([('id', '=', employee_id)]).wecom_userid @@ -48,14 +48,6 @@ class PropertyMeterReading(models.Model): 'name': '抄表详情', 'type': 'ir.actions.act_window', 'view_mode': 'form', - 'res_model': 'property.meter.reading', + 'res_model': 'property.water.reading', 'res_id': self.id, } - - def button_reading_push(self): - self.is_push = True - - def batch_reading_push(self): - reading_ids = self.env["property.meter.reading"].browse(self._context.get('active_ids', self._context.get('active_id'))) - for record in reading_ids: - record.is_push = True \ No newline at end of file diff --git a/yuthon_property/models/yuthon_property.py b/yuthon_property/models/yuthon_property.py index 9af6c255e..4849f7c9b 100644 --- a/yuthon_property/models/yuthon_property.py +++ b/yuthon_property/models/yuthon_property.py @@ -41,8 +41,6 @@ class YuthonProperty(models.Model): is_electricity_meter = fields.Boolean(string="电表") is_confirm_authorization = fields.Boolean(string="确权") property_card = fields.Html(string="产权证") - life_timer = fields.Datetime(string="使用时间") - property_use_time = fields.Selection([('a', '70年'), ('b', '40年'), ('c', '50年'), ('e', '30年'), ('f', '60年')], string="产权年限") asset_type_id = fields.Many2one('yuthon.resource.type', string="出租类型") is_hvac = fields.Boolean(string="使用中央空调") is_handle_land = fields.Boolean(string="办理土地有偿使用手续") @@ -54,8 +52,6 @@ class YuthonProperty(models.Model): rental_unit_price = fields.Float(string="评估单价") title_number = fields.Char(string="产权编号") suite_area = fields.Float(string="套内面积", digits=(16, 4)) - start_time = fields.Date(string="生效时间") - end_date = fields.Date(string="失效日期") purpose_id = fields.Many2one('yuthon.resource.purpose', string="管理类型") admin_id = fields.Many2one('res.users', string="片区管理员") lessee_id = fields.Many2one('property.tenant.information', string='承租方') @@ -289,7 +285,9 @@ class YuthonProperty(models.Model): self._context.get('active_ids', self._context.get('active_id'))) for record in property_ids: company_id = record.manage_information_ids[0].company_id.id if record.manage_information_ids else '' + title_deed = record.title_information_ids[0].title_certificate if record.title_information_ids else '' record.company_id = company_id + record.title_deed = title_deed class YuthonPropertyWater(models.Model): _name = 'yuthon.property.water' @@ -326,6 +324,8 @@ class TitleInformationLine(models.Model): owner_id = fields.Many2one(related='property_message_id.owner_id', string="权属人") equity_area = fields.Float(related='property_message_id.equity_area', string="产权面积", digits=(16, 4)) registered_id = fields.Many2one(related='property_message_id.registered_id', string='证载用途') + property_use_time = fields.Selection(related='property_message_id.property_use_time', string="产权年限") + life_timer = fields.Datetime(related='property_message_id.life_timer', string="使用时间") title_certificate = fields.Char(related='property_message_id.title_certificate', string="产权证号") start_time = fields.Date(string="生效日期", default=fields.Date.today) @@ -355,8 +355,8 @@ class DisassemblyInformationLine(models.Model): yuthon_property_id = fields.Many2one('yuthon.property', string="关联物业信息") property_id = fields.Many2one('yuthon.property', string="物业名称") rent_area = fields.Float(related='property_id.rent_area', string="可租面积") - start_time = fields.Date(related='property_id.start_time',string="生效日期") - end_date = fields.Date(related='property_id.end_date',string="失效日期") + start_time = fields.Date(string="生效日期") + end_date = fields.Date(string="失效日期") diff --git a/yuthon_property/models/yuthon_property_message.py b/yuthon_property/models/yuthon_property_message.py index 143c86ba0..587d514b6 100644 --- a/yuthon_property/models/yuthon_property_message.py +++ b/yuthon_property/models/yuthon_property_message.py @@ -12,5 +12,7 @@ class YuthonPropertyMessage(models.Model): pooled_area = fields.Float(string="公摊面积", digits=(16, 4)) ctual_area = fields.Float(string="实际面积", digits=(16, 4)) equity_area = fields.Float(string="产权面积", digits=(16, 4)) + property_use_time = fields.Selection([('a', '70年'), ('b', '40年'), ('c', '50年'), ('e', '30年'), ('f', '60年')], string="产权年限") + life_timer = fields.Datetime(string="使用时间") registered_id = fields.Many2one('yuthon.purpose.evidence', string='证载用途') documents_ids = fields.Many2many('ir.attachment', string="附件") diff --git a/yuthon_property/security/ir.model.access.csv b/yuthon_property/security/ir.model.access.csv index 9367e0bea..14989260f 100644 --- a/yuthon_property/security/ir.model.access.csv +++ b/yuthon_property/security/ir.model.access.csv @@ -40,7 +40,6 @@ access_property_check_lobby,property_check_lobby,model_property_check_lobby,base access_property_check_project,property_check_project,model_property_check_project,base.group_user,1,1,1,1 access_property_check_room,property_check_room,model_property_check_room,base.group_user,1,1,1,1 access_property_check_stairs,property_check_stairs,model_property_check_stairs,base.group_user,1,1,1,1 -access_property_meter_reading,property_meter_reading,model_property_meter_reading,base.group_user,1,1,1,1 access_property_message_fee,property_message_fee,model_property_message_fee,base.group_user,1,1,1,1 access_yuthon_penalty_setting,yuthon_penalty_setting,model_yuthon_penalty_setting,base.group_user,1,1,1,1 access_yuthon_tariff_setting,yuthon_tariff_setting,model_yuthon_tariff_setting,base.group_user,1,1,1,1 @@ -62,4 +61,8 @@ access_yuthon_purpose_evidence,yuthon_purpose_evidence,model_yuthon_purpose_evid access_yuthon_management_type,yuthon_management_type,model_yuthon_management_type,base.group_user,1,1,1,1 access_yuthon_bank_setting,yuthon_bank_setting,model_yuthon_bank_setting,base.group_user,1,1,1,1 access_property_bank_statements,property_bank_statements,model_property_bank_statements,base.group_user,1,1,1,1 -access_property_statements_wizard,property_statements_wizard,model_property_statements_wizard,base.group_user,1,1,1,1 \ No newline at end of file +access_property_statements_wizard,property_statements_wizard,model_property_statements_wizard,base.group_user,1,1,1,1 +access_property_bank_line,property_bank_line,model_property_bank_line,base.group_user,1,1,1,1 +access_property_electric_reading,property_electric_reading,model_property_electric_reading,base.group_user,1,1,1,1 +access_property_water_reading,property_water_reading,model_property_water_reading,base.group_user,1,1,1,1 +access_property_deposit_list,property_deposit_list,model_property_deposit_list,base.group_user,1,1,1,1 \ No newline at end of file diff --git a/yuthon_property/views/menuitem.xml b/yuthon_property/views/menuitem.xml index 6cc5d8b25..d38218432 100644 --- a/yuthon_property/views/menuitem.xml +++ b/yuthon_property/views/menuitem.xml @@ -124,29 +124,15 @@ name="水表抄表任务" parent="yuthon_property_meter_menu" action="view_property_meter_water_task_action"/> - - - + + + property.deposit.tree + property.deposit.list + + + + + + + + \ No newline at end of file diff --git a/yuthon_property/views/property_electric_reading_views.xml b/yuthon_property/views/property_electric_reading_views.xml new file mode 100644 index 000000000..c4995a0d6 --- /dev/null +++ b/yuthon_property/views/property_electric_reading_views.xml @@ -0,0 +1,103 @@ + + + + property.electric.reading.tree + property.electric.reading + + + + + + + + + + + + + + + + + + + + + + + + +