添加功能
This commit is contained in:
@@ -34,6 +34,8 @@ class OvertimeApprovals(models.Model):
|
||||
attendance_id = fields.Many2one('hr.attendance', string="当天考勤")
|
||||
start_week = fields.Char(string="星期", compute='_compute_weekday')
|
||||
end_time = fields.Datetime(string="结束时间")
|
||||
rest_start_time = fields.Datetime(string="开始时间")
|
||||
rest_end_time = fields.Datetime(string="结束时间")
|
||||
end_week = fields.Char(string="星期", compute='_compute_weekday')
|
||||
type_overtime = fields.Selection([('work', '工作日加班'), ('weekend', '周末加班'), ('holiday', '节假日加班')],
|
||||
string="加班类型", compute="_compute_overtime_type", store=True)
|
||||
|
||||
@@ -84,6 +84,15 @@
|
||||
<!-- </group>-->
|
||||
<group/>
|
||||
</group>
|
||||
<group col="3">
|
||||
<group>
|
||||
<field name="rest_start_time"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="rest_end_time"/>
|
||||
</group>
|
||||
<group/>
|
||||
</group>
|
||||
<group col="2">
|
||||
<group>
|
||||
<field name="duration"/>
|
||||
|
||||
@@ -33,6 +33,7 @@ class PropertyMeterArchives(models.Model):
|
||||
yuthon_property_ids = fields.Many2many("yuthon.property", string="物业信息")
|
||||
line_ids = fields.One2many("meter.archives.line", "archives_id", string="明细行")
|
||||
remarks = fields.Text(string="备注")
|
||||
fixed_receivables = fields.Float(string="固定应收", digits=(16, 4))
|
||||
state = fields.Selection([("reading", "已抄"), ("unreading", "未抄")], string="抄表状态", default="unreading")
|
||||
|
||||
# 一次性更改仪表位置
|
||||
|
||||
@@ -45,6 +45,7 @@ class PropertyMeterWater(models.Model):
|
||||
)
|
||||
standards_id = fields.Many2one("yuthon.electricity.setting", string="标准")
|
||||
yuthon_property_ids = fields.Many2many("yuthon.property", string="物业信息")
|
||||
fixed_receivables = fields.Float(string="固定应收", digits=(16, 4))
|
||||
line_ids = fields.One2many("meter.water.line", "water_id", string="水表明细行")
|
||||
state = fields.Selection(
|
||||
[("reading", "已抄"), ("unreading", "未抄")],
|
||||
|
||||
@@ -594,8 +594,13 @@ class YuthonPropertyWater(models.Model):
|
||||
"target": "new"
|
||||
}
|
||||
|
||||
# 补充删除取消关联的逻辑
|
||||
def unlink(self):
|
||||
for record in self:
|
||||
if record.property_meter_water_id and record.yuthon_property_id:
|
||||
if record.yuthon_property_id in record.property_meter_water_id.yuthon_property_ids:
|
||||
record.property_meter_water_id.write({
|
||||
'yuthon_property_ids': [(3, record.yuthon_property_id.id)]
|
||||
})
|
||||
return super().unlink()
|
||||
|
||||
|
||||
@@ -611,7 +616,7 @@ class YuthonPropertyEnergy(models.Model):
|
||||
epitope_values_id = fields.Many2one(related='property_meter_archives_id.epitope_values_id', string="位置")
|
||||
yuthon_property_id = fields.Many2one('yuthon.property', string="物业管理")
|
||||
|
||||
# 水表跳转
|
||||
# 电表跳转
|
||||
def detail(self):
|
||||
return {
|
||||
"type": "ir.actions.act_window",
|
||||
@@ -624,6 +629,12 @@ class YuthonPropertyEnergy(models.Model):
|
||||
|
||||
# 补充删除取消关联的逻辑
|
||||
def unlink(self):
|
||||
for record in self:
|
||||
if record.property_meter_archives_id and record.yuthon_property_id:
|
||||
if record.yuthon_property_id in record.property_meter_archives_id.yuthon_property_ids:
|
||||
record.property_meter_archives_id.write({
|
||||
'yuthon_property_ids': [(3, record.yuthon_property_id.id)]
|
||||
})
|
||||
return super().unlink()
|
||||
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
<field name="start_time"/>
|
||||
<field name="end_time"/>
|
||||
<field name="archives_state"/>
|
||||
<field name="fixed_receivables"/>
|
||||
<field name="remarks"/>
|
||||
</group>
|
||||
</group>
|
||||
@@ -137,6 +138,12 @@
|
||||
<group expand="0" string="Group By">
|
||||
<filter string="按月" name="group_by_meter_date_month" domain="[]" context="{'group_by': 'meter_date_month'}"/>
|
||||
</group>
|
||||
<header_search>
|
||||
<quick_filter string="状态">
|
||||
<filter string="已推送" name="done" domain="[('is_push', '=', True)]" />
|
||||
<filter string="未推送" name="none" domain="[('is_push', '=', False)]" />
|
||||
</quick_filter>
|
||||
</header_search>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
<field name="start_time" />
|
||||
<field name="end_time" />
|
||||
<field name="water_state" />
|
||||
<field name="fixed_receivables"/>
|
||||
<field name="remarks" />
|
||||
</group>
|
||||
</group>
|
||||
@@ -145,6 +146,12 @@
|
||||
<group expand="0" string="Group By">
|
||||
<filter string="按月" name="group_by_meter_date_month" domain="[]" context="{'group_by': 'meter_date_month'}"/>
|
||||
</group>
|
||||
<header_search>
|
||||
<quick_filter string="状态">
|
||||
<filter string="已推送" name="done" domain="[('is_push', '=', True)]" />
|
||||
<filter string="未推送" name="none" domain="[('is_push', '=', False)]" />
|
||||
</quick_filter>
|
||||
</header_search>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -20,6 +20,11 @@ class ElectricWaterWizard(models.TransientModel):
|
||||
if meter.end_time:
|
||||
if meter.end_time and meter.end_time < self.push_date:
|
||||
continue
|
||||
first_property = meter.yuthon_property_ids[0]
|
||||
contract_line = self.env['property.lease.contract.line'].search([
|
||||
('address_id', '=', first_property.id),
|
||||
('lease_id.contact_state', '=', 'ing')
|
||||
], limit=1)
|
||||
# 查找上个月的记录
|
||||
# 查找上个月的记录,上次用量,上次读数,上次抄表日期
|
||||
last_month_line = meter.line_ids.search([('meter_date', '<', self.push_date)]).sorted('meter_date')[-1]
|
||||
@@ -43,6 +48,7 @@ class ElectricWaterWizard(models.TransientModel):
|
||||
'type': meter.type,
|
||||
'archives_state': meter.archives_state,
|
||||
'maximum_count': meter.maximum_count,
|
||||
'contract_id': contract_line.lease_id if contract_line else False,
|
||||
})
|
||||
|
||||
# 处理水表推送
|
||||
@@ -54,6 +60,11 @@ class ElectricWaterWizard(models.TransientModel):
|
||||
if water.end_time:
|
||||
if water.end_time and water.end_time < self.push_date:
|
||||
continue
|
||||
first_property = water.yuthon_property_ids[0]
|
||||
contract_line = self.env['property.lease.contract.line'].search([
|
||||
('address_id', '=', first_property.id),
|
||||
('lease_id.contact_state', '=', 'ing')
|
||||
], limit=1)
|
||||
# 查找上个月的记录,上次用量,上次读数,上次抄表日期
|
||||
last_month_line = water.line_ids.search([('meter_date', '<', self.push_date)]).sorted('meter_date')[-1]
|
||||
# 如果当前数据不存在,则新建任务,按照天的纬度
|
||||
@@ -75,4 +86,5 @@ class ElectricWaterWizard(models.TransientModel):
|
||||
'type': water.type,
|
||||
'water_state': water.water_state,
|
||||
'maximum_count': water.maximum_count,
|
||||
'contract_id': contract_line.lease_id if contract_line else False,
|
||||
})
|
||||
|
||||
@@ -20,24 +20,26 @@ class TaskPushWizard(models.TransientModel):
|
||||
if self.meter_ids:
|
||||
management_type_id = self.env['yuthon.management.type'].search([('name', '=', '电费')], limit=1)
|
||||
for meter in self.meter_ids:
|
||||
self.env['property.accounts.receivable'].create({
|
||||
'contract_id': meter.contract_id.id,
|
||||
'lessee_id': meter.lessee_id.id if meter.lessee_id else None,
|
||||
'original_amount': meter.receivables,
|
||||
'due_date': self.push_date,
|
||||
'create_time': datetime.now(),
|
||||
'management_type_id': management_type_id.id,
|
||||
})
|
||||
meter.is_push = True
|
||||
if meter.unit and meter.contract_id:
|
||||
self.env['property.accounts.receivable'].create({
|
||||
'contract_id': meter.contract_id.id,
|
||||
'lessee_id': meter.lessee_id.id if meter.lessee_id else None,
|
||||
'original_amount': meter.archives_id.fixed_receivables if meter.archives_id.fixed_receivables else meter.receivables,
|
||||
'due_date': self.push_date,
|
||||
'create_time': datetime.now(),
|
||||
'management_type_id': management_type_id.id,
|
||||
})
|
||||
meter.is_push = True
|
||||
if self.water_ids:
|
||||
management_type_id = self.env['yuthon.management.type'].search([('name', '=', '水费')], limit=1)
|
||||
for water in self.water_ids:
|
||||
self.env['property.accounts.receivable'].create({
|
||||
'contract_id': water.contract_id.id,
|
||||
'lessee_id': water.lessee_id.id if water.lessee_id else None,
|
||||
'original_amount': water.receivables,
|
||||
'due_date': self.push_date,
|
||||
'create_time': datetime.now(),
|
||||
'management_type_id': management_type_id.id,
|
||||
})
|
||||
water.is_push = True
|
||||
if water.unit and water.contract_id:
|
||||
self.env['property.accounts.receivable'].create({
|
||||
'contract_id': water.contract_id.id,
|
||||
'lessee_id': water.lessee_id.id if water.lessee_id else None,
|
||||
'original_amount': water.water_id.fixed_receivables if water.water_id.fixed_receivables else water.receivables,
|
||||
'due_date': self.push_date,
|
||||
'create_time': datetime.now(),
|
||||
'management_type_id': management_type_id.id,
|
||||
})
|
||||
water.is_push = True
|
||||
|
||||
@@ -47,7 +47,7 @@ class PropertyMeterArchives(models.Model):
|
||||
class MeterArchivesLine(models.Model):
|
||||
_inherit = 'meter.archives.line'
|
||||
|
||||
contract_id = fields.Many2one('property.lease.contract', string="合同", compute="compute_contract_id")
|
||||
contract_id = fields.Many2one('property.lease.contract', string="合同")
|
||||
lessee_id = fields.Many2one(related="contract_id.lessee_id", string="承租方")
|
||||
contract_name = fields.Char(string='合同名称', store=True, index=True, compute="_compute_name")
|
||||
lessee_name = fields.Char(string='承租方名称', store=True, index=True, compute="_compute_name")
|
||||
@@ -60,23 +60,24 @@ class MeterArchivesLine(models.Model):
|
||||
if name.lessee_id:
|
||||
name.lessee_name = name.lessee_id.name
|
||||
|
||||
@api.depends('yuthon_property_ids')
|
||||
def compute_contract_id(self):
|
||||
for record in self:
|
||||
def update_contract(self):
|
||||
archives_ids = self.env["meter.archives.line"].browse(
|
||||
self._context.get('active_ids', self._context.get('active_id')))
|
||||
for record in archives_ids:
|
||||
if record.yuthon_property_ids:
|
||||
lease_contract = self.env['property.lease.contract.line'].search([('address_id', '=', record.yuthon_property_ids[0].id)], limit=1)
|
||||
if lease_contract:
|
||||
record.contract_id = lease_contract.lease_id.id
|
||||
else:
|
||||
record.contract_id = False
|
||||
else:
|
||||
record.contract_id = False
|
||||
contract_line = self.env['property.lease.contract.line'].search([
|
||||
('address_id', '=', record.yuthon_property_ids[0].id),
|
||||
('lease_id.actual_start_time', '<=', record.meter_date),
|
||||
('lease_id.actual_end_time', '>=', record.meter_date)
|
||||
], limit=1)
|
||||
if contract_line:
|
||||
record.contract_id = contract_line.lease_id.id
|
||||
|
||||
|
||||
class MeterWaterLine(models.Model):
|
||||
_inherit = 'meter.water.line'
|
||||
|
||||
contract_id = fields.Many2one('property.lease.contract', string="合同", compute="compute_contract_id")
|
||||
contract_id = fields.Many2one('property.lease.contract', string="合同")
|
||||
lessee_id = fields.Many2one(related="contract_id.lessee_id", string="承租方")
|
||||
contract_name = fields.Char(string='合同名称', store=True, index=True, compute="_compute_name")
|
||||
lessee_name = fields.Char(string='承租方名称', store=True, index=True, compute="_compute_name")
|
||||
@@ -89,18 +90,19 @@ class MeterWaterLine(models.Model):
|
||||
if name.lessee_id:
|
||||
name.lessee_name = name.lessee_id.name
|
||||
|
||||
@api.depends('yuthon_property_ids')
|
||||
def compute_contract_id(self):
|
||||
for record in self:
|
||||
def update_contract(self):
|
||||
water_ids = self.env["meter.water.line"].browse(
|
||||
self._context.get('active_ids', self._context.get('active_id')))
|
||||
for record in water_ids:
|
||||
if record.yuthon_property_ids:
|
||||
lease_contract = self.env['property.lease.contract.line'].search(
|
||||
[('address_id', '=', record.yuthon_property_ids[0].id)], limit=1)
|
||||
if lease_contract:
|
||||
record.contract_id = lease_contract.lease_id.id
|
||||
else:
|
||||
record.contract_id = False
|
||||
else:
|
||||
record.contract_id = False
|
||||
contract_line = self.env['property.lease.contract.line'].search([
|
||||
('address_id', '=', record.yuthon_property_ids[0].id),
|
||||
('lease_id.actual_start_time', '<=',record.meter_date),
|
||||
('lease_id.actual_end_time', '>=',record.meter_date)
|
||||
], limit=1)
|
||||
if contract_line:
|
||||
record.contract_id = contract_line.lease_id.id
|
||||
|
||||
|
||||
class YuthonProperty(models.Model):
|
||||
_inherit = 'yuthon.property'
|
||||
|
||||
@@ -127,7 +127,7 @@ class PropertyLeaseContract(models.Model):
|
||||
return default_rate.id if default_rate else False
|
||||
|
||||
percentage_liquidated_damages = fields.Many2one('yuthon.penalty.setting', string="违约金比例", default=_get_percentage_liquidated_damages)
|
||||
percentage_damages= fields.Float(string="违约金")
|
||||
percentage_damages= fields.Float(string="违约金", compute="_compute_contract_count")
|
||||
date_of_payment = fields.Selection([('five', '5'), ('fifteen', '15'), ('twenty', '20'), ('twentyfive', '25')], string="支付日期")
|
||||
first_pay = fields.Date(string="首次付款日")
|
||||
unit_price = fields.Float(string="单价", store=True, digits=(16, 4))
|
||||
@@ -156,7 +156,7 @@ class PropertyLeaseContract(models.Model):
|
||||
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)
|
||||
not_received = fields.Float(string="未收", compute="_compute_contract_count")
|
||||
actual_receivable = fields.Float(string="实际应收")
|
||||
now_receivable = fields.Float(string="当期应收")
|
||||
total_receivable = fields.Float(string="总已收")
|
||||
@@ -249,7 +249,7 @@ class PropertyLeaseContract(models.Model):
|
||||
contract_count = fields.Integer(string="联系人数量", compute='_compute_contract_count')
|
||||
reconciliation_count = fields.Integer(string="对账数量", compute='_compute_reconciliation_count')
|
||||
process_count = fields.Integer(string="流程数量", compute='_compute_process_count')
|
||||
|
||||
is_overdue = fields.Boolean(string="是否逾期", compute='_compute_contract_count', store=True)
|
||||
is_issues = fields.Boolean(string='是否上会')
|
||||
issues_result = fields.Html(string="会议结果")
|
||||
related_issues_id = fields.Many2one('issue.library', string="关联议题")
|
||||
@@ -307,7 +307,40 @@ class PropertyLeaseContract(models.Model):
|
||||
|
||||
def _compute_contract_count(self):
|
||||
for record in self:
|
||||
current_date = datetime.now()
|
||||
current_month_start = datetime(current_date.year, current_date.month, 1)
|
||||
if current_date.month == 12:
|
||||
next_month = 1
|
||||
next_year = current_date.year + 1
|
||||
else:
|
||||
next_month = current_date.month + 1
|
||||
next_year = current_date.year
|
||||
current_month_end = datetime(next_year, next_month, 1) - timedelta(days=1)
|
||||
record.contract_count = self.env['property.accounts.receivable'].search_count([('contract_id', '=', record.id)])
|
||||
overdue_domain = [
|
||||
('contract_id', '=', record.id),
|
||||
('due_date', '<', current_month_start),
|
||||
('submitted', '!=', 0)
|
||||
]
|
||||
has_overdue = self.env['property.accounts.receivable'].search_count(overdue_domain) > 0
|
||||
record.is_overdue = has_overdue
|
||||
not_received_domain = [
|
||||
('contract_id', '=', record.id),
|
||||
('submitted', '!=', 0),
|
||||
('due_date', '<=', current_month_end),
|
||||
('management_type_id.name', '!=', '违约金')
|
||||
]
|
||||
receivable_records = self.env['property.accounts.receivable'].search(not_received_domain)
|
||||
record.not_received = sum(receivable_records.mapped('submitted'))
|
||||
|
||||
percentage_damages_domain = [
|
||||
('contract_id', '=', record.id),
|
||||
('submitted', '!=', 0),
|
||||
('management_type_id.name', '=', '违约金'),
|
||||
('due_date', '<=', current_month_end),
|
||||
]
|
||||
receivable_records = self.env['property.accounts.receivable'].search(percentage_damages_domain)
|
||||
record.percentage_damages = sum(receivable_records.mapped('submitted'))
|
||||
|
||||
def _compute_reconciliation_count(self):
|
||||
for record in self:
|
||||
@@ -339,15 +372,6 @@ class PropertyLeaseContract(models.Model):
|
||||
action.update({'domain': [('code', '=', self.code)]})
|
||||
return action
|
||||
|
||||
|
||||
@api.depends()
|
||||
def _compute_not_received(self):
|
||||
not_reconciled_records = self.env['property.accounts.receivable'].search([
|
||||
('contract_id', '=', self.id),
|
||||
('is_reconciliation', '=', False)
|
||||
])
|
||||
self.not_received = sum(record.submitted for record in not_reconciled_records)
|
||||
|
||||
def update_contract(self):
|
||||
contract_ids = self.env["property.lease.contract"].browse(
|
||||
self._context.get('active_ids', self._context.get('active_id')))
|
||||
|
||||
@@ -643,7 +643,10 @@
|
||||
<field name="model">property.bank.statements</field>
|
||||
<field name="inherit_id" ref="yuthon_property.view_property_bank_statements_search"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='original_amount']" position="after">
|
||||
<xpath expr="//field[@name='name_account']" position="after">
|
||||
<field name="contract_ids"
|
||||
string="综合搜索"
|
||||
filter_domain="['|', '|', '|', ('name_account', 'ilike', self), ('contract_ids.name', 'ilike', self), ('property_name', 'ilike', self), ('admin_id', 'ilike', self)]"/>
|
||||
<field name="contract_ids"/>
|
||||
<field name="property_name" string="物业信息"/>
|
||||
</xpath>
|
||||
|
||||
@@ -425,7 +425,7 @@
|
||||
<sheet>
|
||||
<div name="button_box" class="oe_button_box">
|
||||
<button icon="fa-calendar" name="action_open_contract" class="oe_stat_button" type="object">
|
||||
<field string="应租" name="contract_count" widget="statinfo"/>
|
||||
<field string="租金" name="contract_count" widget="statinfo"/>
|
||||
</button>
|
||||
<button icon="fa-exchange" name="action_open_reconciliation" class="oe_stat_button" type="object">
|
||||
<field string="对账" name="reconciliation_count" widget="statinfo"/>
|
||||
@@ -814,6 +814,7 @@
|
||||
<filter string="执行中" name="ing" domain="[('contact_state', '=', 'ing')]" />
|
||||
<filter string="中止" name="done" domain="[('contact_state', '=', 'terminate')]"/>
|
||||
<filter string="历史" name="early" domain="['|', ('expiration_coming', '=', 'due'), ('contact_state', '=', 'terminate')]"/>
|
||||
<filter string="逾期" name="overdue" domain="[('is_overdue', '=', True)]"/>
|
||||
<filter string="即将到期" name="reclaim" domain="[('expiration_coming', '=', 'coming')]"/>
|
||||
</quick_filter>
|
||||
</header_search>
|
||||
|
||||
Reference in New Issue
Block a user