diff --git a/yuthon_property/__manifest__.py b/yuthon_property/__manifest__.py index 85c1b63c4..e2a68380b 100644 --- a/yuthon_property/__manifest__.py +++ b/yuthon_property/__manifest__.py @@ -59,6 +59,8 @@ 'wizard/evaluation_plan_wizard_views.xml', 'wizard/property_water_wizard_views.xml', 'wizard/receivable_log_wizard_views.xml', + 'wizard/water_price_wizard.xml', + 'wizard/meter_price_wizard.xml', 'wizard/property_statements_wizard_views.xml', 'views/menuitem.xml', ], diff --git a/yuthon_property/models/property_meter_archives.py b/yuthon_property/models/property_meter_archives.py index 3bef72959..ae43242e3 100644 --- a/yuthon_property/models/property_meter_archives.py +++ b/yuthon_property/models/property_meter_archives.py @@ -19,11 +19,13 @@ class PropertyMeterArchives(models.Model): meter_type = fields.Selection([('electric', '电表'), ('water', '水表')], string='仪表类型') other = fields.Char(string='其他') meter_date = fields.Date(string='抄表年月') - last_dosage = fields.Float(string='上次读数') + last_dosage = fields.Float(string='上次用量') + last_read = fields.Float(string='上次读数') last_meter = fields.Date(string='上次抄表日期') - current_meter = fields.Float(string='本次读数', tracking=True) + current_meter = fields.Float(string='本次用量', tracking=True) + current_read = fields.Float(string='本次读数', tracking=True) ratio = fields.Float(string='倍率') - unit = fields.Float(string='单价') + unit = fields.Float(string='当月单价') archives_state = fields.Selection([('stop', '停用'), ('use', '正常'), ('rent', '出租')], string='状态', compute='_compute_archives_state', store=True, default='use') dosage = fields.Float(string='用量') is_push = fields.Boolean(string='已推送') @@ -131,6 +133,20 @@ class PropertyMeterArchives(models.Model): record.last_dosage += record.current_meter record.current_meter = 0 + def meter_price_wizard(self): + meter_ids = self.env["property.meter.archives"].browse( + self._context.get('active_ids', self._context.get('active_id'))) + return { + 'name': '电表价格调整', + 'type': 'ir.actions.act_window', + 'res_model': 'meter.price.wizard', + 'view_mode': 'form', + 'target': 'new', + "context": { + "default_meter_ids": meter_ids.ids, + } + } + class PropertyElectricReading(models.Model): _name = 'property.electric.reading' current_meter = fields.Float(string='本次用量', tracking=True) diff --git a/yuthon_property/models/property_meter_water.py b/yuthon_property/models/property_meter_water.py index bc65e611b..6c5dd2061 100644 --- a/yuthon_property/models/property_meter_water.py +++ b/yuthon_property/models/property_meter_water.py @@ -18,10 +18,12 @@ class PropertyMeterWater(models.Model): meter_type = fields.Selection([('electric', '电表'), ('water', '水表')], string='仪表类型') other = fields.Char(string='其他') meter_date = fields.Date(string='抄表年月') - last_dosage = fields.Float(string='上次读数') + last_dosage = fields.Float(string='上次用量') + last_read = fields.Float(string='上次读数') last_meter = fields.Date(string='上次抄表日期') - unit = fields.Float(string='单价') - current_meter = fields.Float(string='本次读数', tracking=True) + unit = fields.Float(string='当月单价') + current_meter = fields.Float(string='本次用量', tracking=True) + current_read = fields.Float(string='本次读数', tracking=True) ratio = fields.Float(string='倍率') dosage = fields.Float(string='用量') is_push = fields.Boolean(string='已推送') @@ -123,6 +125,20 @@ class PropertyMeterWater(models.Model): record.last_dosage += record.current_meter record.current_meter = 0 + def water_price_wizard(self): + water_ids = self.env["property.meter.water"].browse( + self._context.get('active_ids', self._context.get('active_id'))) + return { + "type": "ir.actions.act_window", + "name": "修改水表单价弹窗", + "res_model": "property.water.wizard", + "view_mode": "form", + "target": "new", + "context": { + "default_water_ids": water_ids.ids, + } + } + class PropertyWaterReading(models.Model): _name = 'property.water.reading' current_meter = fields.Float(string='本次用量', tracking=True) \ No newline at end of file diff --git a/yuthon_property/security/ir.model.access.csv b/yuthon_property/security/ir.model.access.csv index 218431f00..80c62a3e8 100644 --- a/yuthon_property/security/ir.model.access.csv +++ b/yuthon_property/security/ir.model.access.csv @@ -87,4 +87,7 @@ access_evaluation_company,evaluation_company,model_evaluation_company,base.group access_evaluation_plan_wizard,evaluation_plan_wizard,model_evaluation_plan_wizard,base.group_user,1,1,1,1 access_receivable_log_wizard, receivable.log.wizard,model_receivable_log_wizard,base.group_user,1,1,1,1 access_amount_way,amount_way,model_amount_way,base.group_user,1,1,1,1 -access_property_summary_report, property_summary_report,model_property_summary_report,base.group_user,1,1,1,1 \ No newline at end of file +access_property_summary_report, property_summary_report,model_property_summary_report,base.group_user,1,1,1,1 + +access_meter_price_wizard, meter_price_wizard,model_meter_price_wizard,base.group_user,1,1,1,1 +access_water_price_wizard, water_price_wizard,model_water_price_wizard,base.group_user,1,1,1,1 \ No newline at end of file diff --git a/yuthon_property/views/property_meter_archives_views.xml b/yuthon_property/views/property_meter_archives_views.xml index 4b5b2c1ad..1ea863d55 100644 --- a/yuthon_property/views/property_meter_archives_views.xml +++ b/yuthon_property/views/property_meter_archives_views.xml @@ -16,7 +16,9 @@ + + @@ -36,6 +38,9 @@ property.meter.archives +
+
@@ -69,7 +74,7 @@ (0, 0, {'view_mode': 'tree', 'view_id': ref('yuthon_property.view_property_meter_archives_tree')})]"/> - 电表抄表 + 电表任务 property.meter.archives tree,search [('is_push', '=', True)] diff --git a/yuthon_property/views/property_meter_water_views.xml b/yuthon_property/views/property_meter_water_views.xml index 6ef178ad5..0cb91a113 100644 --- a/yuthon_property/views/property_meter_water_views.xml +++ b/yuthon_property/views/property_meter_water_views.xml @@ -17,7 +17,9 @@ + + @@ -38,6 +40,9 @@ property.meter.water +
+
@@ -70,7 +75,7 @@ (0, 0, {'view_mode': 'tree', 'view_id': ref('yuthon_property.view_property_meter_water_tree')})]"/>
- 水表抄表 + 水表任务 property.meter.water tree,search [('is_push', '=', True)] diff --git a/yuthon_property/wizard/__init__.py b/yuthon_property/wizard/__init__.py index 14234ab69..d72576f0c 100644 --- a/yuthon_property/wizard/__init__.py +++ b/yuthon_property/wizard/__init__.py @@ -5,3 +5,5 @@ from . import property_water_wizard from . import property_statements_wizard from . import evaluation_plan_wizard from . import receivable_log_wizard +from . import meter_price_wizard +from . import water_price_wizard diff --git a/yuthon_property/wizard/meter_price_wizard.py b/yuthon_property/wizard/meter_price_wizard.py new file mode 100644 index 000000000..02de965a9 --- /dev/null +++ b/yuthon_property/wizard/meter_price_wizard.py @@ -0,0 +1,15 @@ +from odoo import models, fields, api +from odoo.exceptions import UserError, ValidationError + + +class MeterPriceWizard(models.TransientModel): + _name = 'meter.price.wizard' + _description = '电表修改单价弹窗' + + meter_ids = fields.Many2many('property.meter.archives', string='关联电表') + price = fields.Float(string='修改单价') + + def confirm(self): + for meter in self.meter_ids: + meter.unit = self.price + diff --git a/yuthon_property/wizard/meter_price_wizard.xml b/yuthon_property/wizard/meter_price_wizard.xml new file mode 100644 index 000000000..5b1a52853 --- /dev/null +++ b/yuthon_property/wizard/meter_price_wizard.xml @@ -0,0 +1,21 @@ + + + + meter.price.wizard.form + meter.price.wizard + +
+ + + + +
+
+
+
+
+
+ + diff --git a/yuthon_property/wizard/water_price_wizard.py b/yuthon_property/wizard/water_price_wizard.py new file mode 100644 index 000000000..bbd813f22 --- /dev/null +++ b/yuthon_property/wizard/water_price_wizard.py @@ -0,0 +1,16 @@ +from odoo import models, fields, api +from odoo.exceptions import UserError, ValidationError + + +class WaterPriceWizard(models.TransientModel): + _name = 'water.price.wizard' + _description = '水表修改单价弹窗' + + water_ids = fields.Many2many('property.meter.water', string='关联电表') + price = fields.Float(string='修改单价') + + def confirm(self): + for water in self.water_ids: + water.unit = self.price + + diff --git a/yuthon_property/wizard/water_price_wizard.xml b/yuthon_property/wizard/water_price_wizard.xml new file mode 100644 index 000000000..756796da5 --- /dev/null +++ b/yuthon_property/wizard/water_price_wizard.xml @@ -0,0 +1,21 @@ + + + + water.price.wizard.form + water.price.wizard + +
+ + + + +
+
+
+
+
+
+ + diff --git a/yuthon_property_approval/models/property_lease_contract.py b/yuthon_property_approval/models/property_lease_contract.py index 8a7dde966..a9e51efff 100644 --- a/yuthon_property_approval/models/property_lease_contract.py +++ b/yuthon_property_approval/models/property_lease_contract.py @@ -153,6 +153,8 @@ class PropertyLeaseContract(models.Model): is_electricity = fields.Boolean(string="是否有电费", compute='_compute_lease_ids') is_mange = fields.Boolean(string="是否有管理费") miscellaneous = fields.Text(string="其他约定") + water_price = fields.Float(string="水费单价") + ele_price = fields.Float(string="电费单价") number = fields.Integer(string="次数", default=0) total_area = fields.Float(string="总面积", digits=(16, 4)) not_received = fields.Float(string="未收", compute="_compute_not_received", store=True) diff --git a/yuthon_property_approval/views/property_lease_contract.xml b/yuthon_property_approval/views/property_lease_contract.xml index 86f742ed2..464e8dc96 100644 --- a/yuthon_property_approval/views/property_lease_contract.xml +++ b/yuthon_property_approval/views/property_lease_contract.xml @@ -242,6 +242,8 @@ + + @@ -660,6 +662,8 @@ + +