Merge pull request !1309 from 李鹏宇/dev
This commit is contained in:
李鹏宇
2025-01-14 01:30:52 +00:00
committed by Gitee
12 changed files with 104 additions and 61 deletions
@@ -3,13 +3,15 @@ from odoo import models, fields, api
class PropertyMeterReading(models.Model):
_name = 'property.meter.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='合同')
customer_id = fields.Many2one('property.tenant.information', 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='仪表类型')
@@ -23,7 +25,7 @@ class PropertyMeterReading(models.Model):
price_unit = fields.Float(string='单价')
ratio = fields.Float(string='倍率')
amount_wastage = fields.Float(string='损耗量')
dosage = fields.Float(string='用量')
dosage = fields.Float(string='用量', tracking=True)
generate_charges = fields.Float(string='生成费用')
type = fields.Selection([('public', '公共'), ('fees', '收费')], string='收费类型')
reading_type = fields.Selection([('done', '已抄'), ('undone', '待抄')], string='类型')
@@ -38,4 +40,13 @@ class PropertyMeterReading(models.Model):
self.sudo().env["wecom.apps"].sync_send_message_textcard(category='notice', user_id=we_id,
title="通知公告",
description="您有抄表待处理,请及时处理",
url=str, btntxt="详细信息")
url=str, btntxt="详细信息")
def button_details(self):
return {
'name': '抄表详情',
'type': 'ir.actions.act_window',
'view_mode': 'form',
'res_model': 'property.meter.reading',
'res_id': self.id,
}
+3 -1
View File
@@ -6,7 +6,8 @@ class PropertyRentList(models.Model):
_description = '租金列表'
property_id = fields.Many2one('yuthon.property', string='物业')
lessee_id = fields.Many2one('property.tenant.information', string='承租方')
lessee_id = fields.Many2one(related='property_id.lessee_id', string='承租方')
contract_id = fields.Many2one('property.lease.contract', string="关联租赁合同审批")
due_date = fields.Date(string='应收日期')
year = fields.Selection(selection=[(str(i), str(i)) for i in range(2024, 2060)], string='所属年',)
month = fields.Selection([('1', '一月'), ('2', '二月'), ('3', '三月'), ('4', '四月'),
@@ -25,6 +26,7 @@ class PropertyRentList(models.Model):
is_suspend = fields.Boolean(string='挂起')
create_time = fields.Datetime(string='创建时间', default=fields.Datetime.now)
is_push = fields.Boolean(string='已推送')
management_type_id = fields.Many2one('yuthon.management.type', string='管理费类型')
last_update_time = fields.Datetime(string='最后修改时间')
def write(self, vals):
@@ -118,4 +118,10 @@ class YuthonPurposeEvidence(models.Model):
_name = 'yuthon.purpose.evidence'
_description = '证载用途'
name = fields.Char(string="证载用途")
name = fields.Char(string="证载用途")
class YuthonManagementType(models.Model):
_name = 'yuthon.management.type'
_description = '管理类型'
name = fields.Char(string="管理类型")
+2 -1
View File
@@ -58,4 +58,5 @@ access_property_meter_wizard,property_meter_wizard,model_property_meter_wizard,b
access_yuthon_industry_setting,yuthon_industry_setting,model_yuthon_industry_setting,base.group_user,1,1,1,1
access_property_tenant_wizard,property_tenant_wizard,model_property_tenant_wizard,base.group_user,1,1,1,1
access_property_water_wizard,property_water_wizard,model_property_water_wizard,base.group_user,1,1,1,1
access_yuthon_purpose_evidence,yuthon_purpose_evidence,model_yuthon_purpose_evidence,base.group_user,1,1,1,1
access_yuthon_purpose_evidence,yuthon_purpose_evidence,model_yuthon_purpose_evidence,base.group_user,1,1,1,1
access_yuthon_management_type,yuthon_management_type,model_yuthon_management_type,base.group_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
58 access_yuthon_industry_setting yuthon_industry_setting model_yuthon_industry_setting base.group_user 1 1 1 1
59 access_property_tenant_wizard property_tenant_wizard model_property_tenant_wizard base.group_user 1 1 1 1
60 access_property_water_wizard property_water_wizard model_property_water_wizard base.group_user 1 1 1 1
61 access_yuthon_purpose_evidence yuthon_purpose_evidence model_yuthon_purpose_evidence base.group_user 1 1 1 1
62 access_yuthon_management_type yuthon_management_type model_yuthon_management_type base.group_user 1 1 1 1
+2
View File
@@ -366,6 +366,8 @@
action="view_yuthon_industry_setting_action" sequence="60"/>
<menuitem id="yuthon_purpose_evidence_menu" parent="resource_mgmt_config_menu" name="证载用途"
action="view_yuthon_purpose_evidence_action" sequence="65"/>
<menuitem id="yuthon_management_type_menu" parent="resource_mgmt_config_menu" name="管理类型"
action="view_yuthon_management_type_action" sequence="70"/>
@@ -4,14 +4,15 @@
<field name="name">property.meter.reading.tree</field>
<field name="model">property.meter.reading</field>
<field name="arch" type="xml">
<tree string="抄表">
<tree string="抄表" editable="bottom">
<field name="code"/>
<field name="position" optional="hide"/>
<field name="property_id" optional="hide"/>
<field name="property_id"/>
<field name="contract" optional="hide"/>
<field name="customer_id" optional="hide"/>
<field name="lessee_id"/>
<field name="users_id" optional="hide"/>
<field name="state" optional="hide"/>
<field name="meter_type" optional="hide"/>
<field name="meter_type"/>
<field name="payment_account" optional="hide"/>
<field name="billing_period" optional="hide"/>
<field name="meter_date" optional="hide"/>
@@ -26,6 +27,7 @@
<field name="generate_charges" optional="hide"/>
<field name="other" optional="hide"/>
<field name="type" optional="hide"/>
<button name="button_details" type="object" string="详情" class="btn-primary"/>
</tree>
</field>
</record>
@@ -42,7 +44,7 @@
<field name="position"/>
<field name="property_id"/>
<field name="contract"/>
<field name="customer_id"/>
<field name="lessee_id"/>
<field name="state"/>
<field name="other"/>
<field name="meter_type"/>
@@ -63,6 +65,12 @@
</group>
</group>
</sheet>
<div class="o_attachment_preview"/>
<div class="oe_chatter">
<field name="message_follower_ids" groups="base.group_user"/>
<field name="activity_ids"/>
<field name="message_ids"/>
</div>
</form>
</field>
</record>
@@ -73,7 +81,7 @@
<search string="抄表">
<field name="code"/>
<filter name="property_id" string="地址" context="{'group_by':'property_id'}"/>
<filter name="reading_type" string="抄表类型" context="{'group_by':'reading_type'}"/>
<filter name="reading_type" string="抄表状态" context="{'group_by':'reading_type'}"/>
</search>
</field>
</record>
@@ -7,6 +7,7 @@
<tree editable="bottom" string="租金列表" decoration-danger = "charge_status == 'unpaid'"
decoration-success="charge_status == 'fully_paid'">
<field name="property_id"/>
<field name="contract_id"/>
<field name="lessee_id"/>
<field name="due_date"/>
<field name="original_amount"/>
@@ -17,6 +18,7 @@
<field name="is_push" column_invisible="1"/>
<field name="create_time"/>
<field name="last_update_time"/>
<field name="management_type_id"/>
<button name="unlink" type="object" class="btn-primary" string="删除"/>
<button name="button_push" type="object" class="btn-primary" string="推送"/>
</tree>
@@ -29,6 +31,10 @@
<search>
<field name="property_id"/>
<field name="lessee_id"/>
<group expand="0" string="group_by">
<filter name="group_property_id" string="物业" context="{'group_by':'property_id'}"/>
<filter name="group_contract_id" string="合同" context="{'group_by':'contract_id'}"/>
</group>
</search>
</field>
</record>
@@ -37,6 +43,7 @@
<field name="res_model">property.rent.list</field>
<field name="view_mode">tree,search</field>
<field name="domain">[('is_push', '=', False)]</field>
<field name="context">{'search_default_group_contract_id': 1}</field>
</record>
<record id="view_property_rent_list_action2" model="ir.actions.act_window">
<field name="name">应收账单</field>
@@ -221,4 +221,18 @@
<field name="res_model">yuthon.purpose.evidence</field>
<field name="view_mode">tree</field>
</record>
<record id="view_yuthon_management_type_tree" model="ir.ui.view">
<field name="name">yuthon.management.type.tree</field>
<field name="model">yuthon.management.type</field>
<field name="arch" type="xml">
<tree editable="bottom">
<field name="name"/>
</tree>
</field>
</record>
<record id="view_yuthon_management_type_action" model="ir.actions.act_window">
<field name="name">管理类型</field>
<field name="res_model">yuthon.management.type</field>
<field name="view_mode">tree</field>
</record>
</odoo>
@@ -10,13 +10,6 @@ from numpy.ma.core import default_filler
from odoo import models, fields, api, exceptions, _
from odoo.exceptions import UserError, ValidationError
class PropertyRentList(models.Model):
_inherit = 'property.rent.list'
contract_id = fields.Many2one('property.lease.contract', string="关联租赁合同审批")
class PropertyManagementList(models.Model):
_inherit = 'property.management.list'
@@ -43,7 +36,7 @@ class PropertyLeaseContract(models.Model):
_name = 'property.lease.contract'
_description = '租赁合同审批'
_inherit = ['mail.thread.main.attachment', 'mail.activity.mixin', 'soong.workflow.mixin']
_rec_name = 'name'
_rec_name = 'contract_code'
name = fields.Char(string='物业信息')
code = fields.Char(string="流水号", default=lambda self: self.env['ir.sequence'].next_by_code('property_lease_contract_code'))
@@ -78,7 +71,7 @@ class PropertyLeaseContract(models.Model):
actual_start_time = fields.Date(string="实际开始时间")
actual_end_time = fields.Date(string="实际结束时间", default=fields.Datetime.now)
end_comparison = fields.Selection([('red', '红'),('yellow', '黄'),('blue', '蓝')], string="结束时间对比(颜色)", compute='_compute_end_comparison', store=True)
expiration_coming = fields.Selection([('coming', '即将到期'), ('expired', '已到期')], string="结束时间对比(状态)", compute='_compute_expiration_coming', store=True)
expiration_coming = fields.Selection([('coming', '即将到期'), ('due', '已到期')], string="结束时间对比(状态)", compute='_compute_expiration_coming', store=True)
is_equal = fields.Boolean(string="是否相等", compute='_compute_end_comparison', store=True)
cycle_dict =fields.Selection([('monthly', '月度'), ('quarter', '季度'), ('half', '半年'),('year', '年度')],string='付款方式', default='monthly', help="应收")
@@ -131,7 +124,7 @@ class PropertyLeaseContract(models.Model):
total_receivable = fields.Float(string="总已收")
comparison = fields.Selection([('outweigh', '大于'), ('equal', '等于'), ('less', '小于')], string="对比", compute='_compute_comparison')
progress_percentage = fields.Float(string="合同进度", compute="_compute_progress_percentage")
condition = fields.Selection([('new', '新建'), ('approval', '审批中'), ('cancel', '作废'), ('be_executed', '待执行'), ('executed', '已执行'), ('expired', '已终止'), ('executing','执行中'), ('advance', '提前终止')], string="状态", default='new')
condition = fields.Selection([('new', '新建'), ('approval', '审批中'), ('cancel', '作废'), ('be_executed', '待执行'), ('executed', '已执行'), ('expired', '已终止'), ('advance', '提前终止')], string="状态", default='new')
contract_type = fields.Selection([('lease_renewal', '续租'), ('interim', '临租'), ('new', '补充协议'), ('first', '首租')], string="合同类型", default='first')
performance_bonds = fields.Float(string="经营履约保证金")
utility_bills = fields.Float(string="水电费押金")
@@ -194,8 +187,10 @@ class PropertyLeaseContract(models.Model):
delta = record.term_end_time - record.actual_end_time
if 0< delta.days < 90:
record.expiration_coming = 'coming'
elif record.actual_end_time == record.term_end_time:
record.expiration_coming = 'due'
else:
record.expiration_coming = 'expired'
record.expiration_coming = None
else:
record.expiration_coming = None
@@ -320,7 +320,7 @@
<field name="deposit_status" column_invisible="1"/>
<field name="company_id" string="所属公司"/>
<field name="admin_id" string="负责人"/>
<button name="button_lease_extension" type="object" class="btn-primary" string="延租"/>
<button name="button_lease_extension" type="object" class="btn-primary" string="续租"/>
<button name="button_lease_return" type="object" class="btn-primary" string="退租"/>
<button name="button_lease_change" type="object" class="btn-primary" string="变更"/>
</tree>
@@ -658,11 +658,11 @@
(0, 0, {'view_mode': 'tree', 'view_id': ref('yuthon_property_approval.view_property_lease_contract_tree1')}),
(0, 0, {'view_mode': 'form', 'view_id': ref('yuthon_property_approval.view_property_lease_contract_form1')})]"/>
</record>
<record id="property_lease_contract_executing_action" model="ir.actions.act_window">
<field name="name">执行中</field>
<record id="property_lease_contract_expired_action" model="ir.actions.act_window">
<field name="name">已终止</field>
<field name="res_model">property.lease.contract</field>
<field name="view_mode">tree,form,search</field>
<field name="domain">[('condition', '=', 'executing')]</field>
<field name="domain">[('condition', '=', 'expired')]</field>
<field name="context">{'search_default_group_by_condition':1}</field>
<field name="view_ids" eval="[(5, 0, 0),
(0, 0, {'view_mode': 'tree', 'view_id': ref('yuthon_property_approval.view_property_lease_contract_tree1')}),
@@ -677,11 +677,11 @@
(0, 0, {'view_mode': 'tree', 'view_id': ref('yuthon_property_approval.view_property_lease_contract_tree1')}),
(0, 0, {'view_mode': 'form', 'view_id': ref('yuthon_property_approval.view_property_lease_contract_form1')})]"/>
</record>
<record id="property_lease_contract_expired_action" model="ir.actions.act_window">
<record id="property_lease_contract_due_action" model="ir.actions.act_window">
<field name="name">已到期</field>
<field name="res_model">property.lease.contract</field>
<field name="view_mode">tree,form,search</field>
<field name="domain">[('expiration_coming', '=', 'expired')]</field>
<field name="domain">[('expiration_coming', '=', 'due')]</field>
<field name="view_ids" eval="[(5, 0, 0),
(0, 0, {'view_mode': 'tree', 'view_id': ref('yuthon_property_approval.view_property_lease_contract_tree1')}),
(0, 0, {'view_mode': 'form', 'view_id': ref('yuthon_property_approval.view_property_lease_contract_form1')})]"/>
@@ -740,14 +740,4 @@
<field name="state">code</field>
<field name="code">action = model.action_update_contract()</field>
</record>
<record id="inherit_property_rent_list_tree" model="ir.ui.view">
<field name="name">property.lease.contract.tree</field>
<field name="model">property.rent.list</field>
<field name="inherit_id" ref="yuthon_property.view_property_rent_list_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='property_id']" position="before">
<field name="contract_id" string="合同"/>
</xpath>
</field>
</record>
</odoo>
@@ -42,33 +42,44 @@
action="property_information_action"
sequence="28"/>
<menuitem
id="property_contract_process_menu"
parent="yuthon_property.yuthon_property_estate_menu"
name="流程"
sequence="10"/>
<menuitem
id="property_lease_alter_menu"
parent="yuthon_property.property_approval_menu"
parent="property_contract_process_menu"
name="续租审批审批"
action="property_lease_alter_action"
sequence="29"/>
sequence="1"/>
<menuitem
id="property_lease_extension_menu"
parent="yuthon_property.property_approval_menu"
parent="property_contract_process_menu"
name="延租审批"
action="property_lease_extension_action"
sequence="31"/>
sequence="3"/>
<menuitem
id="property_lease_renewal_menu"
parent="yuthon_property.property_approval_menu"
parent="property_contract_process_menu"
name="租赁合同变更审批"
action="property_lease_renewal_action"
sequence="32"/>
sequence="5"/>
<menuitem
id="property_transfer_approval_menu"
parent="property_contract_process_menu"
name="物业交接审批"
action="view_property_transfer_action"
sequence="10"/>
<menuitem
id="property_management_menu"
parent="yuthon_property.property_approval_menu"
name="物业管理变更申请表"
action="property_management_action"
sequence="33"/>
<menuitem
id="property_material_procurement_menu"
parent="yuthon_property.property_approval_menu"
@@ -202,8 +213,8 @@
sequence="1"/>
<menuitem id="property_lease_contract_executing_menu"
parent="property_lease_contract_management_menu"
name="执行中"
action="property_lease_contract_executing_action"
name="已终止"
action="property_lease_contract_expired_action"
sequence="3"/>
<menuitem id="property_lease_contract_executed_menu"
parent="property_lease_contract_management_menu"
@@ -215,21 +226,16 @@
name="即将到期"
action="property_lease_contract_coming_action"
sequence="8"/>
<menuitem id="property_lease_contract_coming_expired_menu"
<menuitem id="property_lease_contract_coming_due_menu"
parent="property_lease_contract_management_menu"
name="已到期"
action="property_lease_contract_expired_action"
name="合同到期"
action="property_lease_contract_due_action"
sequence="10"/>
<menuitem id="property_lease_contract_all_menu"
parent="property_lease_contract_management_menu"
name="全部合同"
action="property_lease_contract_all_action"
sequence="15"/>
<menuitem id="property_transfer_approval_menu"
parent="yuthon_property.yuthon_property_estate_menu"
name="物业交接审批"
action="view_property_transfer_action"
sequence="9"/>
<!--财务报表 -->
<menuitem id="yuthon_property_process"
sequence="99"
@@ -22,7 +22,6 @@ class PropertyRentalWizard(models.Model):
property_id = record.lease_ids[0].address_id.id if record.lease_ids else None
self.sudo().env["property.rent.list"].create({
"contract_id": record.id,
"contract_code": record.code,
"due_date": start_date,
'multiplier':multiplier,
"lessee_id": record.lessee_id.id,
@@ -37,7 +36,7 @@ class PropertyRentalWizard(models.Model):
start_date_adj = rent_id.start_data + relativedelta(months=period_month)
start_year_month = start_date_adj.strftime('%Y-%m')
end_year_month = rent_id.end_data.strftime('%Y-%m')
start_day = start_date_adj.day
# 通过period_month 来判断是否有免租期,则使用 period_rent,否则使用 monthly_amount
rent_amount = rent_id.period_rent if period_month else rent_id.monthly_amount
if is_year:
@@ -45,10 +44,12 @@ class PropertyRentalWizard(models.Model):
multiplier = rent_id.month_number - 12
else:
multiplier = rent_id.month_number
adjusted_rent = rent_amount * multiplier # 调整后的租金
adjusted_rent = rent_amount * multiplier
# 调整后的租金
now_data = datetime.now()
start_date = now_data.replace(day=start_day)
if start_year_month <= date_field_year_month < end_year_month:
self.create_rent_list(record, rent_id, adjusted_rent, rent_id.start_data,multiplier)
self.create_rent_list(record, rent_id, adjusted_rent, start_date,multiplier)
elif start_year_month <= date_field_year_month <= end_year_month:
if rent_id.end_data.day < days: